Skip to content

Add a pass to mark doc attributes as used #14408

@sfackler

Description

@sfackler
Member

The unused-attribute lint currently globally whitelists all doc attributes as used, even if they're placed in contexts that rustdoc would never look at (e.g. match arms). There should be a separate pass over the AST that marks the attributes in the correct contexts.

#![warn(unused_attributes)]

fn f() {
    match 10 {
        /// test
        _ => {}
    }
}

Activity

steveklabnik

steveklabnik commented on Apr 30, 2015

@steveklabnik
Contributor

Triage: no change that I'm aware of.

steveklabnik

steveklabnik commented on Jun 27, 2016

@steveklabnik
Contributor

Triage: same as last year

Havvy

Havvy commented on Jun 30, 2018

@Havvy
Contributor

Triage: There's a new lint unused_doc_comments that triggers in these cases. IMO, this is good enough to close the issue as fixed. cc @QuietMisdreavus for confirmation.

QuietMisdreavus

QuietMisdreavus commented on Jul 5, 2018

@QuietMisdreavus
Contributor

@Havvy When/where was this lint added? I'm not familiar with it.

euclio

euclio commented on Nov 28, 2018

@euclio
Contributor

Added in #43009, where this case is specifically tested.

Mark-Simulacrum

Mark-Simulacrum commented on Aug 17, 2019

@Mark-Simulacrum
Member

Closing as per the above, looks like this was implemented in the unused_doc_comments lint.

added a commit that references this issue on Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@Havvy@euclio@sfackler@Mark-Simulacrum

        Issue actions

          Add a pass to mark doc attributes as used · Issue #14408 · rust-lang/rust