Skip to content

spurious "shadowed label name" warning #26570

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

Closed
durka opened this issue Jun 25, 2015 · 3 comments
Closed

spurious "shadowed label name" warning #26570

durka opened this issue Jun 25, 2015 · 3 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@durka
Copy link
Contributor

durka commented Jun 25, 2015

This playpen has an outer loop called 'outer with two inner loops, one after the other, both called 'inner. The warning says the name 'inner is shadowed, but it seems like it really isn't, since you can't refer to a loop's label after the end of the loop.

@sanxiyn sanxiyn added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 26, 2015
@arielb1 arielb1 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed A-diagnostics Area: Messages for errors, warnings, and lints labels Jun 26, 2015
@frewsxcv
Copy link
Member

Minimal example:

fn main() {
    'outer: while false {}
    'outer: while false {}
}
<anon>:3:13: 3:27 warning: label name `'outer` shadows a label name that is already in scope
<anon>:3     'outer: while false {}
                     ^~~~~~~~~~~~~~
<anon>:2:13: 2:27 note: shadowed label `'outer` declared here
<anon>:2     'outer: while false {}
                     ^~~~~~~~~~~~~~

Playpen link for the code above

@ghost
Copy link

ghost commented Jun 27, 2015

This seems like intended behaviour, see #24162.

@durka
Copy link
Contributor Author

durka commented Jun 27, 2015

Ah, future proofing! Makes sense, thanks.

@durka durka closed this as completed Jun 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

4 participants