about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-04-13 23:57:39 -0400
committerGitHub <noreply@github.com>2025-04-13 23:57:39 -0400
commitc0ad72ef6ac8d78e777765967be1f7b07d7fb663 (patch)
treea8e3af43ce0ded43091e4c9eb737d6bf4a27734f /compiler/rustc_mir_transform/src
parent6fe69858f037025b7e722d97ab50c67e81dd5143 (diff)
parentbc94c38d98b327e6a616e1b74da0143a474a3b1a (diff)
downloadrust-c0ad72ef6ac8d78e777765967be1f7b07d7fb663.tar.gz
rust-c0ad72ef6ac8d78e777765967be1f7b07d7fb663.zip
Rollup merge of #139699 - compiler-errors:coroutine-drop-phase, r=scottmcm
Proactively update coroutine drop shim's phase to account for later passes applied during shim query

See comments in the pass and on test. Also see https://github.com/rust-lang/rust/pull/137264#issuecomment-2669706718.

Fixes https://github.com/rust-lang/rust/issues/137243
Fixes https://github.com/rust-lang/rust/issues/139698

r? scottmcm
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/coroutine.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs
index 80c729d66b1..4405bd82410 100644
--- a/compiler/rustc_mir_transform/src/coroutine.rs
+++ b/compiler/rustc_mir_transform/src/coroutine.rs
@@ -1169,6 +1169,13 @@ fn create_coroutine_drop_shim<'tcx>(
     dump_mir(tcx, false, "coroutine_drop", &0, &body, |_, _| Ok(()));
     body.source.instance = drop_instance;
 
+    // Creating a coroutine drop shim happens on `Analysis(PostCleanup) -> Runtime(Initial)`
+    // but the pass manager doesn't update the phase of the coroutine drop shim. Update the
+    // phase of the drop shim so that later on when we run the pass manager on the shim, in
+    // the `mir_shims` query, we don't ICE on the intra-pass validation before we've updated
+    // the phase of the body from analysis.
+    body.phase = MirPhase::Runtime(RuntimePhase::Initial);
+
     body
 }