Skip to content

ICE: snapshot_vec.rs index out of bounds: the len is 0 but the index is 0 #122216

New issue

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

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

Already on GitHub? # to your account

Closed
matthiaskrgr opened this issue Mar 9, 2024 · 4 comments
Closed
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

@matthiaskrgr
Copy link
Member

Code

#![feature(impl_trait_in_assoc_type,const_precise_live_drops)]

trait Trait {
    type Opaque1;
    type Opaque2;
    fn constrain(self) -> (Self::Opaque1, Self::Opaque2);
}

impl<const B: Word> Trait for &'a () {
    type Opaque1 = impl Sized;
    type Opaque2 = impl Sized + 'a;
    fn constrain(self) -> (Self::Opaque1, Self::Opaque2) {
        let a: Self::Opaque1 = ();
        let b: Self::Opaque2 = self
        (a, b)
    }
}

Meta

rustc --version --verbose:

rustc 1.78.0-nightly (a655e648a 2024-03-08)
binary: rustc
commit-hash: a655e648a9f94d74263108366b83e677af56e35d
commit-date: 2024-03-08
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

<output>
Backtrace

thread 'rustc' panicked at /rust/deps/ena-0.14.2/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:     0x7f175d78c744 - std::backtrace_rs::backtrace::libunwind::trace::hd79b9078a34dff8c
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f175d78c744 - std::backtrace_rs::backtrace::trace_unsynchronized::hb030a00513a1f538
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f175d78c744 - std::sys_common::backtrace::_print_fmt::h9e8f2e41a9fc6909
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f175d78c744 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6f607e0d4dd3a9cf
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f175d7dda7c - core::fmt::rt::Argument::fmt::h09f11d700bacd96c
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/core/src/fmt/rt.rs:142:9
   5:     0x7f175d7dda7c - core::fmt::write_internal::h310f192d94aa585c
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/core/src/fmt/mod.rs:1143:17
   6:     0x7f175d781157 - core::fmt::write::hd3de438db38ee127
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/core/src/fmt/mod.rs:1125:67
   7:     0x7f175d781157 - std::io::Write::write_fmt::h3b33808356b90221
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/io/mod.rs:1846:15
   8:     0x7f175d78c4f4 - std::sys_common::backtrace::_print::h611f07983f175f23
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys_common/backtrace.rs:47:5
   9:     0x7f175d78c4f4 - std::sys_common::backtrace::print::h6363f60fb7870801
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys_common/backtrace.rs:34:9
  10:     0x7f175d78f0fb - std::panicking::default_hook::{{closure}}::h918979fb10785ece
  11:     0x7f175d78ee57 - std::panicking::default_hook::h7cb2ae29c5cb7a04
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/panicking.rs:292:9
  12:     0x7f176065f79c - std[3bcdf4610aa8fcfe]::panicking::update_hook::<alloc[693dccb2014d768d]::boxed::Box<rustc_driver_impl[31aa33c569e87665]::install_ice_hook::{closure#0}>>::{closure#0}
  13:     0x7f175d78f812 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd696ff45800b08d8
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/alloc/src/boxed.rs:2030:9
  14:     0x7f175d78f812 - std::panicking::rust_panic_with_hook::h50affda8314ad6e5
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/panicking.rs:783:13
  15:     0x7f175d78f5d2 - std::panicking::begin_panic_handler::{{closure}}::h8093c7c84d3aa062
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/panicking.rs:657:13
  16:     0x7f175d78cc16 - std::sys_common::backtrace::__rust_end_short_backtrace::h1bc420f809db97be
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys_common/backtrace.rs:171:18
  17:     0x7f175d78f2d4 - rust_begin_unwind
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/panicking.rs:645:5
  18:     0x7f175d7d9cd5 - core::panicking::panic_fmt::h3e7482ac39c7599a
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/core/src/panicking.rs:72:14
  19:     0x7f175d7d9f22 - core::panicking::panic_bounds_check::h3de9912b70f7e32b
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/core/src/panicking.rs:209:5
  20:     0x7f1762c72e70 - <ena[f338d0ede8a68af2]::unify::UnificationTable<ena[f338d0ede8a68af2]::unify::backing_vec::InPlace<rustc_middle[fd081ac05546064c]::infer::unify_key::ConstVidKey, &mut alloc[693dccb2014d768d]::vec::Vec<ena[f338d0ede8a68af2]::unify::VarValue<rustc_middle[fd081ac05546064c]::infer::unify_key::ConstVidKey>>, &mut rustc_infer[4a8d5c71cd99073a]::infer::undo_log::InferCtxtUndoLogs>>>::uninlined_get_root_key.llvm.6269819087412070592.cold.0
  21:     0x7f1761ec7e7d - <rustc_infer[4a8d5c71cd99073a]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[596ef0b71ce5aacf]::fold::TypeFolder<rustc_middle[fd081ac05546064c]::ty::context::TyCtxt>>::fold_const
  22:     0x7f1761bd0b0f - <rustc_middle[fd081ac05546064c]::ty::generic_args::GenericArg as rustc_type_ir[596ef0b71ce5aacf]::fold::TypeFoldable<rustc_middle[fd081ac05546064c]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[4a8d5c71cd99073a]::infer::canonical::canonicalizer::Canonicalizer>
  23:     0x7f175eba3c7b - <rustc_infer[4a8d5c71cd99073a]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[596ef0b71ce5aacf]::fold::TypeFolder<rustc_middle[fd081ac05546064c]::ty::context::TyCtxt>>::fold_ty
  24:     0x7f1761ec6c05 - <rustc_infer[4a8d5c71cd99073a]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[596ef0b71ce5aacf]::fold::FallibleTypeFolder<rustc_middle[fd081ac05546064c]::ty::context::TyCtxt>>::try_fold_predicate
  25:     0x7f175ee48422 - rustc_trait_selection[daffc786cbb7c95]::traits::type_known_to_meet_bound_modulo_regions
  26:     0x7f1761e574c7 - rustc_ty_utils[831a312deff50cbb]::common_traits::is_copy_raw
  27:     0x7f1761e56fe7 - rustc_query_impl[ebede55f2ba688a3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ebede55f2ba688a3]::query_impl::is_copy_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>
  28:     0x7f1761e566d3 - rustc_query_system[67c50b8e9e85bc4b]::query::plumbing::try_execute_query::<rustc_query_impl[ebede55f2ba688a3]::DynamicConfig<rustc_query_system[67c50b8e9e85bc4b]::query::caches::DefaultCache<rustc_middle[fd081ac05546064c]::ty::ParamEnvAnd<rustc_middle[fd081ac05546064c]::ty::Ty>, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ebede55f2ba688a3]::plumbing::QueryCtxt, false>
  29:     0x7f1761e5638e - rustc_query_impl[ebede55f2ba688a3]::query_impl::is_copy_raw::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f1761e589bc - rustc_ty_utils[831a312deff50cbb]::needs_drop::needs_drop_raw
  31:     0x7f1761e583d3 - rustc_query_impl[ebede55f2ba688a3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ebede55f2ba688a3]::query_impl::needs_drop_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7f1761e5667b - rustc_query_system[67c50b8e9e85bc4b]::query::plumbing::try_execute_query::<rustc_query_impl[ebede55f2ba688a3]::DynamicConfig<rustc_query_system[67c50b8e9e85bc4b]::query::caches::DefaultCache<rustc_middle[fd081ac05546064c]::ty::ParamEnvAnd<rustc_middle[fd081ac05546064c]::ty::Ty>, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ebede55f2ba688a3]::plumbing::QueryCtxt, false>
  33:     0x7f1761e562ce - rustc_query_impl[ebede55f2ba688a3]::query_impl::needs_drop_raw::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f1761e0f37b - <rustc_middle[fd081ac05546064c]::ty::Ty>::needs_drop
  35:     0x7f1760cacf91 - <rustc_mir_transform[83eb2cb2e8446ba8]::remove_uninit_drops::RemoveUninitDrops as rustc_middle[fd081ac05546064c]::mir::MirPass>::run_pass
  36:     0x7f1761a136cf - rustc_mir_transform[83eb2cb2e8446ba8]::pass_manager::run_passes_inner
  37:     0x7f1761c40c63 - rustc_mir_transform[83eb2cb2e8446ba8]::mir_drops_elaborated_and_const_checked
  38:     0x7f1761c3ff7d - rustc_query_impl[ebede55f2ba688a3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ebede55f2ba688a3]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 8usize]>>
  39:     0x7f1761b5b93b - rustc_query_system[67c50b8e9e85bc4b]::query::plumbing::try_execute_query::<rustc_query_impl[ebede55f2ba688a3]::DynamicConfig<rustc_query_system[67c50b8e9e85bc4b]::query::caches::VecCache<rustc_span[9b5de1c806cc2c00]::def_id::LocalDefId, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ebede55f2ba688a3]::plumbing::QueryCtxt, false>
  40:     0x7f1761b5b21e - rustc_query_impl[ebede55f2ba688a3]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f1762550950 - rustc_interface[7cf7fd78b82fa32a]::passes::analysis
  42:     0x7f1762550119 - rustc_query_impl[ebede55f2ba688a3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ebede55f2ba688a3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f1762792265 - rustc_query_system[67c50b8e9e85bc4b]::query::plumbing::try_execute_query::<rustc_query_impl[ebede55f2ba688a3]::DynamicConfig<rustc_query_system[67c50b8e9e85bc4b]::query::caches::SingleCache<rustc_middle[fd081ac05546064c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ebede55f2ba688a3]::plumbing::QueryCtxt, false>
  44:     0x7f1762791fc9 - rustc_query_impl[ebede55f2ba688a3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f176271bf8f - rustc_interface[7cf7fd78b82fa32a]::interface::run_compiler::<core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>, rustc_driver_impl[31aa33c569e87665]::run_compiler::{closure#0}>::{closure#0}
  46:     0x7f17629d0005 - std[3bcdf4610aa8fcfe]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7cf7fd78b82fa32a]::util::run_in_thread_with_globals<rustc_interface[7cf7fd78b82fa32a]::util::run_in_thread_pool_with_globals<rustc_interface[7cf7fd78b82fa32a]::interface::run_compiler<core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>, rustc_driver_impl[31aa33c569e87665]::run_compiler::{closure#0}>::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>
  47:     0x7f17629cfe32 - <<std[3bcdf4610aa8fcfe]::thread::Builder>::spawn_unchecked_<rustc_interface[7cf7fd78b82fa32a]::util::run_in_thread_with_globals<rustc_interface[7cf7fd78b82fa32a]::util::run_in_thread_pool_with_globals<rustc_interface[7cf7fd78b82fa32a]::interface::run_compiler<core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>, rustc_driver_impl[31aa33c569e87665]::run_compiler::{closure#0}>::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93adbeecb64913d3]::result::Result<(), rustc_span[9b5de1c806cc2c00]::ErrorGuaranteed>>::{closure#1} as core[93adbeecb64913d3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f175d798f75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdd6038e2544823b8
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/alloc/src/boxed.rs:2016:9
  49:     0x7f175d798f75 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3c0d32827bf54df1
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/alloc/src/boxed.rs:2016:9
  50:     0x7f175d798f75 - std::sys::pal::unix::thread::Thread::new::thread_start::h05976f6f44bd9999
                               at /rustc/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys/pal/unix/thread.rs:108:17
  51:     0x7f175d58055a - <unknown>
  52:     0x7f175d5fda3c - <unknown>
  53:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: it seems that this compiler `1.78.0-nightly (9c3ad802d 2024-03-07)` is outdated, a newer nightly should have been released in the mean time
  |
  = note: please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists
  = note: if the problem still persists, 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 attach the file at `/home/matthias/im4/rustc-ice-2024-03-09T00_10_22-810197.txt` to your bug report

query stack during panic:
thread panicked while processing panic. aborting.
[1]    810197 IOT instruction  rustc ice.rs

@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 Mar 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 9, 2024
@matthiaskrgr
Copy link
Member Author

cc @oli-obk @lcnr stacktrace seems to be different from #122098

@oli-obk
Copy link
Contributor

oli-obk commented Mar 9, 2024

Yea, these will just happen in random places in the compiler, but are the same issue

@oli-obk oli-obk closed this as completed Mar 9, 2024
@matthiaskrgr
Copy link
Member Author

@oli-obk
Copy link
Contributor

oli-obk commented Mar 9, 2024

Highly likely

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 9, 2024
# for free to join this conversation on GitHub. Already have an account? # 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

4 participants