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

Generator drop tracking: improve break and continue handling #93752

Merged
merged 2 commits into from
Feb 15, 2022

Conversation

eholk
Copy link
Contributor

@eholk eholk commented Feb 8, 2022

This PR fixes two related issues.

One, sometimes break or continue have a block target instead of an expression target. This seems to mainly happen with try blocks. Since the drop tracking analysis only works on expressions, if we see a block target for break or continue, we substitute the last expression of the block as the target instead.

Two, break and continue were incorrectly being treated as the same, so continue would also show up as an exit from the loop or block. This patch corrects the way continue is handled by keeping a stack of loop entry points and uses those to find the target of the continue.

Fixes #93197

r? @nikomatsakis

tmiasko and others added 2 commits February 7, 2022 12:27
This commit fixes two issues.

One, sometimes break or continue have a block target instead of an
expression target. This seems to mainly happen with try blocks. Since
the drop tracking analysis only works on expressions, if we see a block
target for break or continue, we substitute the last expression of the
block as the target instead.

Two, break and continue were incorrectly being treated as the same, so
continue would also show up as an exit from the loop or block. This
patch corrects the way continue is handled by keeping a stack of loop
entry points and uses those to find the target of the continue.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 8, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 8, 2022
@eholk
Copy link
Contributor Author

eholk commented Feb 8, 2022

This also includes the -Zdrop-tracking flag from #93313. Obviously it only needs to land once.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 14, 2022

📌 Commit c37a906 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2022
@nikomatsakis
Copy link
Contributor

@bors rollup=never

@bors
Copy link
Contributor

bors commented Feb 15, 2022

⌛ Testing commit c37a906 with merge 0c3f0cd...

@bors
Copy link
Contributor

bors commented Feb 15, 2022

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing 0c3f0cd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 15, 2022
@bors bors merged commit 0c3f0cd into rust-lang:master Feb 15, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 15, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0c3f0cd): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Internal Compiler Error] occurred when compiling eww with latest nightly build (2022-01-21)
7 participants