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
This commit is contained in:
Jacob Pratt 2025-04-13 23:57:39 -04:00 committed by GitHub
commit c0ad72ef6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,19 @@
//@ compile-flags: -Zvalidate-mir
//@ edition: 2024
//@ build-pass
// Regression test that we don't ICE when encountering a transmute in a coroutine's
// drop shim body, which is conceptually in the Runtime phase but wasn't having the
// phase updated b/c the pass manager neither optimizes nor updates the phase for
// drop shim bodies.
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}
fn main() {
async {
vec![async { HasDrop }.await];
};
}