Open
Description
auto-reduced (treereduce-rust):
//@compile-flags: --edition=2024
#![feature(async_drop)]
async fn move_part_await_return_rest_tuple() -> Vec<usize> {
let x = (vec![3], vec![4, 4]);
drop(x.1);
x.0
}
original:
// build-pass
// edition:2018
// compi-type lib
async fn move_part_await_return_rest_tuple() -> Vec<usize> {
let x = (vec![3], vec![4, 4]);
drop(x.1);
echo(x.0[0]).await;
x.0
}
async fn echo(x: usize) -> usize { x }
Version information
rustc 1.88.0-nightly (25cdf1f67 2025-04-28)
binary: rustc
commit-hash: 25cdf1f67463c9365d8d83778c933ec7480e940b
commit-date: 2025-04-28
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Possibly related line of code:
rust/compiler/rustc_mir_transform/src/elaborate_drop.rs
Lines 373 to 385 in 25cdf1f
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024 -Zcrate-attr=feature(async_drop)
Program output
warning: the feature `async_drop` is incomplete and may not be safe to use and/or cause compiler crashes
--> <crate attribute>:1:12
|
1 | #![feature(async_drop)]
| ^^^^^^^^^^
|
= note: see issue #126482 <https://github.com/rust-lang/rust/issues/126482> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.A6wq5SB06dUH/rustc_testrunner_tmpdir_reporting.80dUjaTeqxl9/mvce.rs:6:2
|
6 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.A6wq5SB06dUH/rustc_testrunner_tmpdir_reporting.80dUjaTeqxl9/mvce.rs`
thread 'rustc' panicked at compiler/rustc_mir_transform/src/elaborate_drop.rs:379:39:
index out of bounds: the len is 35 but the index is 45
stack backtrace:
0: 0x7d7cd7109413 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd74fdb4a7f001d5e
1: 0x7d7cd78059c7 - core::fmt::write::h39cdbee3ed36675d
2: 0x7d7cd8c45111 - std::io::Write::write_fmt::h3d221ff56818d1dd
3: 0x7d7cd7109272 - std::sys::backtrace::BacktraceLock::print::he77ca3c0db1e98a1
4: 0x7d7cd710d0ba - std::panicking::default_hook::{{closure}}::h239a47c5c2a6a6da
5: 0x7d7cd710cc3f - std::panicking::default_hook::h2c7c14ab2f340054
6: 0x7d7cd6185883 - std[96024a80e4ce12a0]::panicking::update_hook::<alloc[703cfcb04acfdfda]::boxed::Box<rustc_driver_impl[a2bbb3d7e654019c]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7d7cd710d933 - std::panicking::rust_panic_with_hook::h7afddb00f409503c
8: 0x7d7cd710d62a - std::panicking::begin_panic_handler::{{closure}}::h11311e14e26011d8
9: 0x7d7cd71098d9 - std::sys::backtrace::__rust_end_short_backtrace::h4a69b8a8bf83181b
10: 0x7d7cd710d2ed - __rustc[ae73a5f87904751]::rust_begin_unwind
11: 0x7d7cd3a8d0d0 - core::panicking::panic_fmt::he7bfe01c5f8a6b92
12: 0x7d7cd55d8005 - core::panicking::panic_bounds_check::h60b2f61c06b46463
13: 0x7d7cd7c099c9 - <rustc_mir_transform[a7f95fd82d5de946]::elaborate_drop::DropCtxt<rustc_mir_transform[a7f95fd82d5de946]::elaborate_drops::ElaborateDropsCtxt>>::elaborate_drop
14: 0x7d7cd7c03f08 - <rustc_mir_transform[a7f95fd82d5de946]::elaborate_drop::DropCtxt<rustc_mir_transform[a7f95fd82d5de946]::elaborate_drops::ElaborateDropsCtxt>>::drop_ladder
15: 0x7d7cd832c35c - <rustc_mir_transform[a7f95fd82d5de946]::elaborate_drop::DropCtxt<rustc_mir_transform[a7f95fd82d5de946]::elaborate_drops::ElaborateDropsCtxt>>::open_drop_for_tuple
16: 0x7d7cd7c06abe - <rustc_mir_transform[a7f95fd82d5de946]::elaborate_drop::DropCtxt<rustc_mir_transform[a7f95fd82d5de946]::elaborate_drops::ElaborateDropsCtxt>>::elaborate_drop
17: 0x7d7cd4250cbb - <rustc_mir_transform[a7f95fd82d5de946]::elaborate_drops::ElaborateDrops as rustc_mir_transform[a7f95fd82d5de946]::pass_manager::MirPass>::run_pass
18: 0x7d7cd780bea7 - rustc_mir_transform[a7f95fd82d5de946]::run_analysis_to_runtime_passes
19: 0x7d7cd7d232a5 - rustc_mir_transform[a7f95fd82d5de946]::mir_drops_elaborated_and_const_checked
20: 0x7d7cd7d22c75 - rustc_query_impl[b776171e91563e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b776171e91563e8b]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>>
21: 0x7d7cd7a2402c - rustc_query_system[aa926e5a14f6203b]::query::plumbing::try_execute_query::<rustc_query_impl[b776171e91563e8b]::DynamicConfig<rustc_data_structures[9557117c3f8f3a0]::vec_cache::VecCache<rustc_span[bce202135c071ebd]::def_id::LocalDefId, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[aa926e5a14f6203b]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b776171e91563e8b]::plumbing::QueryCtxt, false>
22: 0x7d7cd7a2390b - rustc_query_impl[b776171e91563e8b]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
23: 0x7d7cd81e0595 - rustc_mir_transform[a7f95fd82d5de946]::optimized_mir
24: 0x7d7cd81dff1f - rustc_query_impl[b776171e91563e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b776171e91563e8b]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>>
25: 0x7d7cd7b8efef - rustc_query_system[aa926e5a14f6203b]::query::plumbing::try_execute_query::<rustc_query_impl[b776171e91563e8b]::DynamicConfig<rustc_query_system[aa926e5a14f6203b]::query::caches::DefIdCache<rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b776171e91563e8b]::plumbing::QueryCtxt, false>
26: 0x7d7cd7b8e41d - rustc_query_impl[b776171e91563e8b]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
27: 0x7d7cd6800260 - <rustc_middle[41c039613f3f9b63]::ty::context::TyCtxt>::coroutine_layout
28: 0x7d7cd7f4bf0b - rustc_ty_utils[ed0597263d4f78c7]::layout::layout_of
29: 0x7d7cd7f3fb2a - rustc_query_impl[b776171e91563e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b776171e91563e8b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 16usize]>>
30: 0x7d7cd7f3e91f - rustc_query_system[aa926e5a14f6203b]::query::plumbing::try_execute_query::<rustc_query_impl[b776171e91563e8b]::DynamicConfig<rustc_query_system[aa926e5a14f6203b]::query::caches::DefaultCache<rustc_middle[41c039613f3f9b63]::ty::PseudoCanonicalInput<rustc_middle[41c039613f3f9b63]::ty::Ty>, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[b776171e91563e8b]::plumbing::QueryCtxt, false>
31: 0x7d7cd7f3e55e - rustc_query_impl[b776171e91563e8b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
32: 0x7d7cd86718f2 - <rustc_mir_transform[a7f95fd82d5de946]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[a7f95fd82d5de946]::pass_manager::MirLint>::run_lint
33: 0x7d7cd780bea7 - rustc_mir_transform[a7f95fd82d5de946]::run_analysis_to_runtime_passes
34: 0x7d7cd7d232a5 - rustc_mir_transform[a7f95fd82d5de946]::mir_drops_elaborated_and_const_checked
35: 0x7d7cd7d22c75 - rustc_query_impl[b776171e91563e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b776171e91563e8b]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>>
36: 0x7d7cd7a2402c - rustc_query_system[aa926e5a14f6203b]::query::plumbing::try_execute_query::<rustc_query_impl[b776171e91563e8b]::DynamicConfig<rustc_data_structures[9557117c3f8f3a0]::vec_cache::VecCache<rustc_span[bce202135c071ebd]::def_id::LocalDefId, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[aa926e5a14f6203b]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b776171e91563e8b]::plumbing::QueryCtxt, false>
37: 0x7d7cd7a2390b - rustc_query_impl[b776171e91563e8b]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
38: 0x7d7cd8206c58 - rustc_interface[269edf8a537b00a5]::passes::run_required_analyses
39: 0x7d7cd86a915e - rustc_interface[269edf8a537b00a5]::passes::analysis
40: 0x7d7cd86a9133 - rustc_query_impl[b776171e91563e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b776171e91563e8b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 0usize]>>
41: 0x7d7cd86aec3d - rustc_query_system[aa926e5a14f6203b]::query::plumbing::try_execute_query::<rustc_query_impl[b776171e91563e8b]::DynamicConfig<rustc_query_system[aa926e5a14f6203b]::query::caches::SingleCache<rustc_middle[41c039613f3f9b63]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b776171e91563e8b]::plumbing::QueryCtxt, false>
42: 0x7d7cd86ae938 - rustc_query_impl[b776171e91563e8b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
43: 0x7d7cd878f3be - rustc_interface[269edf8a537b00a5]::passes::create_and_enter_global_ctxt::<core[6d7144d1d4266374]::option::Option<rustc_interface[269edf8a537b00a5]::queries::Linker>, rustc_driver_impl[a2bbb3d7e654019c]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
44: 0x7d7cd88eceb9 - rustc_interface[269edf8a537b00a5]::interface::run_compiler::<(), rustc_driver_impl[a2bbb3d7e654019c]::run_compiler::{closure#0}>::{closure#1}
45: 0x7d7cd8701728 - std[96024a80e4ce12a0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[269edf8a537b00a5]::util::run_in_thread_with_globals<rustc_interface[269edf8a537b00a5]::util::run_in_thread_pool_with_globals<rustc_interface[269edf8a537b00a5]::interface::run_compiler<(), rustc_driver_impl[a2bbb3d7e654019c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
46: 0x7d7cd8701b74 - <<std[96024a80e4ce12a0]::thread::Builder>::spawn_unchecked_<rustc_interface[269edf8a537b00a5]::util::run_in_thread_with_globals<rustc_interface[269edf8a537b00a5]::util::run_in_thread_pool_with_globals<rustc_interface[269edf8a537b00a5]::interface::run_compiler<(), rustc_driver_impl[a2bbb3d7e654019c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6d7144d1d4266374]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
47: 0x7d7cd8702f77 - std::sys::pal::unix::thread::Thread::new::thread_start::h7eeb46109c9d7745
48: 0x7d7cd26a370a - <unknown>
49: 0x7d7cd2727aac - <unknown>
50: 0x0 - <unknown>
error: the compiler unexpectedly panicked. this is a bug.
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.88.0-nightly (25cdf1f67 2025-04-28) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(async_drop) -Z dump-mir-dir=dir
query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `move_part_await_return_rest_tuple::{closure#0}`
#1 [optimized_mir] optimizing MIR for `move_part_await_return_rest_tuple::{closure#0}`
#2 [layout_of] computing layout of `{async fn body of move_part_await_return_rest_tuple()}`
#3 [mir_drops_elaborated_and_const_checked] elaborating drops for `move_part_await_return_rest_tuple`
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0601`.
@rustbot label +F-async_drop