Skip to content

unused_doc_comments warning reported for each doc comment line on macro invocation, unlike on other expressions #83768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
camelid opened this issue Apr 2, 2021 · 2 comments · Fixed by #83816
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@camelid
Copy link
Member

camelid commented Apr 2, 2021

Other expressions work as expected: it reports just one error, for the whole sequence of doc comment lines.

macro_rules! foo { () => {}; }

fn main() {
    /// line1
    /// line2
    /// line3
    foo!();
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
warning: unused doc comment
 --> src/main.rs:4:5
  |
4 |     /// line1
  |     ^^^^^^^^^ rustdoc does not generate documentation for macro invocations
  |
  = note: `#[warn(unused_doc_comments)]` on by default
  = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

warning: unused doc comment
 --> src/main.rs:5:5
  |
5 |     /// line2
  |     ^^^^^^^^^ rustdoc does not generate documentation for macro invocations
  |
  = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

warning: unused doc comment
 --> src/main.rs:6:5
  |
6 |     /// line3
  |     ^^^^^^^^^ rustdoc does not generate documentation for macro invocations
  |
  = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

warning: 3 warnings emitted

    Finished dev [unoptimized + debuginfo] target(s) in 1.65s
     Running `target/debug/playground`

@camelid camelid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. labels Apr 2, 2021
@jyn514 jyn514 removed the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 2, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 2, 2021

(unused_doc_comments is a rustc lint.)

@jyn514 jyn514 added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Apr 2, 2021
@camelid
Copy link
Member Author

camelid commented Apr 2, 2021

(unused_doc_comments is a rustc lint.)

True, but I added T-rustdoc as well since it's a rustdoc-related lint.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 7, 2021
…cros, r=varkor

Trigger `unused_doc_comments` on macros at once

Fixes rust-lang#83768
@bors bors closed this as completed in 4d5bb1c Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants