Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using same label name in seemingly non-shadowing context generates warning #48764

Closed
milesand opened this issue Mar 6, 2018 · 1 comment
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@milesand
Copy link
Contributor

milesand commented Mar 6, 2018

The following code:

fn main() {
    'a: loop {break;}
    'a: loop {break;}
}

generates the following warning:

warning: label name `'a` shadows a label name that is already in scope
 --> file_name.rs:3:5
  |
2 |     'a: loop {break;}
  |     -- first declared here
3 |     'a: loop {break;}
  |     ^^ lifetime 'a already in scope

As it is impossible to meaningfully use (as in break 'a) the 'a of the first loop from the second loop, the warning seems rather redundant.

@sfackler sfackler added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Mar 6, 2018
@petrochenkov
Copy link
Contributor

This was supposed to be a future-proofing measure, see #24162 / #24278.

@jkordish jkordish added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 10, 2018
@milesand milesand closed this as completed Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants