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

[drop tracking] Visit break expressions #106699

Merged
merged 2 commits into from
Jan 20, 2023

Conversation

eholk
Copy link
Contributor

@eholk eholk commented Jan 11, 2023

This fixes #102383 by remembering to visit the expression in break expr when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be
looking for dropped values at the wrong point in the code.

Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere.

Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.

@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2023

r? @wesleywiser

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2023
Copy link
Member

@albertlarsan68 albertlarsan68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests have moved from src/test to tests, please rebase on top of new master.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2023
This fixes rust-lang#102383 by remembering to visit the expression in
`break expr` when building the drop tracking CFG. Missing this step was
causing an off-by-one error which meant after a number of awaits we'd be
looking for dropped values at the wrong point in the code.

Additionally, this changes the order of traversal for assignment
expressions to visit the rhs and then the lhs. This matches what is done
elsewhere.
@eholk
Copy link
Contributor Author

eholk commented Jan 12, 2023

Tests have moved from src/test to tests, please rebase on top of new master. @rustbot author

Nice to see that change happen! I updated this PR.

@wesleywiser
Copy link
Member

Thanks @eholk; this looks good to me!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 19, 2023

📌 Commit d32f3fe has been approved by wesleywiser

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 19, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 20, 2023
…r=wesleywiser

[drop tracking] Visit break expressions

This fixes rust-lang#102383 by remembering to visit the expression in `break expr` when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be
looking for dropped values at the wrong point in the code.

Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere.

Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#106699 ([drop tracking] Visit break expressions )
 - rust-lang#106738 (Fix known-bug annotations)
 - rust-lang#106891 (Tweak "borrow closure argument" suggestion)
 - rust-lang#106928 (add raw identifier for keyword in suggestion)
 - rust-lang#107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic)
 - rust-lang#107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3d79cbc into rust-lang:master Jan 20, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Drop tracking ICE involving await in left hand side of assignment (-Zdrop-tracking)
6 participants