-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Incorrect warning about label shadowing itself #25343
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
Comments
steveklabnik
added
the
A-diagnostics
Area: Messages for errors, warnings, and lints
label
May 13, 2015
I just came across this one myself, just thought I'd +1 |
bors
added a commit
that referenced
this issue
Jul 21, 2015
Fixes #25343 To be honest I'm not sure if this is the right fix (I haven't yet fully understood the code), but it seems to work. I'll look closer at the code when I have some time, in the meantime if this is the right fix it would be nice to get verification from someone who does understand the code 😄 r? @pnkfelix
birkenfeld
added a commit
to birkenfeld/rust
that referenced
this issue
May 2, 2016
This should fix rust-lang#31754 and follow-up rust-lang#25343. Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning. With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited. Fixes: rust-lang#31754
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
May 10, 2016
middle: reset loop labels while visiting closure This should fix rust-lang#31754 and follow-up rust-lang#25343. Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning. With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited. Fixes: rust-lang#31754 Note: I amended the test file from rust-lang#25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted? /cc @Manishearth
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
May 10, 2016
middle: reset loop labels while visiting closure This should fix rust-lang#31754 and follow-up rust-lang#25343. Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning. With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited. Fixes: rust-lang#31754 Note: I amended the test file from rust-lang#25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted? /cc @Manishearth
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
May 11, 2016
middle: reset loop labels while visiting closure This should fix rust-lang#31754 and follow-up rust-lang#25343. Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning. With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited. Fixes: rust-lang#31754 Note: I amended the test file from rust-lang#25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted? /cc @Manishearth
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code:
Results in this warning:
Obviously a label can't shadow itself, so there shouldn't be a warning. The issue doesn't occur outside of a closure.
The text was updated successfully, but these errors were encountered: