Skip to content

Fix unwind drop glue for if-then scopes#102394

Merged
bors merged 4 commits into
rust-lang:masterfrom
dingxiangfei2009:issue-102317
Oct 5, 2022
Merged

Fix unwind drop glue for if-then scopes#102394
bors merged 4 commits into
rust-lang:masterfrom
dingxiangfei2009:issue-102317

Conversation

@dingxiangfei2009

@dingxiangfei2009 dingxiangfei2009 commented Sep 28, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

est31 commented Sep 28, 2022

Copy link
Copy Markdown
Member

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

rustbot commented Sep 28, 2022

Copy link
Copy Markdown
Collaborator

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.

@emilyalbini emilyalbini added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 28, 2022
@emilyalbini

Copy link
Copy Markdown
Member

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

@apiraino

Copy link
Copy Markdown
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
Comment thread compiler/rustc_mir_build/src/build/scope.rs Outdated
Comment thread src/test/ui/let-else/issue-102317.rs Outdated
dingxiangfei2009 and others added 2 commits September 30, 2022 21:03
Co-authored-by: SafariMonkey <charlton.rodda@gmail.com>
@dingxiangfei2009 dingxiangfei2009 requested review from SafariMonkey and tmandry and removed request for tmandry September 30, 2022 13:38

@SafariMonkey SafariMonkey left a comment

Copy link
Copy Markdown
Contributor

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

est31 commented Sep 30, 2022

Copy link
Copy Markdown
Member

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

est31 commented Oct 4, 2022

Copy link
Copy Markdown
Member

@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
Copy Markdown
Contributor Author

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned jackh726 Oct 5, 2022
cached_drop
}

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

Copy link
Copy Markdown
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

oli-obk commented Oct 5, 2022

Copy link
Copy Markdown
Contributor

r=me with some code deduplication

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
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

bors commented Oct 5, 2022

Copy link
Copy Markdown
Collaborator

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

@bors

bors commented Oct 5, 2022

Copy link
Copy Markdown
Collaborator

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

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued bf8d3a261764632b6a568ff423d2f29942be0e50 with parent 8c71b67, future comparison URL.

@rust-timer

Copy link
Copy Markdown
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

oli-obk commented Oct 5, 2022

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Oct 5, 2022

Copy link
Copy Markdown
Collaborator

📌 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

bors commented Oct 5, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 565c35a with merge c97d02c...

@bors

bors commented Oct 5, 2022

Copy link
Copy Markdown
Collaborator

☀️ 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
Comment thread compiler/rustc_mir_build/src/build/block.rs
@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
Copy Markdown
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

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

Development

Successfully merging this pull request may close these issues.

ICE: Broken MIR in Item(...) with let_else usage (use of local which has no storage here) ICE when returning value bound by if let ... && let ...