Skip to content

ICE: elaborate drop: index out of bounds #140974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue May 13, 2025 · 1 comment
Open

ICE: elaborate drop: index out of bounds #140974

matthiaskrgr opened this issue May 13, 2025 · 1 comment
Labels
C-bug Category: This is a bug. F-async_drop `#![feature(async_drop)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

//@compile-flags --edition=2021
#![feature(async_drop)]
use core::future::AsyncDrop;
async fn a<g>(b: g, c: usize) {}
fn d() {
    a(e { field: 1 }2);
}
union e {
    field: i32,
}
impl Drop for e {
    fn drop(&mut self) {}
}
impl AsyncDrop for e {}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (8405332bd 2025-05-12)
binary: rustc
commit-hash: 8405332bdf09b153e475f83b8b8ebf8d4e8eb81f
commit-date: 2025-05-12
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4

Error output

error: expected one of `)`, `,`, `.`, `?`, or an operator, found `2`
 --> code.rs:6:21
  |
6 |     a(e { field: 1 }2);
  |                     ^
  |                     |
  |                     expected one of `)`, `,`, `.`, `?`, or an operator
  |                     help: missing `,`

warning: the feature `async_drop` is incomplete and may not be safe to use and/or cause compiler crashes
 --> code.rs:2:12
  |
2 | #![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

warning: type parameter `g` should have an upper camel case name
 --> code.rs:4:12
  |
4 | async fn a<g>(b: g, c: usize) {}
  |            ^ help: convert the identifier to upper camel case: `G`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

warning: type `e` should have an upper camel case name
 --> code.rs:8:7
  |
8 | union e {
  |       ^ help: convert the identifier to upper camel case: `E`

error[E0601]: `main` function not found in crate `code`
  --> code.rs:14:24
   |
14 | impl AsyncDrop for e {}
   |                        ^ consider adding a `main` function to `code.rs`

error[E0046]: not all trait items implemented, missing: `drop`
  --> code.rs:14:1
   |
14 | impl AsyncDrop for e {}
   | ^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
   |
   = help: implement the missing item: `async fn drop(self: Pin<&mut Self>) { todo!() }`

warning: unused variable: `b`
 --> code.rs:4:15
  |
4 | async fn a<g>(b: g, c: usize) {}
  |               ^ help: if this is intentional, prefix it with an underscore: `_b`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `c`
 --> code.rs:4:21
  |
4 | async fn a<g>(b: g, c: usize) {}
  |                     ^ help: if this is intentional, prefix it with an underscore: `_c`

Backtrace

thread 'rustc' panicked at compiler/rustc_mir_transform/src/elaborate_drop.rs:254:34:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:     0x71f4dd5596c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hee27e289fa80eeb0
   1:     0x71f4ddc05987 - core::fmt::write::hcb7a95a553d927d7
   2:     0x71f4decd3411 - std::io::Write::write_fmt::h5f19ce2ac2f30773
   3:     0x71f4dd559522 - std::sys::backtrace::BacktraceLock::print::h967e6c26dabf5676
   4:     0x71f4dd55d11a - std::panicking::default_hook::{{closure}}::h4c9e43e4d632c501
   5:     0x71f4dd55cc9f - std::panicking::default_hook::ha3c41200eaedb148
   6:     0x71f4dc58ac13 - std[a3033ab4cf040dbc]::panicking::update_hook::<alloc[2b9f1e9988cc0e0]::boxed::Box<rustc_driver_impl[2b29d548aa47efe8]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x71f4dd55d993 - std::panicking::rust_panic_with_hook::h614c9e3cb602169a
   8:     0x71f4dd55d68a - std::panicking::begin_panic_handler::{{closure}}::h7175c42c4098b33c
   9:     0x71f4dd559b89 - std::sys::backtrace::__rust_end_short_backtrace::hb28ab4ef577ce3dd
  10:     0x71f4dd55d34d - __rustc[9e838b297ad6583e]::rust_begin_unwind
  11:     0x71f4d9e86220 - core::panicking::panic_fmt::hee3e8e41a6e23382
  12:     0x71f4dbb27553 - core::panicking::panic_bounds_check::h911616a2782ca751
  13:     0x71f4dcda31b5 - <rustc_mir_transform[86a227439405b463]::elaborate_drop::DropCtxt<rustc_mir_transform[86a227439405b463]::shim::DropShimElaborator>>::build_async_drop
  14:     0x71f4de74c486 - <rustc_mir_transform[86a227439405b463]::elaborate_drop::DropCtxt<rustc_mir_transform[86a227439405b463]::shim::DropShimElaborator>>::elaborate_drop
  15:     0x71f4de745d11 - rustc_mir_transform[86a227439405b463]::shim::make_shim
  16:     0x71f4de743cef - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 8usize]>>
  17:     0x71f4de743ca3 - <rustc_query_impl[c99fb05ce5425a5b]::query_impl::mir_shims::dynamic_query::{closure#2} as core[844c48195e089da5]::ops::function::FnOnce<(rustc_middle[c35c93541fbaf6fb]::ty::context::TyCtxt, rustc_middle[c35c93541fbaf6fb]::ty::instance::InstanceKind)>>::call_once
  18:     0x71f4de4115c8 - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::instance::InstanceKind, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  19:     0x71f4de4112e6 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
  20:     0x71f4dcc3af24 - <rustc_middle[c35c93541fbaf6fb]::ty::context::TyCtxt>::coroutine_layout
  21:     0x71f4de32fc5b - rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached
  22:     0x71f4de322b4e - rustc_ty_utils[c2f95faedb959599]::layout::layout_of
  23:     0x71f4de322aaa - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>
  24:     0x71f4de32189c - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::PseudoCanonicalInput<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  25:     0x71f4de3214e7 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  26:     0x71f4de32039a - <core[844c48195e089da5]::iter::adapters::GenericShunt<core[844c48195e089da5]::iter::adapters::by_ref_sized::ByRefSized<core[844c48195e089da5]::iter::adapters::map::Map<core[844c48195e089da5]::slice::iter::Iter<rustc_middle[c35c93541fbaf6fb]::ty::VariantDef>, rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached::{closure#20}>>, core[844c48195e089da5]::result::Result<core[844c48195e089da5]::convert::Infallible, &rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutError>> as core[844c48195e089da5]::iter::traits::iterator::Iterator>::next
  27:     0x71f4de327e44 - rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached
  28:     0x71f4de322b4e - rustc_ty_utils[c2f95faedb959599]::layout::layout_of
  29:     0x71f4de322aaa - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>
  30:     0x71f4de32189c - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::PseudoCanonicalInput<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  31:     0x71f4de3214e7 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  32:     0x71f4de32074a - <core[844c48195e089da5]::iter::adapters::GenericShunt<core[844c48195e089da5]::iter::adapters::by_ref_sized::ByRefSized<core[844c48195e089da5]::iter::adapters::map::Map<core[844c48195e089da5]::slice::iter::Iter<rustc_middle[c35c93541fbaf6fb]::ty::VariantDef>, rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached::{closure#20}>>, core[844c48195e089da5]::result::Result<core[844c48195e089da5]::convert::Infallible, &rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutError>> as core[844c48195e089da5]::iter::traits::iterator::Iterator>::next
  33:     0x71f4de327e44 - rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached
  34:     0x71f4de322b4e - rustc_ty_utils[c2f95faedb959599]::layout::layout_of
  35:     0x71f4de322aaa - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>
  36:     0x71f4de32189c - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::PseudoCanonicalInput<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  37:     0x71f4de3214e7 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  38:     0x71f4de3235c0 - rustc_ty_utils[c2f95faedb959599]::layout::layout_of
  39:     0x71f4de322aaa - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>
  40:     0x71f4de32189c - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::PseudoCanonicalInput<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  41:     0x71f4de3214e7 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  42:     0x71f4de333349 - <rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutCx as rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutOf>::spanned_layout_of
  43:     0x71f4dd4c4e30 - <core[844c48195e089da5]::iter::adapters::GenericShunt<core[844c48195e089da5]::iter::adapters::by_ref_sized::ByRefSized<core[844c48195e089da5]::iter::adapters::map::Map<core[844c48195e089da5]::slice::iter::Iter<rustc_middle[c35c93541fbaf6fb]::mir::query::CoroutineSavedTy>, rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached::{closure#12}>>, core[844c48195e089da5]::result::Result<core[844c48195e089da5]::convert::Infallible, &rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutError>> as core[844c48195e089da5]::iter::traits::iterator::Iterator>::next
  44:     0x71f4dd4aec1a - core[844c48195e089da5]::iter::adapters::try_process::<core[844c48195e089da5]::iter::adapters::by_ref_sized::ByRefSized<core[844c48195e089da5]::iter::adapters::map::Map<core[844c48195e089da5]::slice::iter::Iter<rustc_middle[c35c93541fbaf6fb]::mir::query::CoroutineSavedTy>, rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached::{closure#12}>>, rustc_abi[a261153e5dfc86cc]::layout::ty::TyAndLayout<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, core[844c48195e089da5]::result::Result<core[844c48195e089da5]::convert::Infallible, &rustc_middle[c35c93541fbaf6fb]::ty::layout::LayoutError>, <core[844c48195e089da5]::iter::adapters::map::Map<core[844c48195e089da5]::slice::iter::Iter<rustc_middle[c35c93541fbaf6fb]::mir::query::CoroutineSavedTy>, rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached::{closure#12}> as core[844c48195e089da5]::iter::traits::iterator::Iterator>::try_collect<rustc_index[731be7b9208c99a6]::vec::IndexVec<rustc_middle[c35c93541fbaf6fb]::mir::query::CoroutineSavedLocal, rustc_abi[a261153e5dfc86cc]::layout::ty::TyAndLayout<rustc_middle[c35c93541fbaf6fb]::ty::Ty>>>::{closure#0}, rustc_index[731be7b9208c99a6]::vec::IndexVec<rustc_middle[c35c93541fbaf6fb]::mir::query::CoroutineSavedLocal, rustc_abi[a261153e5dfc86cc]::layout::ty::TyAndLayout<rustc_middle[c35c93541fbaf6fb]::ty::Ty>>>
  45:     0x71f4de33027b - rustc_ty_utils[c2f95faedb959599]::layout::layout_of_uncached
  46:     0x71f4de322b4e - rustc_ty_utils[c2f95faedb959599]::layout::layout_of
  47:     0x71f4de322aaa - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>
  48:     0x71f4de32189c - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::DefaultCache<rustc_middle[c35c93541fbaf6fb]::ty::PseudoCanonicalInput<rustc_middle[c35c93541fbaf6fb]::ty::Ty>, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  49:     0x71f4de3214e7 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  50:     0x71f4dea1d766 - <rustc_mir_transform[86a227439405b463]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[86a227439405b463]::pass_manager::MirLint>::run_lint
  51:     0x71f4ddc0bea7 - rustc_mir_transform[86a227439405b463]::run_analysis_to_runtime_passes
  52:     0x71f4de0bb625 - rustc_mir_transform[86a227439405b463]::mir_drops_elaborated_and_const_checked
  53:     0x71f4de0baff7 - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 8usize]>>
  54:     0x71f4ddedc4e6 - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_data_structures[8c4d114b892fc81f]::vec_cache::VecCache<rustc_span[767accb19bf8aef3]::def_id::LocalDefId, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[13fd671b9de95920]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  55:     0x71f4ddedbdd2 - rustc_query_impl[c99fb05ce5425a5b]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  56:     0x71f4de112210 - rustc_interface[b13b618c5853daff]::passes::run_required_analyses
  57:     0x71f4debdb39e - rustc_interface[b13b618c5853daff]::passes::analysis
  58:     0x71f4debdb375 - rustc_query_impl[c99fb05ce5425a5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c99fb05ce5425a5b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 0usize]>>
  59:     0x71f4deb5363a - rustc_query_system[13fd671b9de95920]::query::plumbing::try_execute_query::<rustc_query_impl[c99fb05ce5425a5b]::DynamicConfig<rustc_query_system[13fd671b9de95920]::query::caches::SingleCache<rustc_middle[c35c93541fbaf6fb]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c99fb05ce5425a5b]::plumbing::QueryCtxt, false>
  60:     0x71f4deb5330f - rustc_query_impl[c99fb05ce5425a5b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  61:     0x71f4dee1f0c7 - rustc_interface[b13b618c5853daff]::passes::create_and_enter_global_ctxt::<core[844c48195e089da5]::option::Option<rustc_interface[b13b618c5853daff]::queries::Linker>, rustc_driver_impl[2b29d548aa47efe8]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  62:     0x71f4decf50a6 - rustc_interface[b13b618c5853daff]::interface::run_compiler::<(), rustc_driver_impl[2b29d548aa47efe8]::run_compiler::{closure#0}>::{closure#1}
  63:     0x71f4decca07e - std[a3033ab4cf040dbc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b13b618c5853daff]::util::run_in_thread_with_globals<rustc_interface[b13b618c5853daff]::util::run_in_thread_pool_with_globals<rustc_interface[b13b618c5853daff]::interface::run_compiler<(), rustc_driver_impl[2b29d548aa47efe8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  64:     0x71f4decca4eb - <<std[a3033ab4cf040dbc]::thread::Builder>::spawn_unchecked_<rustc_interface[b13b618c5853daff]::util::run_in_thread_with_globals<rustc_interface[b13b618c5853daff]::util::run_in_thread_pool_with_globals<rustc_interface[b13b618c5853daff]::interface::run_compiler<(), rustc_driver_impl[2b29d548aa47efe8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[844c48195e089da5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  65:     0x71f4deccb8eb - std::sys::pal::unix::thread::Thread::new::thread_start::hcb4e67cfc7257238
  66:     0x71f4d8a5d70a - <unknown>
  67:     0x71f4d8ae1aac - <unknown>
  68:                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: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-05-13T19_00_56-2066440.txt` to your bug report

query stack during panic:
#0 [mir_shims] generating MIR shim for `core::future::async_drop::async_drop_in_place::{closure#0}`, instance=AsyncDropGlue(DefId(2:15267 ~ core[844c]::future::async_drop::async_drop_in_place::{closure#0}), Coroutine(DefId(2:15267 ~ core[844c]::future::async_drop::async_drop_in_place::{closure#0}), [e, (), core::future::ResumeTy, (), (), CoroutineWitness(DefId(2:15267 ~ core[844c]::future::async_drop::async_drop_in_place::{closure#0}), [e]), (*mut e,)]))
#1 [layout_of] computing layout of `{async fn body of core::future::async_drop::async_drop_in_place<e>()}`
#2 [layout_of] computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body of core::future::async_drop::async_drop_in_place<e>()}>`
#3 [layout_of] computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body of core::future::async_drop::async_drop_in_place<e>()}>`
#4 [layout_of] computing layout of `core::mem::maybe_uninit::MaybeUninit<core::future::async_drop::async_drop_in_place::{opaque#0}>`
#5 [layout_of] computing layout of `{async fn body of a<e>()}`
#6 [mir_drops_elaborated_and_const_checked] elaborating drops for `d`
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 5 warnings emitted

Some errors have detailed explanations: E0046, E0601.
For more information about an error, try `rustc --explain E0046`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels May 13, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 13, 2025
@matthiaskrgr matthiaskrgr changed the title ICE: elaborate drop: index oo ICE: elaborate drop: index out of bounds May 13, 2025
@matthiaskrgr matthiaskrgr added the F-async_drop `#![feature(async_drop)]` label May 13, 2025
@moxian
Copy link
Contributor

moxian commented May 13, 2025

cleaner:

#![feature(async_drop)]
use core::future::AsyncDrop;

async fn fun(_: HasIncompleteAsyncDrop) {}

struct HasIncompleteAsyncDrop;
impl Drop for HasIncompleteAsyncDrop {
    fn drop(&mut self) {}
}
impl AsyncDrop for HasIncompleteAsyncDrop {
    // not implemented yet..
}

Bisects to initial async drop codegen PR 7d65abf

@rustbot label: +S-has-mcve +requires-incomplete-features -needs-triage +S-has-bisection

@rustbot rustbot added requires-incomplete-features This issue requires the use of incomplete features. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-async_drop `#![feature(async_drop)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants