-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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
rustc 1.51.0 (2fd73fabe 2021-03-23)
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
Docstrings placed at a few selected positions that cause either a warning (good
), an unrelated error (bad
) or both (ugly
).
fn good(num: u8) -> bool {
match num {
3 => true,
/// warning: unused doc comment
_ => false,
}
}
fn bad(num: u8) -> bool {
if num == 3 {
true
}
/// error[E0308]: mismatched types
/// error: expected expression, found keyword `else`
else {
false
}
}
fn ugly(num: u8) -> bool {
/// error[E0658]: attributes on expressions are experimental
/// warning: unused doc comment
num == 3
}
On the third example we at least get an additional warning to point us in the right direction.
The second example can become nightmare to catch :3
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.