about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-04-12 04:54:14 +0000
committerMichael Goulet <michael@errs.io>2025-04-12 20:54:08 +0000
commitbc94c38d98b327e6a616e1b74da0143a474a3b1a (patch)
tree933091061f4fdcc04ce3f2ec89bc64f65a2ae8b3 /compiler/rustc_mir_transform/src
parent9ffde4b089fe8e43d5891eb517001df27a8443ff (diff)
downloadrust-bc94c38d98b327e6a616e1b74da0143a474a3b1a.tar.gz
rust-bc94c38d98b327e6a616e1b74da0143a474a3b1a.zip
Proactively update coroutine drop shim's phase to account for later passes applied during shim query
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 04d96f11707..02609d65b0f 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
 }