-
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 lintsC-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.
Description
When compiling the following code:
fn main() {
'a: for _ in 0..1 { break 'a; }
'a: for _ in 0..1 { break 'a; }
}rust emits the following warning:
warning: label name `'a` shadows a label name that is already in scope
--> src/main.rs:3:5
|
2 | 'a: for _ in 0..1 { break 'a; }
| -- first declared here
3 | 'a: for _ in 0..1 { break 'a; }
| ^^ lifetime 'a already in scope
I tried nightly in the playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=eda5af652ad2b13204432834e1b67f8e and got the same output
lifetime 'a already in scope seems wrong, since 'a is not a lifetime, but a label
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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.