You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The diagnostic emitted by lint empty_line_after_doc_comments highlights the following item if present and notes if the doc comment should not document `NAME` comment it out where NAME is the name of the item. However, there are item kinds that don't (quite) have a name, namely Use, ForeignMod, GlobalAsm, Impl, MacCall, DelegationMac if we're talking about the AST (and not the HIR).
In the rustc that Clippy currently uses such AST items bear an empty name (as a dummy placeholder) and Clippy blindly leaks it to users. Consider:
error: empty line after doc comment
--> src/lib.rs:3:1
|
3 | / /// X
4 | | // fn f() {}
5 | |
| |_^
6 | impl Ty {}
| ------- the comment documents this implementation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![deny(clippy::empty_line_after_doc_comments)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: if the empty line is unintentional remove it
help: if the doc comment should not document `` comment it out
|
3 | // /// X
| ++
Notice the last subdiagnostic.
I'll fix this after the Clippy sync once it includes PR rust-lang/rust#138740 (which would make the fix less hacky). Blocking it on the next sync.
rustbot
added
C-bug
Category: Clippy is not doing the correct thing
S-blocked
Status: marked as blocked ❌ on something else such as an RFC or other implementation work
T-AST
Type: Requires working with the AST
labels
Apr 1, 2025
… the following item is nameless (#14584)
Fixes#14515.
changelog: [`empty_line_after_doc_comments`]: Fix a help message for
cases where the following item is nameless.
Found this while reviewing PR rust-lang/rust#138740: See rust-lang/rust#138740 (comment).
The diagnostic emitted by lint
empty_line_after_doc_comments
highlights the following item if present and notesif the doc comment should not document `NAME` comment it out
whereNAME
is the name of the item. However, there are item kinds that don't (quite) have a name, namelyUse
,ForeignMod
,GlobalAsm
,Impl
,MacCall
,DelegationMac
if we're talking about the AST (and not the HIR).In the rustc that Clippy currently uses such AST items bear an empty name (as a dummy placeholder) and Clippy blindly leaks it to users. Consider:
Notice the last subdiagnostic.
I'll fix this after the Clippy sync once it includes PR rust-lang/rust#138740 (which would make the fix less hacky). Blocking it on the next sync.
@rustbot claim
@rustbot label C-bug S-blocked T-AST
The text was updated successfully, but these errors were encountered: