Skip to content

ICE: Could not send CguMessage to main thread #142949

@matthiaskrgr

Description

@matthiaskrgr

Code

a.rs -Zthreads=16 --crate-type lib --crate-type lib -Zvalidate-mir -Zdump-mir-dir=.

struct Struct<const N: i128>(pub [u8; 0xffff_ffff_ffff_ffff]);

pub fn function(value: Struct<3>) -> u8 {
    value.0[0]
}

Meta

rustc --version --verbose:

rustc 1.90.0-nightly (99b18d6c5 2025-06-24)
binary: rustc
commit-hash: 99b18d6c5062449db8e7ccded4cb69b555a239c3
commit-date: 2025-06-24
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.7

Error output

warning: type `Struct<3>` is more private than the item `function`
 --> a.rs:3:1
  |
3 | pub fn function(value: Struct<3>) -> u8 {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `function` is reachable at visibility `pub`
  |
note: but type `Struct<3>` is only usable at visibility `pub(crate)`
 --> a.rs:1:1
  |
1 | struct Struct<const N: i128>(pub [u8; 0xffff_ffff_ffff_ffff]);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: `#[warn(private_interfaces)]` on by default

error: values of the type `[u8; usize::MAX]` are too big for the target architecture
 --> a.rs:3:1
  |
3 | pub fn function(value: Struct<3>) -> u8 {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Backtrace

thread 'coordinator' panicked at /rustc-dev/99b18d6c5062449db8e7ccded4cb69b555a239c3/compiler/rustc_codegen_ssa/src/back/write.rs:1433:29:
Could not send CguMessage to main thread
stack backtrace:
   0:     0x73e8412cf203 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd16dd633b7f0977e
   1:     0x73e841a02bbf - core::fmt::write::h9621e15ea792376d
   2:     0x73e8412c4d23 - std::io::Write::write_fmt::h94dbab40d96a28b4
   3:     0x73e8412cf062 - std::sys::backtrace::BacktraceLock::print::hc29ffc6ff4687cdc
   4:     0x73e8412d2b5a - std::panicking::default_hook::{{closure}}::hb6d24b19ccfe35fb
   5:     0x73e8412d26df - std::panicking::default_hook::he929fa00101e4b1e
   6:     0x73e8403c8943 - std[c4c4933846e5fd47]::panicking::update_hook::<alloc[f0d7daf1040a573]::boxed::Box<rustc_driver_impl[9d9b63371f3171ef]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x73e8412d33ab - std::panicking::rust_panic_with_hook::hd504a00a671b2b68
   8:     0x73e8412d3076 - std::panicking::begin_panic_handler::{{closure}}::he157fe70f68afea0
   9:     0x73e8412cf6d9 - std::sys::backtrace::__rust_end_short_backtrace::hbed553694310df02
  10:     0x73e8412d2d8d - __rustc[76ded839a860affe]::rust_begin_unwind
  11:     0x73e83da8ff70 - core::panicking::panic_fmt::h966c438309618b0b
  12:     0x73e842b2e462 - rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::start_executing_work::<rustc_codegen_llvm[f2b75115c50e902a]::LlvmCodegenBackend>::{closure#5}
  13:     0x73e842b2c741 - std[c4c4933846e5fd47]::sys::backtrace::__rust_begin_short_backtrace::<<rustc_codegen_llvm[f2b75115c50e902a]::LlvmCodegenBackend as rustc_codegen_ssa[c1bf781222dd7f7e]::traits::backend::ExtraBackendMethods>::spawn_named_thread<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::start_executing_work<rustc_codegen_llvm[f2b75115c50e902a]::LlvmCodegenBackend>::{closure#5}, core[bcfc66ea1d71dd16]::result::Result<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::CompiledModules, ()>>::{closure#0}, core[bcfc66ea1d71dd16]::result::Result<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::CompiledModules, ()>>
  14:     0x73e842c48d85 - <<std[c4c4933846e5fd47]::thread::Builder>::spawn_unchecked_<<rustc_codegen_llvm[f2b75115c50e902a]::LlvmCodegenBackend as rustc_codegen_ssa[c1bf781222dd7f7e]::traits::backend::ExtraBackendMethods>::spawn_named_thread<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::start_executing_work<rustc_codegen_llvm[f2b75115c50e902a]::LlvmCodegenBackend>::{closure#5}, core[bcfc66ea1d71dd16]::result::Result<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::CompiledModules, ()>>::{closure#0}, core[bcfc66ea1d71dd16]::result::Result<rustc_codegen_ssa[c1bf781222dd7f7e]::back::write::CompiledModules, ()>>::{closure#1} as core[bcfc66ea1d71dd16]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  15:     0x73e842c467bd - std::sys::pal::unix::thread::Thread::new::thread_start::h2aa965a7eb0636e5
  16:     0x73e83c6a57eb - <unknown>
  17:     0x73e83c72918c - <unknown>
  18:                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-2025-06-24T04_48_36-758556.txt` to your bug report

note: compiler flags: -Z threads=16 --crate-type lib --crate-type lib -Z validate-mir -Z dump-mir-dir=.

query stack during panic:
end of query stack
error: aborting due to 1 previous error; 1 warning emitted

Metadata

Metadata

Assignees

No one assigned

    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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions