Skip to content

ICE Unable to verify registry association / !worker_thread.is_null() #151226

@matthiaskrgr

Description

@matthiaskrgr

Code

with -Zthreads=2

use std:sync:OnceLock
struct WeakOnce< T >(OnceLock< Self >)
static ONCE : WeakOnce< Context >  
struct Context;

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (503745e91 2026-01-16)
binary: rustc
commit-hash: 503745e9170b40841611aaaa634641edffd00b29
commit-date: 2026-01-16
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

Error output

thread 'rustc query cycle handler' (3937314) panicked at /rustc-dev/503745e9170b40841611aaaa634641edffd00b29/compiler/rustc_data_structures/src/sync/worker_local.rs:28:51:
Unable to verify registry association
stack backtrace:
   0:     0x7f1c54c417e3 - <<std[6d36f9ba992b6832]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[3d2156d5e39e5feb]::fmt::Display>::fmt
   1:     0x7f1c5520e248 - core[3d2156d5e39e5feb]::fmt::write
   2:     0x7f1c54c581d6 - <std[6d36f9ba992b6832]::sys::stdio::unix::Stderr as std[6d36f9ba992b6832]::io::Write>::write_fmt
   3:     0x7f1c54c17858 - std[6d36f9ba992b6832]::panicking::default_hook::{closure#0}
   4:     0x7f1c54c34f13 - std[6d36f9ba992b6832]::panicking::default_hook
   5:     0x7f1c53c096ba - std[6d36f9ba992b6832]::panicking::update_hook::<alloc[50e5b2f088044279]::boxed::Box<rustc_driver_impl[cc36a22c668daecf]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1c54c351f2 - std[6d36f9ba992b6832]::panicking::panic_with_hook
   7:     0x7f1c54c1794a - std[6d36f9ba992b6832]::panicking::panic_handler::{closure#0}
   8:     0x7f1c54c0be59 - std[6d36f9ba992b6832]::sys::backtrace::__rust_end_short_backtrace::<std[6d36f9ba992b6832]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f1c54c193ed - __rustc[ba822077cedc0708]::rust_begin_unwind
  10:     0x7f1c5205666c - core[3d2156d5e39e5feb]::panicking::panic_fmt
  11:     0x7f1c52d7273a - rustc_data_structures[fc0e59b3c48140ab]::outline::<<rustc_data_structures[fc0e59b3c48140ab]::sync::worker_local::RegistryId>::verify::{closure#1}, usize>
  12:     0x7f1c55216e28 - rustc_query_impl[98b58b56d6576428]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[98b58b56d6576428]::query_impl::generics_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9166020e8cee7914]::query::erase::Erased<[u8; 8usize]>>
  13:     0x7f1c55217405 - rustc_query_system[cdd3a9722b25439b]::query::plumbing::try_execute_query::<rustc_query_impl[98b58b56d6576428]::DynamicConfig<rustc_query_system[cdd3a9722b25439b]::query::caches::DefIdCache<rustc_middle[9166020e8cee7914]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[98b58b56d6576428]::plumbing::QueryCtxt, false>
  14:     0x7f1c5521712b - rustc_query_impl[98b58b56d6576428]::query_impl::generics_of::get_query_non_incr::__rust_end_short_backtrace
  15:     0x7f1c56643eb4 - <rustc_middle[9166020e8cee7914]::ty::print::pretty::FmtPrinter as rustc_middle[9166020e8cee7914]::ty::print::Printer>::print_def_path
  16:     0x7f1c56647e88 - <rustc_middle[9166020e8cee7914]::ty::print::pretty::FmtPrinter as rustc_middle[9166020e8cee7914]::ty::print::pretty::PrettyPrinter>::pretty_print_type
  17:     0x7f1c56647bac - <rustc_middle[9166020e8cee7914]::ty::Ty as core[3d2156d5e39e5feb]::fmt::Display>::fmt
  18:     0x7f1c5520e248 - core[3d2156d5e39e5feb]::fmt::write
  19:     0x7f1c5520e0ab - alloc[50e5b2f088044279]::fmt::format::format_inner
  20:     0x7f1c5424fdad - rustc_middle[9166020e8cee7914]::query::descs::layout_of
  21:     0x7f1c5461e749 - rustc_query_impl[98b58b56d6576428]::plumbing::create_query_frame::<rustc_middle[9166020e8cee7914]::ty::PseudoCanonicalInput<rustc_middle[9166020e8cee7914]::ty::Ty>>
  22:     0x7f1c5473e230 - <rustc_query_impl[98b58b56d6576428]::query_impl::layout_of::collect_active_jobs::{closure#0} as core[3d2156d5e39e5feb]::ops::function::FnOnce<(rustc_middle[9166020e8cee7914]::ty::context::TyCtxt, rustc_middle[9166020e8cee7914]::ty::PseudoCanonicalInput<rustc_middle[9166020e8cee7914]::ty::Ty>)>>::call_once
  23:     0x7f1c54600f92 - <rustc_query_system[cdd3a9722b25439b]::query::plumbing::QueryState<rustc_middle[9166020e8cee7914]::ty::PseudoCanonicalInput<rustc_middle[9166020e8cee7914]::ty::Ty>>>::collect_active_jobs::<rustc_middle[9166020e8cee7914]::ty::context::TyCtxt>
  24:     0x7f1c546a9061 - rustc_query_impl[98b58b56d6576428]::query_impl::layout_of::collect_active_jobs
  25:     0x7f1c546bcbdf - <rustc_query_impl[98b58b56d6576428]::plumbing::QueryCtxt as rustc_query_system[cdd3a9722b25439b]::query::QueryContext>::collect_active_jobs
  26:     0x7f1c53c0200c - std[6d36f9ba992b6832]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2164ba223c61a5e9]::util::run_in_thread_pool_with_globals<rustc_interface[2164ba223c61a5e9]::interface::run_compiler<(), rustc_driver_impl[cc36a22c668daecf]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#4}::{closure#1}, ()>
  27:     0x7f1c53c0d607 - <std[6d36f9ba992b6832]::thread::lifecycle::spawn_unchecked<rustc_interface[2164ba223c61a5e9]::util::run_in_thread_pool_with_globals<rustc_interface[2164ba223c61a5e9]::interface::run_compiler<(), rustc_driver_impl[cc36a22c668daecf]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#4}::{closure#1}, ()>::{closure#1} as core[3d2156d5e39e5feb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7f1c56276338 - <std[6d36f9ba992b6832]::sys::thread::unix::Thread>::new::thread_start
  29:     0x7f1c4fc9698b - <unknown>
  30:     0x7f1c4fd1a9cc - <unknown>
  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 `/tmp/im/rustc-ice-2026-01-16T20_45_59-3937308.txt` to your bug report

note: rustc 1.94.0-nightly (503745e91 2026-01-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=2

query stack during panic:
panicked at /rustc-dev/503745e9170b40841611aaaa634641edffd00b29/compiler/rustc_thread_pool/src/registry.rs:622:5:
assertion failed: !worker_thread.is_null()
thread panicked while processing panic. aborting.
[1]    3937308 IOT instruction  ~/.rustup/toolchains/master/bin/rustc code.rs -Zthreads=2
Backtrace

<backtrace>

Metadata

Metadata

Assignees

Labels

A-parallel-compilerArea: parallel compilerC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions