Skip to content

The lint unused_doc_comments classifies all kinds of #[doc …] attributes as documentation comments #96009

Open
@fmease

Description

@fmease

The lint unused_doc_comments triggers on any #[doc …] / #![doc …] (on any token stream inside the attribute) when it should only trigger on actual documentation comments i.e. #[doc = …] / #![doc = …].

E.g. the following code incorrectly labels #[doc(hidden)] as a doc comment:

fn f<#[doc(hidden)] T>() {}
warning: unused doc comment
 --> q.rs:1:6
  |
1 | fn f<#[doc(hidden)] T>() {}
  |      ^^^^^^^^^^^^^^ - rustdoc does not generate documentation for generic parameters
  |
  = note: `#[warn(unused_doc_comments)]` on by default
  = help: use `//` for a plain comment

@rustbot label A-lint
@rustbot claim

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.L-unused_doc_commentsLint: unused_doc_commentsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions