Repository navigation
Closed
Closed
Copy link
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationA-parallel-compilerArea: parallel compilerArea: parallel compilerC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-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 issueT-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.
Description
Code
compile with -Zquery-dep-graph -Zthreads=4 -Cincremental=/tmp/ -Zincremental-verify-ich=yes --edition=2024 --crate-type lib
This will sometimes ICE, around 1/10 times for me
pub trait Associate {
type Associated;
}
pub struct Wrap<'a> {
pub field: &'a i32,
}
pub trait Create<T> {
fn create() -> Self;
}
pub fn oh_no<'a, T>()
where
Wrap<'a>: Associate,
<Wrap<'a> as Associate>::Associated: Create<T>,
{
<Wrap<'a> as Associate>::Associated::create();
}
pub fn main() {}Meta
rustc --version --verbose:
rustc 1.89.0-nightly (c57119b9a 2025-06-07)
binary: rustc
commit-hash: c57119b9a1c86968188bb9703a7859c17f8bc71c
commit-date: 2025-06-07
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Error output
thread 'rustc' panicked at compiler/rustc_query_system/src/dep_graph/query.rs:31:49:
index out of bounds: the len is 122 but the index is 523
stack backtrace:
0: 0x724e3390ef53 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::haf62842818d14700
1: 0x724e34002cb7 - core::fmt::write::hcbc7f51ba008f803
2: 0x724e33904c63 - std::io::Write::write_fmt::hae893cdefa15425e
3: 0x724e3390edb2 - std::sys::backtrace::BacktraceLock::print::ha054f106f07b7628
4: 0x724e3391299a - std::panicking::default_hook::{{closure}}::h7f764cabab3db86e
5: 0x724e3391251f - std::panicking::default_hook::h014d489547013991
6: 0x724e32a14343 - std[c475a882e07ae63]::panicking::update_hook::<alloc[81a84acdd818619f]::boxed::Box<rustc_driver_impl[521b9eae2fc4e103]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x724e33913203 - std::panicking::rust_panic_with_hook::h09797f209f5eff9b
8: 0x724e33912efa - std::panicking::begin_panic_handler::{{closure}}::h9e770369565c83a5
9: 0x724e3390f429 - std::sys::backtrace::__rust_end_short_backtrace::h74b6f9a68b0bb61f
10: 0x724e33912bcd - __rustc[68e581a04d2baff0]::rust_begin_unwind
11: 0x724e30076700 - core::panicking::panic_fmt::hd3bdf9865accc11f
12: 0x724e3209d3a3 - core::panicking::panic_bounds_check::h9cebfb3d6917ee12
13: 0x724e334494c4 - <rustc_query_system[5096c0469bfd6733]::dep_graph::query::DepGraphQuery>::push
14: 0x724e33303e56 - rustc_data_structures[48b81750ed2870a8]::outline::<<rustc_query_system[5096c0469bfd6733]::dep_graph::serialized::EncoderState<rustc_middle[ecaecb1147c2deb2]::dep_graph::DepsType>>::record<<rustc_query_system[5096c0469bfd6733]::dep_graph::serialized::EncoderState<rustc_middle[ecaecb1147c2deb2]::dep_graph::DepsType>>::encode_promoted_node::{closure#0}>::{closure#0}, ()>
15: 0x724e34462911 - <rustc_query_system[5096c0469bfd6733]::dep_graph::graph::DepGraphData<rustc_middle[ecaecb1147c2deb2]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[70af034b9e771977]::plumbing::QueryCtxt>
16: 0x724e34da5136 - <rustc_query_system[5096c0469bfd6733]::dep_graph::graph::DepGraphData<rustc_middle[ecaecb1147c2deb2]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[70af034b9e771977]::plumbing::QueryCtxt>
17: 0x724e34d9bd1d - rustc_query_system[5096c0469bfd6733]::query::plumbing::ensure_must_run::<rustc_query_impl[70af034b9e771977]::DynamicConfig<rustc_query_system[5096c0469bfd6733]::query::caches::SingleCache<rustc_middle[ecaecb1147c2deb2]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[70af034b9e771977]::plumbing::QueryCtxt>
18: 0x724e3546ef1e - rustc_query_impl[70af034b9e771977]::query_impl::proc_macro_decls_static::get_query_incr::__rust_end_short_backtrace
19: 0x724e32e0733d - rayon_core[7170aa47ed7daee8]::scope::scope::<rustc_data_structures[48b81750ed2870a8]::sync::parallel::scope<rustc_interface[bbfabb48a2aa6e29]::passes::run_required_analyses::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, rustc_data_structures[48b81750ed2870a8]::marker::FromDyn<()>>::{closure#0}
20: 0x724e342b9a48 - rustc_interface[bbfabb48a2aa6e29]::passes::analysis
21: 0x724e342b8c75 - rustc_query_impl[70af034b9e771977]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[70af034b9e771977]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ecaecb1147c2deb2]::query::erase::Erased<[u8; 0usize]>>
22: 0x724e35532e82 - rustc_query_system[5096c0469bfd6733]::query::plumbing::try_execute_query::<rustc_query_impl[70af034b9e771977]::DynamicConfig<rustc_query_system[5096c0469bfd6733]::query::caches::SingleCache<rustc_middle[ecaecb1147c2deb2]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[70af034b9e771977]::plumbing::QueryCtxt, true>
23: 0x724e355327a3 - rustc_query_impl[70af034b9e771977]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
24: 0x724e354f603f - rustc_interface[bbfabb48a2aa6e29]::passes::create_and_enter_global_ctxt::<core[c83a95fd3175649b]::option::Option<rustc_interface[bbfabb48a2aa6e29]::queries::Linker>, rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
25: 0x724e35345b70 - rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler::<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}
26: 0x724e32a28d94 - <rayon_core[7170aa47ed7daee8]::job::StackJob<rayon_core[7170aa47ed7daee8]::latch::LatchRef<rayon_core[7170aa47ed7daee8]::latch::LockLatch>, <rayon_core[7170aa47ed7daee8]::registry::Registry>::in_worker_cold<<rayon_core[7170aa47ed7daee8]::thread_pool::ThreadPool>::install<rustc_interface[bbfabb48a2aa6e29]::util::run_in_thread_pool_with_globals<rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[7170aa47ed7daee8]::job::Job>::execute
27: 0x724e3252f01e - <rayon_core[7170aa47ed7daee8]::registry::WorkerThread>::wait_until_cold
28: 0x724e3252c9a1 - <rayon_core[7170aa47ed7daee8]::registry::ThreadBuilder>::run
29: 0x724e32a0a8bd - std[c475a882e07ae63]::sys::backtrace::__rust_begin_short_backtrace::<<rayon_core[7170aa47ed7daee8]::ThreadPoolBuilder>::build_scoped<rustc_interface[bbfabb48a2aa6e29]::util::run_in_thread_pool_with_globals<rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[bbfabb48a2aa6e29]::util::run_in_thread_pool_with_globals<rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
30: 0x724e32a19862 - <<std[c475a882e07ae63]::thread::Builder>::spawn_unchecked_<<rayon_core[7170aa47ed7daee8]::ThreadPoolBuilder>::build_scoped<rustc_interface[bbfabb48a2aa6e29]::util::run_in_thread_pool_with_globals<rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[bbfabb48a2aa6e29]::util::run_in_thread_pool_with_globals<rustc_interface[bbfabb48a2aa6e29]::interface::run_compiler<(), rustc_driver_impl[521b9eae2fc4e103]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#1} as core[c83a95fd3175649b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x724e352a62bd - std::sys::pal::unix::thread::Thread::new::thread_start::h44a4c2b992fd9536
32: 0x724e2eca57eb - <unknown>
33: 0x724e2ed2918c - <unknown>
34: 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 `/tmp/glacier2/fixed/rustc-ice-2025-06-07T09_54_25-2892720.txt` to your bug report
note: compiler flags: -Z query-dep-graph -Z threads=4 -C incremental=[REDACTED] -Z incremental-verify-ich=yes --crate-type lib
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
Backtrace
<backtrace>
Metadata
Metadata
Assignees
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationA-parallel-compilerArea: parallel compilerArea: parallel compilerC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-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 issueT-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.
Activity
cyrgani commentedon Jun 8, 2025
simpler, but still only occuring spuriously:
commands:
zetanumbers commentedon Sep 10, 2025
If you remove
-Cincrementaloption rustc will give you another ICE on unwrap at:rust/compiler/rustc_query_system/src/dep_graph/graph.rs
Line 811 in c57119b
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.ywxt commentedon Nov 10, 2025
Even compiling a hello world, there is another panic while printing query stack. But this needs a bunch to reproduce. (over 1000 times here)
zetanumbers commentedon Dec 11, 2025
Due to my suspicions of this issue being related to #141540 I have reproduced this bug a bunch of times on f520900 and found that
mir_drops_elaborated_and_const_checkedregularly shows up in the backtrace.zetanumbers commentedon Dec 13, 2025
Bisects to 3ef8e64 (aka #139758). Not unexpected really.
petrochenkov commentedon Feb 13, 2026
Minimal fix is in #152590.
Rollup merge of rust-lang#152590 - petrochenkov:skipedge, r=mati865
Rollup merge of rust-lang#152590 - petrochenkov:skipedge, r=mati865
Unrolled build for #152590
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865
Rollup merge of #152590 - petrochenkov:skipedge, r=mati865