Skip to content

ICE: broken MIR in FutureDropPollShim #141409

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

// compile-flags -Zmir-enable-passes=+Inline  -Zvalidate-mir  --edition=2021 -Zlint-mir
#![feature(async_drop)]
use std::mem::ManuallyDrop;
use std::{
    future::{async_drop_in_place, Future},
    pin::{pin, Pin},
    sync::{mpsc, Arc},
    task::{Context, Poll, Wake, Waker},
};
fn main() {
    block_on(bar(0))
}
async fn baz(ident_base: usize) {}
async fn bar(ident_base: usize) {
    baz(1).await
}
fn block_on<F>(fut_unpin: F) -> F::Output
where
    F: Future,
{
    let fut_pin = pin!(ManuallyDrop::new(fut_unpin));
    let mut fut = unsafe { Pin::map_unchecked_mut(fut_pin, |x| &mut **x) };
    let (waker, rx) = simple_waker();
    let mut context = Context::from_waker(&waker);
    let rv = loop {
        match fut.as_mut().poll(&mut context) {
            Poll::Ready(out) => break out,
            PollPending => (),
        }
    };
    let drop_fut_unpin = unsafe { async_drop_in_place(fut.get_unchecked_mut()) };
    let drop_fut = pin!(drop_fut_unpin);
    loop {
        match drop_fut.poll(&mut context) {
            Poll => break,
        }
    }
    rv
}
fn simple_waker() -> (Waker, mpsc::Receiver<()>) {
    struct SimpleWaker {
        tx: mpsc::Sender<()>,
    }
    impl Wake for SimpleWaker {
        fn wake(self: Arc<Self>) {}
    }
    let (tx, rx) = mpsc::channel();
    (Waker::from(Arc::new(SimpleWaker { tx })), rx)
}

Meta

rustc --version --verbose:

binary: rustc
commit-hash: 1d679446b01e65f9bc9ae609d0ae1e4a9c0ccaa3
commit-date: 2025-05-22
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Error output

<output>
Backtrace

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb21[0]:
                                StorageLive(_55) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb4[2]:
                                local _46 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb4[2]:
                                local _50 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb4[2]:
                                local _55 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb17[0]:
                                StorageLive(_50) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass AbortUnwindingCalls) at bb14[3]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass StateTransform) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass StateTransform) at bb14[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass KnownPanicsLint) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass KnownPanicsLint) at bb14[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after phase change to runtime) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after phase change to runtime) at bb14[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass LowerIntrinsics) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass LowerIntrinsics) at bb14[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass RemovePlaceMention) at bb29[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass RemovePlaceMention) at bb14[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass SimplifyCfg-pre-optimizations) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass SimplifyCfg-pre-optimizations) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after phase change to runtime-post-cleanup) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after phase change to runtime-post-cleanup) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass CheckAlignment) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass CheckAlignment) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass CheckNull) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass CheckNull) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass LowerSliceLenCalls) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass LowerSliceLenCalls) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass InstSimplify-before-inline) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass InstSimplify-before-inline) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass ForceInline) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass ForceInline) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass Inline) at bb22[0]:
                                StorageLive(_46) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in Item(DefId(0:25 ~ code[fc91]::bar::{closure#0})) (after pass Inline) at bb18[4]:
                                local _46 still has storage when returning from function
  --> code.rs:15:2
   |
15 | }
   |  ^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:15:2
   |
15 | }
   |  ^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass MentionedItems) at bb21[0]:
                                StorageLive(_55) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass MentionedItems) at bb4[2]:
                                local _46 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass MentionedItems) at bb4[2]:
                                local _50 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass MentionedItems) at bb4[2]:
                                local _55 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass MentionedItems) at bb17[0]:
                                StorageLive(_50) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass AbortUnwindingCalls) at bb21[0]:
                                StorageLive(_55) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass AbortUnwindingCalls) at bb4[2]:
                                local _46 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |


<snip>

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass LowerSliceLenCalls) at bb4[2]:
                                local _55 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass LowerSliceLenCalls) at bb17[0]:
                                StorageLive(_50) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass InstSimplify-before-inline) at bb21[0]:
                                StorageLive(_55) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass InstSimplify-before-inline) at bb4[2]:
                                local _46 still has storage when returning from function
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:115:34 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

<snip>
error: internal compiler error: broken MIR in FutureDropPollShim(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]), (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15374 ~ core[5e16]::future::async_drop::async_drop_in_place::{closure#0}), [Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])]), (*mut Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)]),)]), Coroutine(DefId(0:25 ~ code[fc91]::bar::{closure#0}), [(), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:25 ~ code[fc91]::bar::{closure#0}), []), (usize,)])) (after pass Inline) at bb8[0]:
                                StorageLive(_50) which already has storage here
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^
   |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:96:26 - disabled backtrace
  --> code.rs:13:33
   |
13 |   async fn bar(ident_base: usize) {
   |  _________________________________^
14 | |     baz(1).await
15 | | }
   | |_^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im4/rustc-ice-2025-05-22T21_31_35-1805372.txt` to your bug report

note: compiler flags: -Z mir-enable-passes=+Inline -Z validate-mir -Z lint-mir

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zvalidate-mirUnstable option: MIR validationA-mir-opt-inliningArea: MIR inliningC-bugCategory: This is a bug.F-async_drop`#![feature(async_drop)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions