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

Fix unwind drop glue for if-then scopes #102394

Merged
merged 4 commits into from
Oct 5, 2022

Conversation

dingxiangfei2009
Copy link
Contributor

@dingxiangfei2009 dingxiangfei2009 commented Sep 28, 2022

cc @est31

Fix #102317
Fix #99852

This PR fixes the drop glue for unwinding from a panic originated in a drop while breaking out for the else block in an if-then scope.
MIR validation does not fail for the synchronous versions of the test program, because StorageDead statements are skipped over in the unwinding process. It is only becoming a problem when it is inside a generator where StorageDead must be kept around.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 28, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2022
@est31
Copy link
Member

est31 commented Sep 28, 2022

Thanks @dingxiangfei2009 for the fast fix! It's indeed the same issue as @Nilstrieb said.

Beta-nominating as it fixes an ICE in a feature stabilized on beta: #102317

@rustbot label beta-nominated

@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2022

Error: Label beta-nominated can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@pietroalbini pietroalbini added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 28, 2022
@pietroalbini
Copy link
Member

@est31 asked for this to be beta-nominated on Zulip.

@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Sep 29, 2022
@dingxiangfei2009 dingxiangfei2009 requested review from tmandry and SafariMonkey and removed request for tmandry September 30, 2022 13:38
Copy link
Contributor

@SafariMonkey SafariMonkey left a comment

Choose a reason for hiding this comment

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

Thanks for accepting my suggestion! I see you requested re-review from me. This was a drive-by suggestion, and I don't feel qualified to give a general review, so I think someone else should do that.

@est31
Copy link
Member

est31 commented Sep 30, 2022

Yeah Rust doesn't really use the github builtin review system. Instead it uses bors. Already now bors has assigned a reviewer to this PR.

@est31
Copy link
Member

est31 commented Oct 4, 2022

@dingxiangfei2009 maybe it would be a good idea to r? @oli-obk on this as they have approved your previous PRs, and jackh726 has stated that it's not their area of expertise?

@dingxiangfei2009
Copy link
Contributor Author

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned jackh726 Oct 5, 2022
@@ -1021,6 +1023,38 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
cached_drop
}

/// This is similar to [diverge_cleanup] except its target is set to
Copy link
Contributor

Choose a reason for hiding this comment

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

Afaict diverge_cleanup could now call this function and pass self.scopes.topmost() as the target_scope argument.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2022

r=me with some code deduplication

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 5, 2022
@bors
Copy link
Contributor

bors commented Oct 5, 2022

⌛ Trying commit 5131e9d with merge 7d853fa063b4f1beb56ab3cb4e2fc8719efee861...

@bors
Copy link
Contributor

bors commented Oct 5, 2022

⌛ Trying commit 565c35a with merge bf8d3a261764632b6a568ff423d2f29942be0e50...

@bors
Copy link
Contributor

bors commented Oct 5, 2022

☀️ Try build successful - checks-actions
Build commit: bf8d3a261764632b6a568ff423d2f29942be0e50 (bf8d3a261764632b6a568ff423d2f29942be0e50)

@rust-timer
Copy link
Collaborator

Queued bf8d3a261764632b6a568ff423d2f29942be0e50 with parent 8c71b67, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bf8d3a261764632b6a568ff423d2f29942be0e50): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.7% [2.2%, 4.6%] 3
Improvements ✅
(primary)
-4.1% [-4.1%, -4.1%] 1
Improvements ✅
(secondary)
-2.3% [-4.3%, -1.2%] 4
All ❌✅ (primary) -4.1% [-4.1%, -4.1%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 5, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Oct 5, 2022

📌 Commit 565c35a has been approved by oli-obk

It is now in the queue for this repository.

@bors bors removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 5, 2022
@bors
Copy link
Contributor

bors commented Oct 5, 2022

⌛ Testing commit 565c35a with merge c97d02c...

@bors
Copy link
Contributor

bors commented Oct 5, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing c97d02c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 5, 2022
@bors bors merged commit c97d02c into rust-lang:master Oct 5, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 5, 2022
@cuviper cuviper mentioned this pull request Oct 6, 2022
@cuviper cuviper modified the milestones: 1.66.0, 1.65.0 Oct 6, 2022
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 6, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c97d02c): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
7.0% [7.0%, 7.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.3%, -2.0%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@dingxiangfei2009 dingxiangfei2009 deleted the issue-102317 branch October 6, 2022 09:44
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2022
[beta] backports

* Avoid duplicating StorageLive in let-else rust-lang#101894
* Re-add HRTB implied static bug note rust-lang#101924
* Revert "Copy stage0 binaries into stage0-sysroot" rust-lang#101942
* implied_bounds: deal with inference vars rust-lang#102016
* fix ConstProp handling of written_only_inside_own_block_locals rust-lang#102045
* Fix wrongly refactored Lift impl rust-lang#102088
* Fix a typo “pararmeter” in error message rust-lang#102119
* Deny associated type bindings within associated type bindings rust-lang#102338
* Continue migration of CSS themes rust-lang#101934
* Fix search result colors rust-lang#102369
* Fix unwind drop glue for if-then scopes rust-lang#102394
* Revert "Use getentropy when possible on all Apple platforms" rust-lang#102693
* Fix associated type bindings with anon const in GAT position rust-lang#102336
* Revert perf-regression 101620 rust-lang#102064
* `EscapeAscii` is not an `ExactSizeIterator` rust-lang#99880
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…-obk

Fix unwind drop glue for if-then scopes

cc `@est31`

Fix rust-lang#102317
Fix rust-lang#99852

This PR fixes the drop glue for unwinding from a panic originated in a drop while breaking out for the else block in an `if-then` scope.
MIR validation does not fail for the synchronous versions of the test program, because `StorageDead` statements are skipped over in the unwinding process. It is only becoming a problem when it is inside a generator where `StorageDead` must be kept around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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