Repository navigation
ICE compiler/rustc_query_system/src/dep_graph/query.rs index out of bounds #142152
Description
Activity
- addedI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.C-bugCategory: This is a bug.Category: This is a bug.
on Jun 7, 2025 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jun 7, 2025 - addedA-incr-compArea: Incremental compilationArea: Incremental compilationA-parallel-compilerArea: parallel compilerArea: parallel compiler
on Jun 7, 2025 - removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jun 7, 2025 simpler, but still only occuring spuriously:
trait Associate { type Associated; } // not necessary, but increases the probability of causing the ice struct Wrap<'a> { field: &'a i32, } fn main() {}
commands:
rm -rf incr/ rustc src/main.rs -Zquery-dep-graph -Zthreads=2 -Cincremental=incr/ rustc src/main.rs -Zquery-dep-graph -Zthreads=2 -Cincremental=incr/- addedS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issue
on Jun 8, 2025 If you remove
-Cincrementaloption rustc will give you another ICE on unwrap at:let dep_node_debug = &self.data.as_ref().unwrap().dep_node_debug; This is due to
-Zdump-dep-graphoption not being enabled (idk how this should be fixed tho). If you add that flag instead, this issue will no longer reproduce. It means bug could be related to program's (i.e. compiler's) memory ordering or other logic when panic happens, if such scenario was not thought through.As such I would like to see if it can be reproduced with both
-Zdump-dep-graphand-Zquery-dep-graphset. I guess this is the testcase to include into #143953.Even compiling a hello world, there is another panic while printing query stack. But this needs a bunch to reproduce. (over 1000 times here)
thread 'rustc' (1211095) panicked at compiler/rustc_query_system/src/dep_graph/query.rs:31:49: index out of bounds: the len is 1044 but the index is 1045 stack backtrace: 0: 0x7a7e43075243 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h275e909084b1a684 1: 0x7a7e43801afc - core::fmt::write::hf760d67cf9b2da55 2: 0x7a7e43029e33 - std::io::Write::write_fmt::h46e65fbc1f072ebd 3: 0x7a7e4303b442 - std::sys::backtrace::BacktraceLock::print::heeffa864a4cc6853 4: 0x7a7e430415d9 - std::panicking::default_hook::{{closure}}::ha1187c52840bb77a 5: 0x7a7e43041103 - std::panicking::default_hook::h3597edaf39d86724 6: 0x7a7e42031341 - std[c0ce55412202fb59]::panicking::update_hook::<alloc[4123f12742ba7419]::boxed::Box<rustc_driver_impl[5cfea032dd4e7986]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x7a7e430419fb - std::panicking::panic_with_hook::h0e9397ed55f9ce63 8: 0x7a7e430417ba - std::panicking::panic_handler::{{closure}}::h047060a714057723 9: 0x7a7e4303b579 - std::sys::backtrace::__rust_end_short_backtrace::h8057a932be1ba9ec 10: 0x7a7e4301c16d - __rustc[459dbf790511d39a]::rust_begin_unwind 11: 0x7a7e400ce4c0 - core::panicking::panic_fmt::h84c50daa2269b357 12: 0x7a7e3fc11a6d - core::panicking::panic_bounds_check::hc2dcd07fa2cc71d7 13: 0x7a7e42b46cf3 - <rustc_query_system[b561d73868fa1e34]::dep_graph::query::DepGraphQuery>::push 14: 0x7a7e429f4116 - rustc_data_structures[469c5225820d4653]::outline::<<rustc_query_system[b561d73868fa1e34]::dep_graph::serialized::EncoderState<rustc_middle[a62e1c9468295d17]::dep_graph::DepsType>>::record<<rustc_query_system[b561d73868fa1e34]::dep_graph::serialized::EncoderState<rustc_middle[a62e1c9468295d17]::dep_graph::DepsType>>::encode_promoted_node::{closure#0}>::{closure#0}, ()> 15: 0x7a7e4382e70c - <rustc_query_system[b561d73868fa1e34]::dep_graph::graph::DepGraphData<rustc_middle[a62e1c9468295d17]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[322b07c669eb3743]::plumbing::QueryCtxt> 16: 0x7a7e4382dee2 - <rustc_query_system[b561d73868fa1e34]::dep_graph::graph::DepGraphData<rustc_middle[a62e1c9468295d17]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[322b07c669eb3743]::plumbing::QueryCtxt> 17: 0x7a7e4439eaf3 - rustc_query_system[b561d73868fa1e34]::query::plumbing::try_execute_query::<rustc_query_impl[322b07c669eb3743]::DynamicConfig<rustc_query_system[b561d73868fa1e34]::query::caches::DefaultCache<(rustc_middle[a62e1c9468295d17]::ty::instance::Instance, rustc_middle[a62e1c9468295d17]::mir::mono::CollectionMode), rustc_middle[a62e1c9468295d17]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[322b07c669eb3743]::plumbing::QueryCtxt, true> 18: 0x7a7e4439d35b - rustc_query_impl[322b07c669eb3743]::query_impl::items_of_instance::get_query_incr::__rust_end_short_backtrace 19: 0x7a7e443989b1 - rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_items_rec::{closure#0} 20: 0x7a7e44399b3e - rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_items_rec 21: 0x7a7e43b31eef - rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_crate_mono_items::{closure#1}::{closure#0} 22: 0x7a7e42881065 - rustc_data_structures[469c5225820d4653]::sync::parallel::par_slice::par_rec::<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, rustc_data_structures[469c5225820d4653]::sync::parallel::par_for_each_in<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, alloc[4123f12742ba7419]::vec::Vec<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem>, rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> 23: 0x7a7e4288a1f7 - <rustc_thread_pool[4ae909ee64d2dd56]::job::StackJob<rustc_thread_pool[4ae909ee64d2dd56]::latch::SpinLatch, rustc_thread_pool[4ae909ee64d2dd56]::join::join_context<rustc_thread_pool[4ae909ee64d2dd56]::join::join::call<(), rustc_data_structures[469c5225820d4653]::sync::parallel::par_slice::par_rec<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, rustc_data_structures[469c5225820d4653]::sync::parallel::par_for_each_in<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, alloc[4123f12742ba7419]::vec::Vec<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem>, rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}>::{closure#0}, rustc_thread_pool[4ae909ee64d2dd56]::join::join::call<(), rustc_data_structures[469c5225820d4653]::sync::parallel::par_slice::par_rec<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, rustc_data_structures[469c5225820d4653]::sync::parallel::par_for_each_in<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem, alloc[4123f12742ba7419]::vec::Vec<rustc_middle[a62e1c9468295d17]::mir::mono::MonoItem>, rustc_monomorphize[abedb7dce80f5aa9]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>::{closure#2}>::{closure#0}, (), ()>::{closure#0}::{closure#0}, ()> as rustc_thread_pool[4ae909ee64d2dd56]::job::Job>::execute 24: 0x7a7e42d4c22f - <rustc_thread_pool[4ae909ee64d2dd56]::registry::WorkerThread>::wait_or_steal_until_cold 25: 0x7a7e42d4acd1 - <rustc_thread_pool[4ae909ee64d2dd56]::registry::ThreadBuilder>::run 26: 0x7a7e4202936d - std[c0ce55412202fb59]::sys::backtrace::__rust_begin_short_backtrace::<<rustc_thread_pool[4ae909ee64d2dd56]::ThreadPoolBuilder>::build_scoped<rustc_interface[575b60d3cd400129]::util::run_in_thread_pool_with_globals<rustc_interface[575b60d3cd400129]::interface::run_compiler<(), rustc_driver_impl[5cfea032dd4e7986]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[575b60d3cd400129]::util::run_in_thread_pool_with_globals<rustc_interface[575b60d3cd400129]::interface::run_compiler<(), rustc_driver_impl[5cfea032dd4e7986]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()> 27: 0x7a7e42034332 - <<std[c0ce55412202fb59]::thread::Builder>::spawn_unchecked_<<rustc_thread_pool[4ae909ee64d2dd56]::ThreadPoolBuilder>::build_scoped<rustc_interface[575b60d3cd400129]::util::run_in_thread_pool_with_globals<rustc_interface[575b60d3cd400129]::interface::run_compiler<(), rustc_driver_impl[5cfea032dd4e7986]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[575b60d3cd400129]::util::run_in_thread_pool_with_globals<rustc_interface[575b60d3cd400129]::interface::run_compiler<(), rustc_driver_impl[5cfea032dd4e7986]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#1} as core[968b6d0815caf745]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 28: 0x7a7e449146af - std::sys::thread::unix::Thread::new::thread_start::h897ae72f919a9cf9 29: 0x7a7e3e09caa4 - start_thread at ./nptl/pthread_create.c:447:8 30: 0x7a7e3e129c6c - clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0 31: 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 `/root/rust/reproducible/rustc-ice-2025-11-10T03_49_04-1211092.txt` to your bug report note: compiler flags: -Z query-dep-graph -Z threads=8 -C incremental=[REDACTED] query stack during panic: panicked at /rustc-dev/6647be93640686a2a443a49f15c3390b68c8b5dd/compiler/rustc_query_system/src/dep_graph/serialized.rs:875:43: thread panicked while processing panic. aborting.Minimal fix is in #152590.
- added a commit that references this issue
on Feb 14, 2026 - added 2 commits that reference this issue
on Feb 16, 2026 - added a commit that references this issue
on Aug 7, 2026
Code
compile with
-Zquery-dep-graph -Zthreads=4 -Cincremental=/tmp/ -Zincremental-verify-ich=yes --edition=2024 --crate-type libThis will sometimes ICE, around 1/10 times for me
Meta
rustc --version --verbose:Error output
Backtrace