Skip to content

'index out of bounds: the len is X but the index is Y' #103385

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

Closed
Radvylf opened this issue Oct 22, 2022 · 4 comments
Closed

'index out of bounds: the len is X but the index is Y' #103385

Radvylf opened this issue Oct 22, 2022 · 4 comments
Assignees
Labels
C-bug Category: This is a bug. 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.

Comments

@Radvylf
Copy link

Radvylf commented Oct 22, 2022

Code

// Box<T> can be any generic; Option<T> or Result<T, [anything]> also work

fn a<T>(x: Box<T>) {}

// This must be async; return type is left out for minimal-ness, but it could be modified to return a Box<()> and the error would still exist (but it'd return a future still, and awaiting that future makes the bug disappear)

async fn b() {}

fn main() {
    // Bug disappears if b() is awaited
    
    a(b());
}

Meta

rustc --version --verbose:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

Bug doesn't appear to exist in nightly, but posting it here just in case (e.g. if it pops up again later).

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 2', /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
Backtrace

stack backtrace:
   0:     0x79286ec0319d - std::backtrace_rs::backtrace::libunwind::trace::h9135f25bc195152c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x79286ec0319d - std::backtrace_rs::backtrace::trace_unsynchronized::h015ee85be510df51
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x79286ec0319d - std::sys_common::backtrace::_print_fmt::h5fad03caa9652a2c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x79286ec0319d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2b42ca28d244e5c7
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x79286ec5e6ac - core::fmt::write::h401e827d053130ed
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/fmt/mod.rs:1198:17
   5:     0x79286ebf44e1 - std::io::Write::write_fmt::hffec93268f5cde32
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/io/mod.rs:1672:15
   6:     0x79286ec05eb5 - std::sys_common::backtrace::_print::h180c4c706ee1d3fb
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x79286ec05eb5 - std::sys_common::backtrace::print::hd0c35d18765761c9
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x79286ec05eb5 - std::panicking::default_hook::{{closure}}::h1f023310983bc730
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:295:22
   9:     0x79286ec05bd1 - std::panicking::default_hook::h188fec3334afd5be
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:314:9
  10:     0x7928714db484 - rustc_driver[4568cc0a685fd94d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x79286ec065ea - std::panicking::rust_panic_with_hook::hf26e9d4f97b40096
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:702:17
  12:     0x79286ec06427 - std::panicking::begin_panic_handler::{{closure}}::hfab912107608087a
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:588:13
  13:     0x79286ec03694 - std::sys_common::backtrace::__rust_end_short_backtrace::h434b685ce8d9965b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x79286ec06159 - rust_begin_unwind
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
  15:     0x79286ec5b1c3 - core::panicking::panic_fmt::ha6dc7f2ab2479463
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
  16:     0x79286ec5b102 - core::panicking::panic_bounds_check::ha6e6615eae13afdc
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:84:5
  17:     0x79286fd34e2f - <rustc_infer[b9251f21a0aa6bc7]::infer::ShallowResolver as rustc_middle[b6cf56a787d1e2a1]::ty::fold::TypeFolder>::fold_ty
  18:     0x79286fd3033a - <&rustc_middle[b6cf56a787d1e2a1]::ty::list::List<rustc_middle[b6cf56a787d1e2a1]::ty::subst::GenericArg> as rustc_middle[b6cf56a787d1e2a1]::ty::fold::TypeFoldable>::try_fold_with::<rustc_infer[b9251f21a0aa6bc7]::infer::resolve::OpportunisticVarResolver>
  19:     0x79286fd33cdb - <rustc_infer[b9251f21a0aa6bc7]::infer::resolve::OpportunisticVarResolver as rustc_middle[b6cf56a787d1e2a1]::ty::fold::FallibleTypeFolder>::try_fold_ty
  20:     0x79287244ec26 - <(rustc_middle[b6cf56a787d1e2a1]::ty::Ty, rustc_middle[b6cf56a787d1e2a1]::ty::Ty) as rustc_middle[b6cf56a787d1e2a1]::ty::fold::TypeFoldable>::fold_with::<rustc_infer[b9251f21a0aa6bc7]::infer::resolve::OpportunisticVarResolver>
  21:     0x7928723e6185 - <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::same_type_modulo_infer
  22:     0x7928723f47f9 - <core[6fcc70bcc91a5bf5]::iter::adapters::map::Map<core[6fcc70bcc91a5bf5]::iter::adapters::filter::Filter<core[6fcc70bcc91a5bf5]::slice::iter::Iter<rustc_middle[b6cf56a787d1e2a1]::ty::FieldDef>, <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::suggest_accessing_field_where_appropriate::{closure#0}>, <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::suggest_accessing_field_where_appropriate::{closure#1}> as core[6fcc70bcc91a5bf5]::iter::traits::iterator::Iterator>::try_fold::<(), core[6fcc70bcc91a5bf5]::iter::traits::iterator::Iterator::find::check<(rustc_span[721a57c036170ce]::symbol::Symbol, rustc_middle[b6cf56a787d1e2a1]::ty::Ty), <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::suggest_accessing_field_where_appropriate::{closure#2}>::{closure#0}, core[6fcc70bcc91a5bf5]::ops::control_flow::ControlFlow<(rustc_span[721a57c036170ce]::symbol::Symbol, rustc_middle[b6cf56a787d1e2a1]::ty::Ty)>>
  23:     0x7928723e9cef - <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::note_type_err
  24:     0x7928723e29f2 - <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxt>::report_and_explain_type_error
  25:     0x79287184ba98 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::report_arg_errors
  26:     0x79286ff439a2 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_argument_types
  27:     0x79286fef3c97 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_call
  28:     0x79286feb3594 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_expr_kind
  29:     0x79286febef30 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  30:     0x79286fed8869 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x79286feb35c9 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_expr_kind
  32:     0x79286febef30 - <rustc_typeck[8db86e16038c4234]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  33:     0x7928705e41da - rustc_typeck[8db86e16038c4234]::check::check::check_fn
  34:     0x7928705d4fab - <rustc_infer[b9251f21a0aa6bc7]::infer::InferCtxtBuilder>::enter::<&rustc_middle[b6cf56a787d1e2a1]::ty::context::TypeckResults, <rustc_typeck[8db86e16038c4234]::check::inherited::InheritedBuilder>::enter<rustc_typeck[8db86e16038c4234]::check::typeck_with_fallback<rustc_typeck[8db86e16038c4234]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[b6cf56a787d1e2a1]::ty::context::TypeckResults>::{closure#0}>
  35:     0x792870ed2b1d - rustc_typeck[8db86e16038c4234]::check::typeck
  36:     0x79286ffde4cf - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt, rustc_span[721a57c036170ce]::def_id::LocalDefId, &rustc_middle[b6cf56a787d1e2a1]::ty::context::TypeckResults>
  37:     0x79286ffd3fb3 - rustc_query_system[8caf4755e287670e]::query::plumbing::try_execute_query::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, rustc_query_system[8caf4755e287670e]::query::caches::DefaultCache<rustc_span[721a57c036170ce]::def_id::LocalDefId, &rustc_middle[b6cf56a787d1e2a1]::ty::context::TypeckResults>>
  38:     0x792871156316 - rustc_query_system[8caf4755e287670e]::query::plumbing::force_query::<rustc_query_impl[232efbc2900411f9]::queries::typeck, rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  39:     0x79287115615e - rustc_query_impl[232efbc2900411f9]::query_callbacks::typeck::force_from_dep_node
  40:     0x79286fe77531 - <rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt as rustc_query_system[8caf4755e287670e]::dep_graph::DepContext>::try_force_from_dep_node
  41:     0x79286fe76969 - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  42:     0x79286fe76060 - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  43:     0x7928711c1c59 - rustc_query_system[8caf4755e287670e]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, (), ()>
  44:     0x7928711c0e77 - rustc_query_system[8caf4755e287670e]::query::plumbing::try_execute_query::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, rustc_query_system[8caf4755e287670e]::query::caches::DefaultCache<(), ()>>
  45:     0x7928711c0a21 - rustc_query_system[8caf4755e287670e]::query::plumbing::get_query::<rustc_query_impl[232efbc2900411f9]::queries::typeck_item_bodies, rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  46:     0x792870ecc4bf - <rustc_session[98f7faf1d37bb5fb]::session::Session>::time::<(), rustc_typeck[8db86e16038c4234]::check_crate::{closure#7}>
  47:     0x792870ec9d43 - rustc_typeck[8db86e16038c4234]::check_crate
  48:     0x792870ec5917 - rustc_interface[f934826ba4c12dd9]::passes::analysis
  49:     0x7928712802bc - <rustc_query_system[8caf4755e287670e]::dep_graph::graph::DepGraph<rustc_middle[b6cf56a787d1e2a1]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[b6cf56a787d1e2a1]::ty::context::TyCtxt, (), core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  50:     0x79287127faab - rustc_query_system[8caf4755e287670e]::query::plumbing::try_execute_query::<rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt, rustc_query_system[8caf4755e287670e]::query::caches::DefaultCache<(), core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>>
  51:     0x79287127f5fe - rustc_query_system[8caf4755e287670e]::query::plumbing::get_query::<rustc_query_impl[232efbc2900411f9]::queries::analysis, rustc_query_impl[232efbc2900411f9]::plumbing::QueryCtxt>
  52:     0x792870c59d87 - <rustc_interface[f934826ba4c12dd9]::passes::QueryContext>::enter::<rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  53:     0x792870c5297f - <rustc_interface[f934826ba4c12dd9]::interface::Compiler>::enter::<rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}::{closure#2}, core[6fcc70bcc91a5bf5]::result::Result<core[6fcc70bcc91a5bf5]::option::Option<rustc_interface[f934826ba4c12dd9]::queries::Linker>, rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  54:     0x792870c4786a - rustc_span[721a57c036170ce]::with_source_map::<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_interface[f934826ba4c12dd9]::interface::create_compiler_and_run<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#1}>
  55:     0x792870c471a2 - <scoped_tls[80743de900a7f844]::ScopedKey<rustc_span[721a57c036170ce]::SessionGlobals>>::set::<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  56:     0x792870c455cf - std[306a94a967d8f5ee]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f934826ba4c12dd9]::util::run_in_thread_pool_with_globals<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  57:     0x7928712ff0b9 - <<std[306a94a967d8f5ee]::thread::Builder>::spawn_unchecked_<rustc_interface[f934826ba4c12dd9]::util::run_in_thread_pool_with_globals<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#1} as core[6fcc70bcc91a5bf5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x79286ec10723 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h56d5fc072706762b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
  59:     0x79286ec10723 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h41deef8e33b824bb
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
  60:     0x79286ec10723 - std::sys::unix::thread::Thread::new::thread_start::ha6436304a1170bba
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys/unix/thread.rs:108:17
  61:     0x79286eadaea7 - start_thread
  62:     0x79286e9f8aef - clone
  63:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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: rustc 1.64.0 (a55dd71d5 2022-09-19) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             1: rustc_middle::ty::print::pretty::trimmed_def_paths
             2: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle::ty::context::TyCtxt, (), std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>::{closure#0}, std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>
             3: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>
             4: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::ArenaCache<(), std::collections::hash::map::HashMap<rustc_span::def_id::DefId, rustc_span::symbol::Symbol, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>>>
             5: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::trimmed_def_paths, rustc_query_impl::plumbing::QueryCtxt>
             6: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
             7: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::default_print_def_path
             8: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
             9: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::pretty::PrettyPrinter>::pretty_print_type
            10: <rustc_middle::ty::Ty as core::fmt::Display>::fmt
            11: <rustc_infer::infer::InferCtxt>::cmp
            12: <rustc_infer::infer::InferCtxt>::values_str
            13: <rustc_infer::infer::InferCtxt>::note_type_err
            14: <rustc_infer::infer::InferCtxt>::report_and_explain_type_error
            15: <rustc_typeck::check::fn_ctxt::FnCtxt>::report_arg_errors
            16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
            17: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
            18: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            20: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
            21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
            22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
            23: rustc_typeck::check::check::check_fn
            24: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
            25: rustc_typeck::check::typeck
            26: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
            27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
            28: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            29: rustc_query_impl::query_callbacks::typeck::force_from_dep_node
            30: <rustc_middle::ty::context::TyCtxt as rustc_query_system::dep_graph::DepContext>::try_force_from_dep_node
            31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
            32: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl::plumbing::QueryCtxt>
            33: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, (), ()>
            34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
            35: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            36: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
            37: rustc_typeck::check_crate
            38: rustc_interface::passes::analysis
            39: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
            41: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            42: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            43: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
            44: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
            45: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            46: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            47: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
            49: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
            50: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys/unix/thread.rs:108:17
            51: start_thread
            52: clone
          

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1426:13
stack backtrace:
   0:     0x79286ec0319d - std::backtrace_rs::backtrace::libunwind::trace::h9135f25bc195152c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x79286ec0319d - std::backtrace_rs::backtrace::trace_unsynchronized::h015ee85be510df51
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x79286ec0319d - std::sys_common::backtrace::_print_fmt::h5fad03caa9652a2c
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x79286ec0319d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2b42ca28d244e5c7
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x79286ec5e6ac - core::fmt::write::h401e827d053130ed
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/fmt/mod.rs:1198:17
   5:     0x79286ebf44e1 - std::io::Write::write_fmt::hffec93268f5cde32
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/io/mod.rs:1672:15
   6:     0x79286ec05eb5 - std::sys_common::backtrace::_print::h180c4c706ee1d3fb
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x79286ec05eb5 - std::sys_common::backtrace::print::hd0c35d18765761c9
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x79286ec05eb5 - std::panicking::default_hook::{{closure}}::h1f023310983bc730
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:295:22
   9:     0x79286ec05bd1 - std::panicking::default_hook::h188fec3334afd5be
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:314:9
  10:     0x7928714db484 - rustc_driver[4568cc0a685fd94d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x79286ec065ea - std::panicking::rust_panic_with_hook::hf26e9d4f97b40096
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:702:17
  12:     0x7928725fb7d1 - std[306a94a967d8f5ee]::panicking::begin_panic::<rustc_errors[5fcb1a1f56a762e6]::ExplicitBug>::{closure#0}
  13:     0x7928725fb176 - std[306a94a967d8f5ee]::sys_common::backtrace::__rust_end_short_backtrace::<std[306a94a967d8f5ee]::panicking::begin_panic<rustc_errors[5fcb1a1f56a762e6]::ExplicitBug>::{closure#0}, !>
  14:     0x79287260c476 - std[306a94a967d8f5ee]::panicking::begin_panic::<rustc_errors[5fcb1a1f56a762e6]::ExplicitBug>
  15:     0x792872612a06 - std[306a94a967d8f5ee]::panic::panic_any::<rustc_errors[5fcb1a1f56a762e6]::ExplicitBug>
  16:     0x79287100ff2c - <rustc_errors[5fcb1a1f56a762e6]::HandlerInner as core[6fcc70bcc91a5bf5]::ops::drop::Drop>::drop
  17:     0x792870c51a48 - core[6fcc70bcc91a5bf5]::ptr::drop_in_place::<rustc_session[98f7faf1d37bb5fb]::parse::ParseSess>
  18:     0x792870c49023 - <alloc[6d6f83537459af52]::rc::Rc<rustc_session[98f7faf1d37bb5fb]::session::Session> as core[6fcc70bcc91a5bf5]::ops::drop::Drop>::drop
  19:     0x792870c480dd - core[6fcc70bcc91a5bf5]::ptr::drop_in_place::<rustc_interface[f934826ba4c12dd9]::interface::Compiler>
  20:     0x792870c47c3c - rustc_span[721a57c036170ce]::with_source_map::<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_interface[f934826ba4c12dd9]::interface::create_compiler_and_run<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x792870c471a2 - <scoped_tls[80743de900a7f844]::ScopedKey<rustc_span[721a57c036170ce]::SessionGlobals>>::set::<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  22:     0x792870c455cf - std[306a94a967d8f5ee]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f934826ba4c12dd9]::util::run_in_thread_pool_with_globals<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>
  23:     0x7928712ff0b9 - <<std[306a94a967d8f5ee]::thread::Builder>::spawn_unchecked_<rustc_interface[f934826ba4c12dd9]::util::run_in_thread_pool_with_globals<rustc_interface[f934826ba4c12dd9]::interface::run_compiler<core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>, rustc_driver[4568cc0a685fd94d]::run_compiler::{closure#1}>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#0}, core[6fcc70bcc91a5bf5]::result::Result<(), rustc_errors[5fcb1a1f56a762e6]::ErrorGuaranteed>>::{closure#1} as core[6fcc70bcc91a5bf5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x79286ec10723 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h56d5fc072706762b
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
  25:     0x79286ec10723 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h41deef8e33b824bb
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/alloc/src/boxed.rs:1935:9
  26:     0x79286ec10723 - std::sys::unix::thread::Thread::new::thread_start::ha6436304a1170bba
                               at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/sys/unix/thread.rs:108:17
  27:     0x79286eadaea7 - start_thread
  28:     0x79286e9f8aef - clone
  29:                0x0 - <unknown>

note: 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: rustc 1.64.0 (a55dd71d5 2022-09-19) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `mcve`

Caused by:
  process didn't exit successfully: `rustc --crate-name mcve --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=323e4f1af904691c -C extra-filename=-323e4f1af904691c --out-dir /home/radvylf/npsp-rs/mcve/target/debug/deps -C incremental=/home/radvylf/npsp-rs/mcve/target/debug/incremental -L dependency=/home/radvylf/npsp-rs/mcve/target/debug/deps` (signal: 6, SIGABRT: process abort signal)

@Radvylf Radvylf added C-bug Category: This is a bug. 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. labels Oct 22, 2022
@Radvylf
Copy link
Author

Radvylf commented Oct 22, 2022

I've just noticed this is a dupe of 'rustc' panicked at 'index out of bounds: the len is 385 but the index is 386'. Maybe the much shorter MCVE will still be useful though.

@compiler-errors
Copy link
Member

This was fixed a while back and will be fixed on the next stable version of Rust which comes out in a few weeks.

@estebank
Copy link
Contributor

estebank commented Nov 8, 2022

@compiler-errors do we have a PR for the fix? I wanted to confirm that a regression test was included so we can close this and the other linked open issue. If not we can mark these two as e-easy and ask for a PR adding a test.

Thank you for the report @Radvylf! Just wanted to let you know that we keep tickets open against until we fix them on nightly (except for stable regressions that require a backport), so please don't be startled if a ticket gets closed before its fix is available on stable :)

@compiler-errors
Copy link
Member

compiler-errors commented Nov 8, 2022

@estebank I fixed this in #99928 -- the UI test that was included was due to the same root cause (type mismatch + a future) so I'll probably just close this now without needing an additional test. Feel free to reopen if you care about a new UI test getting added.

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. 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.
Projects
None yet
Development

No branches or pull requests

3 participants