-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
struct X {
foo: i32,
}
#[allow(unused_variables)] // Not necessary for reproducing. Just to suppress an unrelated warning
fn main() {
let X {
#[doc(alias = "PatFieldAlias")]
foo
} = X {
foo: 123
};
let _ = X {
#[doc(alias = "ExprFieldAlias")]
foo: 123,
};
}Current output
No output (compilation succeeds without warning)Desired output
warning: unused doc comment
|
14 | let X {
15 | #[doc(alias = "PatFieldAlias")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 | / foo
17 | | } = X {
18 | | foo: 123
19 | | };
| |______- rustdoc does not generate documentation for pattern fields
|
= help: use `//` for a plain comment
= note: `#[warn(unused_doc_comments)]` on by default
warning: unused doc comment
|
22 | let _ = X {
23 | #[doc(alias = "ExprFieldAlias")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 | / foo: 123,
25 | | };
| |______- rustdoc does not generate documentation for expression fields
|
= help: use `//` for a plain comment
= note: `#[warn(unused_doc_comments)]` on by defaultRationale and extra context
The same warning is produced at other places like statements, expressions, functions etc. For completeness and consistency it should be produced for pattern and expression fields too.
Other cases
No response
Anything else?
rustc 1.74.0-nightly (35e4163 2023-09-01)
binary: rustc
commit-hash: 35e4163
commit-date: 2023-09-01
host: x86_64-pc-windows-msvc
release: 1.74.0-nightly
LLVM version: 17.0.0
rustc version older than 1.74.0 may ICE on this code. The ICE was fixed in 1.74.0
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.