Skip to content

[ICE]: !worker_thread.is_null() #151358

@matthiaskrgr

Description

@matthiaskrgr

Code

use std::num::NonZero;
fn main() {
    NonZero();
    format!("{}", 0);
}

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (0a3cd3b6b 2026-01-18)
binary: rustc
commit-hash: 0a3cd3b6b6e1fa8fd3c75c1d13d2e22e64273f49
commit-date: 2026-01-18
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Error output

rustc code.rs -Zthreads=2

<output>
Backtrace

thread 'rustc query cycle handler' (3275753) panicked at /rustc-dev/0a3cd3b6b6e1fa8fd3c75c1d13d2e22e64273f49/compiler/rustc_thread_pool/src/registry.rs:622:5:
assertion failed: !worker_thread.is_null()
stack backtrace:
   0:     0x7ff0d0e04693 - <<std[2f6e50ec0c8b9745]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[da33e28f739cfb7b]::fmt::Display>::fmt
   1:     0x7ff0d1409416 - core[da33e28f739cfb7b]::fmt::write
   2:     0x7ff0d0e1b086 - <std[2f6e50ec0c8b9745]::sys::stdio::unix::Stderr as std[2f6e50ec0c8b9745]::io::Write>::write_fmt
   3:     0x7ff0d0dda6c8 - std[2f6e50ec0c8b9745]::panicking::default_hook::{closure#0}
   4:     0x7ff0d0df7dc3 - std[2f6e50ec0c8b9745]::panicking::default_hook
   5:     0x7ff0cfddfcea - std[2f6e50ec0c8b9745]::panicking::update_hook::<alloc[4a7fd02e7796445d]::boxed::Box<rustc_driver_impl[76286615d137f620]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7ff0d0df80a2 - std[2f6e50ec0c8b9745]::panicking::panic_with_hook
   7:     0x7ff0d0dda7ba - std[2f6e50ec0c8b9745]::panicking::panic_handler::{closure#0}
   8:     0x7ff0d0dcec19 - std[2f6e50ec0c8b9745]::sys::backtrace::__rust_end_short_backtrace::<std[2f6e50ec0c8b9745]::panicking::panic_handler::{closure#0}, !>
   9:     0x7ff0d0ddc25d - __rustc[88c6a30cf430ade2]::rust_begin_unwind
  10:     0x7ff0cd8cf76c - core[da33e28f739cfb7b]::panicking::panic_fmt
  11:     0x7ff0cd5e2862 - core[da33e28f739cfb7b]::panicking::panic
  12:     0x7ff0d07be5a4 - <rustc_query_system[3fbf686053611ad7]::query::job::QueryLatch>::wait_on::<rustc_query_impl[44e5bb6bcee378f9]::plumbing::QueryCtxt>
  13:     0x7ff0d16fb3ee - rustc_query_system[3fbf686053611ad7]::query::plumbing::try_execute_query::<rustc_query_impl[44e5bb6bcee378f9]::DynamicConfig<rustc_data_structures[e27548a25accd315]::vec_cache::VecCache<rustc_span[bd6736dd76f04e02]::def_id::LocalDefId, rustc_middle[222e27930462787b]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[3fbf686053611ad7]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[44e5bb6bcee378f9]::plumbing::QueryCtxt, false>
  14:     0x7ff0d16fae0b - rustc_query_impl[44e5bb6bcee378f9]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace
  15:     0x7ff0d1a024d4 - rustc_query_impl[44e5bb6bcee378f9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[44e5bb6bcee378f9]::query_impl::def_span::dynamic_query::{closure#2}::{closure#0}, rustc_middle[222e27930462787b]::query::erase::Erased<[u8; 8usize]>>
  16:     0x7ff0d1416a05 - rustc_query_system[3fbf686053611ad7]::query::plumbing::try_execute_query::<rustc_query_impl[44e5bb6bcee378f9]::DynamicConfig<rustc_query_system[3fbf686053611ad7]::query::caches::DefIdCache<rustc_middle[222e27930462787b]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[44e5bb6bcee378f9]::plumbing::QueryCtxt, false>
  17:     0x7ff0d141666d - rustc_query_impl[44e5bb6bcee378f9]::query_impl::def_span::get_query_non_incr::__rust_end_short_backtrace
  18:     0x7ff0d045ed4a - <rustc_type_ir[5ecac172d71a4854]::binder::Binder<rustc_middle[222e27930462787b]::ty::context::TyCtxt, rustc_type_ir[5ecac172d71a4854]::predicate::TraitRef<rustc_middle[222e27930462787b]::ty::context::TyCtxt>> as rustc_middle[222e27930462787b]::query::keys::Key>::default_span
  19:     0x7ff0d07d083d - rustc_query_impl[44e5bb6bcee378f9]::plumbing::create_query_frame::<rustc_span[bd6736dd76f04e02]::def_id::LocalDefId>
  20:     0x7ff0d08ecddb - <rustc_query_impl[44e5bb6bcee378f9]::query_impl::local_def_id_to_hir_id::collect_active_jobs::{closure#0} as core[da33e28f739cfb7b]::ops::function::FnOnce<(rustc_middle[222e27930462787b]::ty::context::TyCtxt, rustc_span[bd6736dd76f04e02]::def_id::LocalDefId)>>::call_once
  21:     0x7ff0d07cb247 - <rustc_query_system[3fbf686053611ad7]::query::plumbing::QueryState<rustc_hir_id[4b10733f70ce9e73]::OwnerId>>::collect_active_jobs::<rustc_middle[222e27930462787b]::ty::context::TyCtxt>
  22:     0x7ff0d0859111 - rustc_query_impl[44e5bb6bcee378f9]::query_impl::local_def_id_to_hir_id::collect_active_jobs
  23:     0x7ff0d08856bf - <rustc_query_impl[44e5bb6bcee378f9]::plumbing::QueryCtxt as rustc_query_system[3fbf686053611ad7]::query::QueryContext>::collect_active_jobs
  24:     0x7ff0cfdd8d0c - std[2f6e50ec0c8b9745]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e0d26bc9a9756595]::util::run_in_thread_pool_with_globals<rustc_interface[e0d26bc9a9756595]::interface::run_compiler<(), rustc_driver_impl[76286615d137f620]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#4}::{closure#1}, ()>
  25:     0x7ff0cfde4b07 - <std[2f6e50ec0c8b9745]::thread::lifecycle::spawn_unchecked<rustc_interface[e0d26bc9a9756595]::util::run_in_thread_pool_with_globals<rustc_interface[e0d26bc9a9756595]::interface::run_compiler<(), rustc_driver_impl[76286615d137f620]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#4}::{closure#1}, ()>::{closure#1} as core[da33e28f739cfb7b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7ff0d251b244 - <std[2f6e50ec0c8b9745]::sys::thread::unix::Thread>::new::thread_start
  27:     0x7ff0cbe9698b - <unknown>
  28:     0x7ff0cbf1a9cc - <unknown>
  29:                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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-01-19T06_20_54-3275732.txt` to your bug report

note: rustc 1.95.0-nightly (0a3cd3b6b 2026-01-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=2

query stack during panic:
#0 [def_span] looking up span for `Default`
end of query stack
internal compiler error: query cycle handler thread panicked, aborting process
[1]    3275732 IOT instruction  rustc code.rs -Zthreads=2

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) ❄️I-cycleIssue: A query cycle occurred while none was expectedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions