//@compile-flags: -Zvalidate-mir --edition=2018 -Zinline-mir=yes
use core::future::{async_drop_in_place, Future};
use core::mem::{self};
use core::pin::pin;
use core::task::{Context, Waker};
async fn test_async_drop<T>(x: T) {
let mut x = mem::MaybeUninit::new(x);
pin!(unsafe { async_drop_in_place(x.as_mut_ptr()) });
}
fn main() {
let waker = Waker::noop();
let mut cx = Context::from_waker(&waker);
let fut = pin!(async {
test_async_drop(test_async_drop(0)).await;
});
fut.poll(&mut cx);
}
original:
use core::mem::{self};
use core::pin::{pin};
use core::task::{Context, Waker};
use core::future::{async_drop_in_place, Future};
async fn test_async_drop<T>(x: T) {
let mut x = mem::MaybeUninit::new(x);
pin!(unsafe { async_drop_in_place(x.as_mut_ptr()) });
}
fn main() {
let waker = Waker::noop();
let mut cx = Context::from_waker(&waker);
let fut = pin!(async {
test_async_drop(test_async_drop(0)).await;
});
fut.poll(&mut cx);
}
auto-reduced (treereduce-rust):
original:
Version information
Possibly related line of code: https://github.com/rust-lang/rust/blob/8aca4bab080b2c81065645fc070acca7a060f8a3/compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs#L176-L188
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zvalidate-mir --edition=2018 -Zinline-mir=yes
Program output
``` error[E0658]: use of unstable library feature 'async_drop' --> /tmp/icemaker_global_tempdir.DLGUrsC6bQJS/rustc_testrunner_tmpdir_reporting.XPxMHGh28ax0/mvce.rs:1:20 | 1 | use core::future::{async_drop_in_place, Future}; | ^^^^^^^^^^^^^^^^^^^ | = note: see issue #126482 for more information
= help: add `#![feature(async_drop)]` to the crate attributes to enable
= note: this compiler was built on 2024-10-24; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'async_drop'
--> /tmp/icemaker_global_tempdir.DLGUrsC6bQJS/rustc_testrunner_tmpdir_reporting.XPxMHGh28ax0/mvce.rs:8:19
|
8 | pin!(unsafe { async_drop_in_place(x.as_mut_ptr()) });
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #126482 for more information
= help: add `#![feature(async_drop)]` to the crate attributes to enable
= note: this compiler was built on 2024-10-24; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature 'noop_waker'
--> /tmp/icemaker_global_tempdir.DLGUrsC6bQJS/rustc_testrunner_tmpdir_reporting.XPxMHGh28ax0/mvce.rs:12:17
|
12 | let waker = Waker::noop();
| ^^^^^^^^^^^
|
= note: see issue #98286 for more information
= help: add `#![feature(noop_waker)]` to the crate attributes to enable
= note: this compiler was built on 2024-10-24; consider upgrading it if it is out of date
error: internal compiler error: compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs:182:17: Building async destructor constructor shim is not yet implemented for type: Coroutine(DefId(0:15 ~ mvce[b792]::test_async_drop::{closure#0}), [i32, (), std::future::ResumeTy, (), (), CoroutineWitness(DefId(0:15 ~ mvce[b792]::test_async_drop::{closure#0}), [i32]), (i32,)])
thread 'rustc' panicked at compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs:182:17:
Box
stack backtrace:
0: 0x70ab7668515a - ::fmt::h67a760f142b10089
1: 0x70ab76e041ca - core::fmt::write::h761a6181051e2338
2: 0x70ab780aaf11 - std::io::Write::write_fmt::h51dcb9980640e286
3: 0x70ab76684fb2 - std::sys::backtrace::BacktraceLock::print::h699259bafadc78e2
4: 0x70ab76687496 - std::panicking::default_hook::{{closure}}::h26f90f180373fe14
5: 0x70ab766872e0 - std::panicking::default_hook::hc56aa4946c4cfd81
6: 0x70ab75711a5f - std[154c2b8f5633419d]::panicking::update_hook::>::{closure#0}
7: 0x70ab76687ba8 - std::panicking::rust_panic_with_hook::hc7e3b32b38224be2
8: 0x70ab7574b7c1 - std[154c2b8f5633419d]::panicking::begin_panic::::{closure#0}
9: 0x70ab7573e766 - std[154c2b8f5633419d]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
10: 0x70ab75739d69 - std[154c2b8f5633419d]::panicking::begin_panic::
11: 0x70ab75755331 - ::emit_producing_guarantee
12: 0x70ab75dc1ae4 - rustc_middle[7ecdc0b6d8402894]::util::bug::opt_span_bug_fmt::::{closure#0}
13: 0x70ab75da7f8a - rustc_middle[7ecdc0b6d8402894]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
14: 0x70ab75da7e1b - rustc_middle[7ecdc0b6d8402894]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
15: 0x70ab73d738c0 - rustc_middle[7ecdc0b6d8402894]::util::bug::bug_fmt
16: 0x70ab77834bd5 - rustc_mir_transform[757de5d5b0d4bfad]::shim::make_shim
17: 0x70ab778317af - rustc_query_impl[5d234f7b7f31cffe]::plumbing::__rust_begin_short_backtrace::>
18: 0x70ab7783176f - >::call_once
19: 0x70ab7722dc74 - rustc_query_system[f9c49b141f9e0de3]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5d234f7b7f31cffe]::plumbing::QueryCtxt, false>
20: 0x70ab7722d9cb - rustc_query_impl[5d234f7b7f31cffe]::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
21: 0x70ab740dfb45 - ::instance_mir
22: 0x70ab7781295c - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_inliner_callees
23: 0x70ab77812828 - rustc_query_impl[5d234f7b7f31cffe]::plumbing::__rust_begin_short_backtrace::>
24: 0x70ab778127e7 - >::call_once
25: 0x70ab7722ceb4 - rustc_query_system[f9c49b141f9e0de3]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5d234f7b7f31cffe]::plumbing::QueryCtxt, false>
26: 0x70ab7722cbff - rustc_query_impl[5d234f7b7f31cffe]::query_impl::mir_inliner_callees::get_query_non_incr::__rust_end_short_backtrace
27: 0x70ab77c7ae93 - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_callgraph_reachable::process
28: 0x70ab77c7886a - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_callgraph_reachable::process
29: 0x70ab77c7886a - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_callgraph_reachable::process
30: 0x70ab77c7886a - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_callgraph_reachable::process
31: 0x70ab77c76788 - rustc_mir_transform[757de5d5b0d4bfad]::inline::cycle::mir_callgraph_reachable
32: 0x70ab77c76629 - rustc_query_impl[5d234f7b7f31cffe]::plumbing::__rust_begin_short_backtrace::>
33: 0x70ab77c765eb - >::call_once
34: 0x70ab77c75fa6 - rustc_query_system[f9c49b141f9e0de3]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5d234f7b7f31cffe]::plumbing::QueryCtxt, false>
35: 0x70ab77c75cf4 - rustc_query_impl[5d234f7b7f31cffe]::query_impl::mir_callgraph_reachable::get_query_non_incr::__rust_end_short_backtrace
36: 0x70ab777ee11d - ::try_inlining
37: 0x70ab7780a42b - ::process_blocks
38: 0x70ab77809937 - ::run_pass
39: 0x70ab76e0c1cd - rustc_mir_transform[757de5d5b0d4bfad]::pass_manager::run_passes_inner
40: 0x70ab7780fdae - rustc_mir_transform[757de5d5b0d4bfad]::optimized_mir
41: 0x70ab7780e65b - rustc_query_impl[5d234f7b7f31cffe]::plumbing::__rust_begin_short_backtrace::>
42: 0x70ab76e271ee - rustc_query_system[f9c49b141f9e0de3]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5d234f7b7f31cffe]::plumbing::QueryCtxt, false>
43: 0x70ab76e26773 - rustc_query_impl[5d234f7b7f31cffe]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
44: 0x70ab740dfbdf - ::instance_mir
45: 0x70ab7723328e - rustc_interface[8a226d11e1d62432]::passes::run_required_analyses
46: 0x70ab77989a9e - rustc_interface[8a226d11e1d62432]::passes::analysis
47: 0x70ab77989a71 - rustc_query_impl[5d234f7b7f31cffe]::plumbing::__rust_begin_short_backtrace::>
48: 0x70ab77d2cbae - rustc_query_system[f9c49b141f9e0de3]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[5d234f7b7f31cffe]::plumbing::QueryCtxt, false>
49: 0x70ab77d2c88f - rustc_query_impl[5d234f7b7f31cffe]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
50: 0x70ab77bd1eac - rustc_interface[8a226d11e1d62432]::interface::run_compiler::, rustc_driver_impl[1713c7a502794333]::run_compiler::{closure#0}>::{closure#1}
51: 0x70ab77c47cd4 - std[154c2b8f5633419d]::sys::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[1713c7a502794333]::run_compiler::{closure#0}>::{closure#1}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>::{closure#0}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>
52: 0x70ab77c480e8 - <::spawn_unchecked_, rustc_driver_impl[1713c7a502794333]::run_compiler::{closure#0}>::{closure#1}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>::{closure#0}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f763a1f5684efb66]::result::Result<(), rustc_span[9923c3b3311dc018]::ErrorGuaranteed>>::{closure#1} as core[f763a1f5684efb66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
53: 0x70ab77c48bab - std::sys::pal::unix::thread::Thread::new::thread_start::hef945dd3992d59fc
54: 0x70ab71ea339d -
55: 0x70ab71f2849c -
56: 0x0 -
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: rustc 1.84.0-nightly (8aca4bab0 2024-10-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z validate-mir -Z inline-mir=yes -Z dump-mir-dir=dir
query stack during panic:
#0 [mir_shims] generating MIR shim for `core::future::async_drop::async_drop_in_place_raw`
#1 [mir_inliner_callees] computing all local function calls in `core::future::async_drop::async_drop_in_place_raw`
end of query stack
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.
```