Skip to content

middle: reset loop labels while visiting closure #33345

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 11, 2016

Conversation

birkenfeld
Copy link
Contributor

This should fix #31754 and follow-up #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: #31754

Note: I amended the test file from #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

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
@rust-highfive
Copy link
Contributor

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@durka
Copy link
Contributor

durka commented May 2, 2016

It's too bad we can't just put #![deny(warnings)] or #![deny(shadowed_label_names)] in the test, due to #31745.

@pnkfelix
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 10, 2016

📌 Commit 6fed013 has been approved by pnkfelix

@pnkfelix
Copy link
Member

@bors rollup

steveklabnik added a commit to steveklabnik/rust that referenced this pull request 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 pull request 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 pull request 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
bors added a commit that referenced this pull request May 11, 2016
Rollup of 9 pull requests

- Successful merges: #33129, #33260, #33345, #33386, #33522, #33524, #33528, #33539, #33542
- Failed merges: #33342, #33475, #33517
@bors bors merged commit 6fed013 into rust-lang:master May 11, 2016
@birkenfeld birkenfeld deleted the issue-31754 branch May 12, 2016 05:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shadowed label false positive in closure
5 participants