Skip to content
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

trait_impls_of does not have an unique index (DepKind variant: 166) #139110

Open
kornelski opened this issue Mar 29, 2025 · 11 comments · May be fixed by #139410
Open

trait_impls_of does not have an unique index (DepKind variant: 166) #139110

kornelski opened this issue Mar 29, 2025 · 11 comments · May be fixed by #139410
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kornelski
Copy link
Contributor

kornelski commented Mar 29, 2025

I occasionally get a corrupted target directory:

thread 'rustc' panicked at /rustc/920d95eaf23d7eb6b415d09868e4f793024fa604/compiler/rustc_query_system/src/dep_graph/serialized.rs:260:21:
Error: A dep graph node (trait_impls_of) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 166 }(edc9942d4bc9e683-29b7d5f0f789d82)
stack backtrace:
   0:        0x1108599e4 - std::backtrace::Backtrace::create::h23b6908fc40e125e
   1:        0x10ea09454 - std[54631d7a81de9e90]::panicking::update_hook::<alloc[898041eeb075be66]::boxed::Box<rustc_driver_impl[cbe3ee50a9b64982]::install_ice_hook::{closure#1}>>::{closure#0}
   2:        0x11087499c - std::panicking::rust_panic_with_hook::h6e33d145b73c56b6
   3:        0x110874590 - std::panicking::begin_panic_handler::{{closure}}::h1b530e3befd00369
   4:        0x110871f80 - std::sys::backtrace::__rust_end_short_backtrace::h08b2dd416eec9a36
   5:        0x110874258 - __rustc[30d06caa1ba95d]::rust_begin_unwind
   6:        0x1134cd77c - core::panicking::panic_fmt::ha09de3336dfd93b2
   7:        0x10f1669ec - rustc_incremental[b6678e5139e06e3a]::persist::load::setup_dep_graph
   8:        0x10e9b51b8 - rustc_interface[21db00968683b297]::passes::create_and_enter_global_ctxt::<core[edc9942d4bc9e683]::option::Option<rustc_interface[21db00968683b297]::queries::Linker>, rustc_driver_impl[cbe3ee50a9b64982]::run_compiler::{closure#0}::{closure#2}>
   9:        0x10ea06098 - rustc_interface[21db00968683b297]::interface::run_compiler::<(), rustc_driver_impl[cbe3ee50a9b64982]::run_compiler::{closure#0}>::{closure#1}
  10:        0x10ea2f4d4 - <rayon_core[ea3f96dfc7cd810e]::job::StackJob<rayon_core[ea3f96dfc7cd810e]::latch::LatchRef<rayon_core[ea3f96dfc7cd810e]::latch::LockLatch>, <rayon_core[ea3f96dfc7cd810e]::registry::Registry>::in_worker_cold<<rayon_core[ea3f96dfc7cd810e]::thread_pool::ThreadPool>::install<rustc_interface[21db00968683b297]::util::run_in_thread_pool_with_globals<rustc_interface[21db00968683b297]::interface::run_compiler<(), rustc_driver_impl[cbe3ee50a9b64982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[ea3f96dfc7cd810e]::job::Job>::execute
  11:        0x1134df5c4 - <rayon_core[ea3f96dfc7cd810e]::registry::WorkerThread>::wait_until_cold
  12:        0x10e0738d8 - <rayon_core[ea3f96dfc7cd810e]::registry::ThreadBuilder>::run
  13:        0x10ea0d4e4 - <<crossbeam_utils[32e36cdb49266747]::thread::ScopedThreadBuilder>::spawn<<rayon_core[ea3f96dfc7cd810e]::ThreadPoolBuilder>::build_scoped<rustc_interface[21db00968683b297]::util::run_in_thread_pool_with_globals<rustc_interface[21db00968683b297]::interface::run_compiler<(), rustc_driver_impl[cbe3ee50a9b64982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[21db00968683b297]::util::run_in_thread_pool_with_globals<rustc_interface[21db00968683b297]::interface::run_compiler<(), rustc_driver_impl[cbe3ee50a9b64982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[edc9942d4bc9e683]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  14:        0x10e9f6270 - std[54631d7a81de9e90]::sys::backtrace::__rust_begin_short_backtrace::<alloc[898041eeb075be66]::boxed::Box<dyn core[edc9942d4bc9e683]::ops::function::FnOnce<(), Output = ()> + core[edc9942d4bc9e683]::marker::Send>, ()>
  15:        0x10ea0c534 - <<std[54631d7a81de9e90]::thread::Builder>::spawn_unchecked_<alloc[898041eeb075be66]::boxed::Box<dyn core[edc9942d4bc9e683]::ops::function::FnOnce<(), Output = ()> + core[edc9942d4bc9e683]::marker::Send>, ()>::{closure#1} as core[edc9942d4bc9e683]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:        0x110878a30 - std::sys::pal::unix::thread::Thread::new::thread_start::hc32cbdf418fc6461
  17:        0x1805e5c0c - __pthread_cond_wait


rustc version: 1.87.0-nightly (920d95eaf 2025-03-28)
platform: aarch64-apple-darwin
compiler flags: --crate-type lib -C opt-level=1 -C embed-bitcode=no -C debuginfo=line-tables-only -C split-debuginfo=unpacked -C debug-assertions=on -C incremental=[REDACTED] -Z incremental-verify-ich

I have -Zincremental-verify-ich set, but it doesn't seem to change anything.

@kornelski kornelski 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 Mar 29, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 29, 2025
@chrisp60
Copy link

A workaround

[build]
incremental = false

in a cargo config file (.cargo/config.toml) seems to have stopped the ICE AFAICT. Obviously you lose the incremental compiles with this and YMMV.

ICE

I get two flavors of ICE on

rustc version: 1.88.0-nightly (fedf10752 2025-03-30)
platform: x86_64-unknown-linux-gnu

These may be the same thing but I don't know enough about the compiler to know.

(typeck)

thread 'rustc' panicked at /rustc/fedf10752b973d83f3f7c0f819b2659c21a634de/compiler/rustc_query_system/src/dep_graph/serialized.rs:260:21:
Error: A dep graph node (typeck) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 115 }(4b585227064a590f-bca258bdd40b4fe2)
stack backtrace:
   0:     0x7fbe668bf965 - std::backtrace::Backtrace::create::hae8cd07af8e3eb50
   1:     0x7fbe64c670d5 - std::backtrace::Backtrace::force_capture::h9e9cd991c43af287
   2:     0x7fbe63ce9165 - std[bdc4cefc0c032e43]::panicking::update_hook::<alloc[a4260201fb21f0fa]::boxed::Box<rustc_driver_impl[a82370bbe3079b02]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7fbe64c80953 - std::panicking::rust_panic_with_hook::hfdc1820ccce7abc1
   4:     0x7fbe64c8064a - std::panicking::begin_panic_handler::{{closure}}::ha3c57f7f9cd4a645
   5:     0x7fbe64c7cc59 - std::sys::backtrace::__rust_end_short_backtrace::h62980f074dfdc3c0
   6:     0x7fbe64c8030d - __rustc[4b29ef8afbe75c0e]::rust_begin_unwind
   7:     0x7fbe61694070 - core::panicking::panic_fmt::ha1280724b00965e5
   8:     0x7fbe6655eb4c - rustc_incremental[62a4779807b35765]::persist::load::setup_dep_graph
   9:     0x7fbe6652e6cd - rustc_interface[4b6516d07ac6860f]::interface::run_compiler::<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}
  10:     0x7fbe63cfff7b - <rayon_core[fc32e3c5f2258128]::job::StackJob<rayon_core[fc32e3c5f2258128]::latch::LatchRef<rayon_core[fc32e3c5f2258128]::latch::LockLatch>, <rayon_core[fc32e3c5f2258128]::registry::Registry>::in_worker_cold<<rayon_core[fc32e3c5f2258128]::thread_pool::ThreadPool>::install<rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[fc32e3c5f2258128]::job::Job>::execute
  11:     0x7fbe637c232e - <rayon_core[fc32e3c5f2258128]::registry::WorkerThread>::wait_until_cold
  12:     0x7fbe637bfc3b - <rayon_core[fc32e3c5f2258128]::registry::ThreadBuilder>::run
  13:     0x7fbe63cf066a - <<crossbeam_utils[2aaef6c0d3fef0ac]::thread::ScopedThreadBuilder>::spawn<<rayon_core[fc32e3c5f2258128]::ThreadPoolBuilder>::build_scoped<rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[e80f784d23167c2e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  14:     0x7fbe63cddf8e - std[bdc4cefc0c032e43]::sys::backtrace::__rust_begin_short_backtrace::<alloc[a4260201fb21f0fa]::boxed::Box<dyn core[e80f784d23167c2e]::ops::function::FnOnce<(), Output = ()> + core[e80f784d23167c2e]::marker::Send>, ()>
  15:     0x7fbe63cf012a - <<std[bdc4cefc0c032e43]::thread::Builder>::spawn_unchecked_<alloc[a4260201fb21f0fa]::boxed::Box<dyn core[e80f784d23167c2e]::ops::function::FnOnce<(), Output = ()> + core[e80f784d23167c2e]::marker::Send>, ()>::{closure#1} as core[e80f784d23167c2e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:     0x7fbe66389937 - std::sys::pal::unix::thread::Thread::new::thread_start::h36ad1309f224e2da
  17:     0x7fbe6026bac3 - <unknown>
  18:     0x7fbe602fd850 - <unknown>
  19:                0x0 - <unknown>


rustc version: 1.88.0-nightly (fedf10752 2025-03-30)
platform: x86_64-unknown-linux-gnu

(trait_impls_of)

thread 'rustc' panicked at /rustc/fedf10752b973d83f3f7c0f819b2659c21a634de/compiler/rustc_query_system/src/dep_graph/serialized.rs:260:21:
Error: A dep graph node (trait_impls_of) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 166 }(e80f784d23167c2e-a2cbb16cbd8c89e8)
stack backtrace:
   0:     0x7ff68f8bf965 - std::backtrace::Backtrace::create::hae8cd07af8e3eb50
   1:     0x7ff68dc670d5 - std::backtrace::Backtrace::force_capture::h9e9cd991c43af287
   2:     0x7ff68cce9165 - std[bdc4cefc0c032e43]::panicking::update_hook::<alloc[a4260201fb21f0fa]::boxed::Box<rustc_driver_impl[a82370bbe3079b02]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7ff68dc80953 - std::panicking::rust_panic_with_hook::hfdc1820ccce7abc1
   4:     0x7ff68dc8064a - std::panicking::begin_panic_handler::{{closure}}::ha3c57f7f9cd4a645
   5:     0x7ff68dc7cc59 - std::sys::backtrace::__rust_end_short_backtrace::h62980f074dfdc3c0
   6:     0x7ff68dc8030d - __rustc[4b29ef8afbe75c0e]::rust_begin_unwind
   7:     0x7ff68a694070 - core::panicking::panic_fmt::ha1280724b00965e5
   8:     0x7ff68f55eb4c - rustc_incremental[62a4779807b35765]::persist::load::setup_dep_graph
   9:     0x7ff68f52e6cd - rustc_interface[4b6516d07ac6860f]::interface::run_compiler::<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}
  10:     0x7ff68ccfff7b - <rayon_core[fc32e3c5f2258128]::job::StackJob<rayon_core[fc32e3c5f2258128]::latch::LatchRef<rayon_core[fc32e3c5f2258128]::latch::LockLatch>, <rayon_core[fc32e3c5f2258128]::registry::Registry>::in_worker_cold<<rayon_core[fc32e3c5f2258128]::thread_pool::ThreadPool>::install<rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[fc32e3c5f2258128]::job::Job>::execute
  11:     0x7ff68c7c232e - <rayon_core[fc32e3c5f2258128]::registry::WorkerThread>::wait_until_cold
  12:     0x7ff68c7bfc3b - <rayon_core[fc32e3c5f2258128]::registry::ThreadBuilder>::run
  13:     0x7ff68ccf066a - <<crossbeam_utils[2aaef6c0d3fef0ac]::thread::ScopedThreadBuilder>::spawn<<rayon_core[fc32e3c5f2258128]::ThreadPoolBuilder>::build_scoped<rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[4b6516d07ac6860f]::util::run_in_thread_pool_with_globals<rustc_interface[4b6516d07ac6860f]::interface::run_compiler<(), rustc_driver_impl[a82370bbe3079b02]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[e80f784d23167c2e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  14:     0x7ff68ccddf8e - std[bdc4cefc0c032e43]::sys::backtrace::__rust_begin_short_backtrace::<alloc[a4260201fb21f0fa]::boxed::Box<dyn core[e80f784d23167c2e]::ops::function::FnOnce<(), Output = ()> + core[e80f784d23167c2e]::marker::Send>, ()>
  15:     0x7ff68ccf012a - <<std[bdc4cefc0c032e43]::thread::Builder>::spawn_unchecked_<alloc[a4260201fb21f0fa]::boxed::Box<dyn core[e80f784d23167c2e]::ops::function::FnOnce<(), Output = ()> + core[e80f784d23167c2e]::marker::Send>, ()>::{closure#1} as core[e80f784d23167c2e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:     0x7ff68f389937 - std::sys::pal::unix::thread::Thread::new::thread_start::h36ad1309f224e2da
  17:     0x7ff68926bac3 - <unknown>
  18:     0x7ff6892fd850 - <unknown>
  19:                0x0 - <unknown>


rustc version: 1.88.0-nightly (fedf10752 2025-03-30)
platform: x86_64-unknown-linux-gnu

@tmstorey
Copy link

tmstorey commented Apr 1, 2025

I've been getting a similar error on Windows x64:

thread 'rustc' panicked at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55\compiler\rustc_query_system\src\dep_graph\serialized.rs:260:21:
Error: A dep graph node (trait_impls_of) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 166 }(6951cc9ce47704a6-3723e95b5d4c7895)
stack backtrace:
   0:     0x7ff83936446e - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff83936446e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff83936446e - std::backtrace::Backtrace::create
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\backtrace.rs:331
   3:     0x7ff8393643aa - std::backtrace::Backtrace::force_capture
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\backtrace.rs:312
   4:     0x7ff83aa50b36 - core[6951cc9ce47704a6]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize), <((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize) as core[6951cc9ce47704a6]::cmp::PartialOrd>::lt>
   5:     0x7ff839381e6e - std::panicking::rust_panic_with_hook
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:841
   6:     0x7ff839381bc9 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:706
   7:     0x7ff83937db4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\sys\backtrace.rs:168
   8:     0x7ff8393817ce - std::panicking::begin_panic_handler
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:697
   9:     0x7ff83c4743d1 - core::panicking::panic_fmt
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\core\src\panicking.rs:75
  10:     0x7ff83a4b1f0a - rustc_incremental[b7595be64ccdf815]::persist::load::setup_dep_graph
  11:     0x7ff835cb29f1 - RINvNtNtCselrSTJIniB3_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgCoHrkcJ3cc_5alloc5boxed3BoxDINtNtNtCs92C1Pe9IPd2_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECshzA
  12:     0x7ff83aa6ac3d - <tracing_subscriber[2e6612e46ceaac8c]::util::TryInitError as core[6951cc9ce47704a6]::fmt::Display>::fmt
  13:     0x7ff83c4574d7 - <rayon_core[98aefc99d1ce6059]::registry::WorkerThread>::wait_until_cold
  14:     0x7ff83c453f3c - <rayon_core[98aefc99d1ce6059]::registry::ThreadBuilder>::run
  15:     0x7ff83aa57c81 - core[6951cc9ce47704a6]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize), <((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize) as core[6951cc9ce47704a6]::cmp::PartialOrd>::lt>
  16:     0x7ff83aa43bfd - std[a718a81f2920886b]::sys::backtrace::__rust_begin_short_backtrace::<alloc[c1935ac82f55411a]::boxed::Box<dyn core[6951cc9ce47704a6]::ops::function::FnOnce<(), Output = ()> + core[6951cc9ce47704a6]::marker::Send>, ()>
  17:     0x7ff83aa57493 - core[6951cc9ce47704a6]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize), <((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize) as core[6951cc9ce47704a6]::cmp::PartialOrd>::lt>
  18:     0x7ff839386cad - alloc::boxed::impl$28::call_once
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\alloc\src\boxed.rs:1966
  19:     0x7ff839386cad - alloc::boxed::impl$28::call_once
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\alloc\src\boxed.rs:1966
  20:     0x7ff839386cad - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\sys\pal\windows\thread.rs:56
  21:     0x7ff8e9a37374 - BaseThreadInitThunk
  22:     0x7ff8eb57cc91 - RtlUserThreadStart


rustc version: 1.87.0-nightly (3f5502370 2025-03-27)
platform: x86_64-pc-windows-msvc

@compiler-errors
Copy link
Member

cc @Zoxc #138629

@Zoxc
Copy link
Contributor

Zoxc commented Apr 2, 2025

Could you try having -Zincremental-verify-ich on every build after a cargo clean? That is supposed to catch this sooner.

@Zoxc
Copy link
Contributor

Zoxc commented Apr 3, 2025

Could you also see if it reproduces with nightly-2025-03-25 (which includes #138629 but not #138824) and this branch which just adds this check without any other recent change to the incremental system?

@chrisp60
Copy link

chrisp60 commented Apr 3, 2025

@Zoxc I turned on incremental compiles again for my workday, I should be able to try out various configs throughout the day as time allows.

I will start with nightly 2025-04-02, putting together any ICE that comes along, attempting to hit the versions you mentioned.

Is setting the following in my .cargo/config.toml the correct way to introduce these flags?

[build]
rustflags = [
  "-Clink-arg=-fuse-ld=mold",    # I assume unrelated
  "-Zthreads=8",                 # I assume unrelated
  "-Zincremental-verify-ich",
]
incremental = true

At least anecdotally, I don't remember seeing these issues much before nightly-2025-03-25, but I am just going off memory. I can try it out though and post back.

@jvdwrf
Copy link

jvdwrf commented Apr 4, 2025

For my builds, I am getting the issue with trait_impls_of very consistently when using nightly-2025-03-28 but haven't had it yet with nightly-2025-03-25.

@chrisp60
Copy link

chrisp60 commented Apr 4, 2025

@Zoxc Here are some results of the tests you requested

I do not know how to instruct the compiler to use a specific branch as it's toolchain. But, if it would help, I can figure it out.

AFAICT I did not see any changes from enabling the incremental-verify-ich flag, always possible that I am configuring it incorrectly though.

In summary (TLDR)

  • 8ish hours of development using nightly-03-25: no ICE
  • All nightly versions following: ICE almost immediately when any edits are made.

ICE (all produced similar results, regardless of nightly version or incremental-verify-ich flag).

Just putting these two here as all others were the same (except for memory addresses, versions, etc).

thread 'rustc' panicked at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/compiler/rustc_query_system/src/dep_graph/serialized.rs:260:21:
Error: A dep graph node (typeck) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 116 }(1d209962578a5295-cd1c7c99a4e3a42e)
stack backtrace:
   0:     0x7f257e4c2225 - std::backtrace::Backtrace::create::h4673396f9b64f746
   1:     0x7f257c857f95 - std::backtrace::Backtrace::force_capture::he5345f147017f839
   2:     0x7f257b8e981f - std[11d1cbc04f31de61]::panicking::update_hook::<alloc[b854695d616648d1]::boxed::Box<rustc_driver_impl[30725cf523bc588e]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7f257c871a03 - std::panicking::rust_panic_with_hook::h2947a1eef4d16370
   4:     0x7f257c8716fa - std::panicking::begin_panic_handler::{{closure}}::h965a5276f65cdfd8
   5:     0x7f257c86dd19 - std::sys::backtrace::__rust_end_short_backtrace::he5ecad4245441128
   6:     0x7f257c8713bd - __rustc[d03900b93b55ae64]::rust_begin_unwind
   7:     0x7f25792a19c0 - core::panicking::panic_fmt::h185128184dece584
   8:     0x7f257e245554 - rustc_incremental[ebb4693b73fb20de]::persist::load::setup_dep_graph
   9:     0x7f257e14e4cd - rustc_interface[83a6f685120d9f35]::interface::run_compiler::<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}
  10:     0x7f257b9007db - <rayon_core[2c98653a724eac3a]::job::StackJob<rayon_core[2c98653a724eac3a]::latch::LatchRef<rayon_core[2c98653a724eac3a]::latch::LockLatch>, <rayon_core[2c98653a724eac3a]::registry::Registry>::in_worker_cold<<rayon_core[2c98653a724eac3a]::thread_pool::ThreadPool>::install<rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[2c98653a724eac3a]::job::Job>::execute
  11:     0x7f257b3c751e - <rayon_core[2c98653a724eac3a]::registry::WorkerThread>::wait_until_cold
  12:     0x7f257b3c4e2b - <rayon_core[2c98653a724eac3a]::registry::ThreadBuilder>::run
  13:     0x7f257b8f12aa - <<crossbeam_utils[35cc4efa95fb6007]::thread::ScopedThreadBuilder>::spawn<<rayon_core[2c98653a724eac3a]::ThreadPoolBuilder>::build_scoped<rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[2546ea2b789cb766]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  14:     0x7f257b8de6fe - std[11d1cbc04f31de61]::sys::backtrace::__rust_begin_short_backtrace::<alloc[b854695d616648d1]::boxed::Box<dyn core[2546ea2b789cb766]::ops::function::FnOnce<(), Output = ()> + core[2546ea2b789cb766]::marker::Send>, ()>
  15:     0x7f257b8f0d6a - <<std[11d1cbc04f31de61]::thread::Builder>::spawn_unchecked_<alloc[b854695d616648d1]::boxed::Box<dyn core[2546ea2b789cb766]::ops::function::FnOnce<(), Output = ()> + core[2546ea2b789cb766]::marker::Send>, ()>::{closure#1} as core[2546ea2b789cb766]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:     0x7f257df95c6b - std::sys::pal::unix::thread::Thread::new::thread_start::h08488c36460e4e66
  17:     0x7f2577e6bac3 - <unknown>
  18:     0x7f2577efd850 - <unknown>
  19:                0x0 - <unknown>


rustc version: 1.88.0-nightly (d5b4c2e4f 2025-04-02)
platform: x86_64-unknown-linux-gnu
thread 'rustc' panicked at /rustc/d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df/compiler/rustc_query_system/src/dep_graph/serialized.rs:260:21:
Error: A dep graph node (trait_impls_of) does not have an unique index. Running a clean build on a nightly compiler with `-Z incremental-verify-ich` can help narrow down the issue for reporting. A clean build may also work around the issue.

                     DepNode: DepKind { variant: 168 }(2546ea2b789cb766-4143b3fff6fd7203)
stack backtrace:
   0:     0x7f12ddcc2225 - std::backtrace::Backtrace::create::h4673396f9b64f746
   1:     0x7f12dc057f95 - std::backtrace::Backtrace::force_capture::he5345f147017f839
   2:     0x7f12db0e981f - std[11d1cbc04f31de61]::panicking::update_hook::<alloc[b854695d616648d1]::boxed::Box<rustc_driver_impl[30725cf523bc588e]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7f12dc071a03 - std::panicking::rust_panic_with_hook::h2947a1eef4d16370
   4:     0x7f12dc0716fa - std::panicking::begin_panic_handler::{{closure}}::h965a5276f65cdfd8
   5:     0x7f12dc06dd19 - std::sys::backtrace::__rust_end_short_backtrace::he5ecad4245441128
   6:     0x7f12dc0713bd - __rustc[d03900b93b55ae64]::rust_begin_unwind
   7:     0x7f12d8aa19c0 - core::panicking::panic_fmt::h185128184dece584
   8:     0x7f12dda45554 - rustc_incremental[ebb4693b73fb20de]::persist::load::setup_dep_graph
   9:     0x7f12dd94e4cd - rustc_interface[83a6f685120d9f35]::interface::run_compiler::<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}
  10:     0x7f12db1007db - <rayon_core[2c98653a724eac3a]::job::StackJob<rayon_core[2c98653a724eac3a]::latch::LatchRef<rayon_core[2c98653a724eac3a]::latch::LockLatch>, <rayon_core[2c98653a724eac3a]::registry::Registry>::in_worker_cold<<rayon_core[2c98653a724eac3a]::thread_pool::ThreadPool>::install<rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rayon_core[2c98653a724eac3a]::job::Job>::execute
  11:     0x7f12dabc751e - <rayon_core[2c98653a724eac3a]::registry::WorkerThread>::wait_until_cold
  12:     0x7f12dabc4e2b - <rayon_core[2c98653a724eac3a]::registry::ThreadBuilder>::run
  13:     0x7f12db0f12aa - <<crossbeam_utils[35cc4efa95fb6007]::thread::ScopedThreadBuilder>::spawn<<rayon_core[2c98653a724eac3a]::ThreadPoolBuilder>::build_scoped<rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[83a6f685120d9f35]::util::run_in_thread_pool_with_globals<rustc_interface[83a6f685120d9f35]::interface::run_compiler<(), rustc_driver_impl[30725cf523bc588e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#3}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[2546ea2b789cb766]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  14:     0x7f12db0de6fe - std[11d1cbc04f31de61]::sys::backtrace::__rust_begin_short_backtrace::<alloc[b854695d616648d1]::boxed::Box<dyn core[2546ea2b789cb766]::ops::function::FnOnce<(), Output = ()> + core[2546ea2b789cb766]::marker::Send>, ()>
  15:     0x7f12db0f0d6a - <<std[11d1cbc04f31de61]::thread::Builder>::spawn_unchecked_<alloc[b854695d616648d1]::boxed::Box<dyn core[2546ea2b789cb766]::ops::function::FnOnce<(), Output = ()> + core[2546ea2b789cb766]::marker::Send>, ()>::{closure#1} as core[2546ea2b789cb766]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  16:     0x7f12dd795c6b - std::sys::pal::unix::thread::Thread::new::thread_start::h08488c36460e4e66
  17:     0x7f12d766bac3 - <unknown>
  18:     0x7f12d76fd850 - <unknown>
  19:                0x0 - <unknown>


rustc version: 1.88.0-nightly (d5b4c2e4f 2025-04-02)
platform: x86_64-unknown-linux-gnu

Dev setup that I use

  • Neovim w/ Mason & nvim lsp-config
  • using bacon to watch for changes. The exact job I use is below.
[jobs.bind]
command = ["cargo", "test", "export_bindings"] # generates typescript files using ts_rs crate
need_stdout = true
allow_warnings = true
on_success = "job:run"

[jobs.run]
command = ["cargo", "run", "--quiet", "--", "serve"] # runs an axum server
need_stdout = true
allow_warnings = true
background = false
on_change_strategy = "kill_then_restart"

Maybe the fact that bacon and the LSP are compiling at the same time influences it?

@Zoxc
Copy link
Contributor

Zoxc commented Apr 4, 2025

It seems likely that #138824 would be the PR introducing this error. It would be helpful to have a reproduction in case that PR does not introduce the root cause here. If you have a codebase that can be shared, starting from clean slate and building different commits could be a decent way to reproduce it.

@chrisp60
Copy link

chrisp60 commented Apr 4, 2025

It seems likely that #138824 would be the PR introducing this error. It would be helpful to have a reproduction in case that PR does not introduce the root cause here. If you have a codebase that can be shared, starting from clean slate and building different commits could be a decent way to reproduce it.

If I have time over the weekend, I can attempt to make a minimal reproduction as a shareable repo. Would be nice see this resolved.

Thank you all for the help in this matter!

@Zoxc
Copy link
Contributor

Zoxc commented Apr 5, 2025

I see an issue in #138824 where a query can be marked green an get a node assigned, then executed later and get another node assigned. That's probably the cause of this issue.

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) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants