-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Closed
Copy link
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
#![allow(unreachable_code)]
#![deny(unused_braces)]
fn main() {
return { println!("!") };
}
$ rustc +nightly-2023-01-14 src/main.rs # correct behavior
error: unnecessary braces around `return` value
--> src/main.rs:5:12
|
5 | return { println!("!") };
| ^^ ^^
|
note: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![deny(unused_braces)]
| ^^^^^^^^^^^^^
help: remove these braces
|
5 - return { println!("!") };
5 + return println!("!");
|
$ rustc +nightly-2023-01-15 src/main.rs # incorrect: no lint
The false negative bisects to #106866, so pretty obviously #106563. FYI @clubby789 @TaKO8Ki
From skimming #106545, that's an issue about const generics. It doesn't seem like the PR was supposed to have affected unused_braces situations outside of const generics position.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.