Skip to content

error: cached cgu 0x4a9cmec5w3kmvnwylp7mwkt should have an object file, but doesn't #145800

@styris-ame

Description

@styris-ame

Code

Medium sized project, not willing to share source yet unless necessary.

Meta

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-pc-windows-msvc
release: 1.86.0
LLVM version: 19.1.7

Output

   Compiling server v0.1.0 (<redacted>\server)
                                                                                                                                                                                                                                                                               
thread 'coordinator' panicked at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb\compiler\rustc_codegen_ssa\src\back\write.rs:1680:29:
/rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb\compiler\rustc_codegen_ssa\src\back\write.rs:1680:29: worker thread panicked
stack backtrace:
   0:     0x7ff8cf3c17b1 - std::backtrace_rs::backtrace::win64::trace                                                                                                                                                                                                          
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff8cf3c17b1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff8cf3c17b1 - std::sys::backtrace::_print_fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:66
   3:     0x7ff8cf3c17b1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:39
   4:     0x7ff8cf3f52ba - core::fmt::rt::Argument::fmt
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\rt.rs:177
   5:     0x7ff8cf3f52ba - core::fmt::write
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\fmt\mod.rs:1449
   6:     0x7ff8cf3b7537 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\io\mod.rs:1890
   7:     0x7ff8cf3c15f5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\backtrace.rs:42
   8:     0x7ff8cf3c4520 - std::panicking::default_hook::closure$0
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:298
   9:     0x7ff8cf3c4311 - std::panicking::default_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:325
  10:     0x7ff8d0a7764f - core[379ed1e85498c8da]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[954f94a5540fbc1c]::Level, &str), usize), <((rustc_lint_defs[954f94a5540fbc1c]::Level, &str), usize) as core[379ed1e85498c8da]::cmp::PartialOrd>::lt>
  11:     0x7ff8cf3c51ae - alloc::boxed::impl$30::call
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\alloc\src\boxed.rs:1990
  12:     0x7ff8cf3c51ae - std::panicking::rust_panic_with_hook
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:839
  13:     0x7ff8d202a5df - <thin_vec[f396fd4f20b7dac0]::IntoIter<_> as core[379ed1e85498c8da]::ops::drop::Drop>::drop::drop_non_singleton::<rustc_ast[c3f8aaeb00705b92]::ast::MetaItemInner>
  14:     0x7ff8d2025249 - std[69e129e0dd256456]::sys::backtrace::__rust_end_short_backtrace::<std[69e129e0dd256456]::panicking::begin_panic<alloc[a10a1d58def73cb3]::string::String>::{closure#0}, !>
  15:     0x7ff8d2023ca5 - std[69e129e0dd256456]::panicking::begin_panic::<alloc[a10a1d58def73cb3]::string::String>                                                                                                                                                            
  16:     0x7ff8d20b464d - rustc_middle[1d335a5a6b4a971a]::util::bug::span_bug_fmt::<rustc_span[feb426b5f536fd7b]::span_encoding::Span>
  17:     0x7ff8d209732d - <rustc_middle[1d335a5a6b4a971a]::ty::consts::Const>::to_value
  18:     0x7ff8d2097146 - <rustc_middle[1d335a5a6b4a971a]::ty::consts::Const>::to_value
  19:     0x7ff8d20b4582 - rustc_middle[1d335a5a6b4a971a]::util::bug::bug_fmt
  20:     0x7ff8cf496d5a - <hashbrown[67c73ad48ff13bc7]::raw::RawTable<((&rustc_codegen_llvm[4e49be572b39c358]::llvm::ffi::Metadata, usize), &rustc_codegen_llvm[4e49be572b39c358]::llvm::ffi::Metadata)>>::reserve_rehash::<hashbrown[67c73ad48ff13bc7]::map::make_hasher<(&rustc_codegen_llvm[4e49be572b39c358]::llvm::ffi::Metadata, usize), &rustc_codegen_llvm[4e49be572b39c358]::llvm::ffi::Metadata, rustc_hash[365057f31201c45d]::FxBuildHasher>::{closure#0}>
  21:     0x7ff8cc05ba8d - RINvNtNtCs95AQCFfcpgw_3std3sys9backtrace28___rust_begin_short_backtraceNCINvXs0_Cs6IIYRg17ok6_18rustc_codegen_llvmNtB1g_18LlvmCodegenBackendNtNtNtCs1Aqswxtw8Zq_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2k_4back5wr
  22:     0x7ff8cc066488 - RINvNtNtNtNtCs4M45Py2ANNS_4core5slice4sort6stable9quicksort9quicksortTNtNtCsdPcZrWPtBQZ_5alloc6string6StringB16_ENCINvMNtB1a_5sliceSB15_7sort_byNCINvXs1g_NtNtNtB1a_11collections5btree3mapINtB2s_8BTreeMapB16_B16_EINtNtNtNtBa_4iter6traits7collect12FromIterat
  23:     0x7ff8cf3d656d - alloc::boxed::impl$28::call_once
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\alloc\src\boxed.rs:1976
  24:     0x7ff8cf3d656d - alloc::boxed::impl$28::call_once
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\alloc\src\boxed.rs:1976
  25:     0x7ff8cf3d656d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\sys\pal\windows\thread.rs:56
  26:     0x7ff98987e8d7 - BaseThreadInitThunk
  27:     0x7ff98a6bbf6c - RtlUserThreadStart                                                                                                                                                                                                                                  

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: rustc 1.86.0 (05f9846f8 2025-03-31) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: cached cgu 0x4a9cmec5w3kmvnwylp7mwkt should have an object file, but doesn't

Note that the "cgu" identifier stays consistent across compilations ( 0x4a9cmec5w3kmvnwylp7mwkt).

Running cargo clean and then re-compiling solved the issue. Note that I am using RustRover as my IDE, though compiling directly with cargo build made no difference. I'll leave a new comment on this issue if I can recreate it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-threadArea: `std::thread`C-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.T-libsRelevant to the library 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