Skip to content

internal compiler error: cstore_impl.rs:698:32: uninterned StableCrateId: StableCrateId(0) #14572

Open
@flyingmutant

Description

@flyingmutant

Summary

Running cargo clippy on a private project, I've got

error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:698:32: uninterned StableCrateId: StableCrateId(0)

<backtrace>

query stack during panic:
#0 [def_span] looking up span for `main`
#1 [entry_fn] looking up the entry function of a crate
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
note: Clippy version: clippy 0.1.86 (05f9846f89 2025-03-31)

there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 def_span(at1_agent[ff28]::main)
end of try_mark_green dep node stack
error: could not compile `at1_agent` (lib test)

Problem happens rarely and does not reproduce consistently.

Version

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-unknown-linux-gnu
release: 1.86.0
LLVM version: 19.1.7

Error output

Backtrace

thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:698:32:
Box<dyn Any>
stack backtrace:
 0:     0xe8ae49c4de60 - std::backtrace_rs::backtrace::libunwind::trace::h5a314f6f44ff5e34
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
 1:     0xe8ae49c4de60 - std::backtrace_rs::backtrace::trace_unsynchronized::h3dcd841efd088552
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
 2:     0xe8ae49c4de60 - std::sys::backtrace::_print_fmt::hcc2a45776caa467d
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:66:9
 3:     0xe8ae49c4de60 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hb2a43d0c7729d3ed
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:39:26
 4:     0xe8ae470ce714 - core::fmt::rt::Argument::fmt::hf2df9f80222bc4f4
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/fmt/rt.rs:177:76
 5:     0xe8ae470ce714 - core::fmt::write::h1d49cd3d24cca042
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/fmt/mod.rs:1449:21
 6:     0xe8ae49c43c48 - std::io::Write::write_fmt::h8c1433405b406d1a
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/io/mod.rs:1890:15
 7:     0xe8ae49c4dd20 - std::sys::backtrace::BacktraceLock::print::h46591f8d4fa2df59
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:42:9
 8:     0xe8ae49c4fed4 - std::panicking::default_hook::{{closure}}::h7d209d9851f5330d
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:298:22
 9:     0xe8ae49c4fd30 - std::panicking::default_hook::h0fcf455e69951211
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:325:9
10:     0xe8ae48f810a8 - std[35d4cec575854488]::panicking::update_hook::<alloc[e853fd47d4533b9c]::boxed::Box<rustc_driver_impl[f5f4742c5c4c0cc6]::install_ice_hook::{closure#1}>>::{closure#0}
11:     0xe8ae49c50a5c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7137efcdb5889e40
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/alloc/src/boxed.rs:1990:9
12:     0xe8ae49c50a5c - std::panicking::rust_panic_with_hook::h1c18c15d711594e4
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:839:13
13:     0xe8ae48fb6154 - std[35d4cec575854488]::panicking::begin_panic::<rustc_errors[6fc004f8e5f55627]::ExplicitBug>::{closure#0}
14:     0xe8ae48fac924 - std[35d4cec575854488]::sys::backtrace::__rust_end_short_backtrace::<std[35d4cec575854488]::panicking::begin_panic<rustc_errors[6fc004f8e5f55627]::ExplicitBug>::{closure#0}, !>
15:     0xe8ae48fa91ec - std[35d4cec575854488]::panicking::begin_panic::<rustc_errors[6fc004f8e5f55627]::ExplicitBug>
16:     0xe8ae48fbe9fc - <rustc_errors[6fc004f8e5f55627]::diagnostic::BugAbort as rustc_errors[6fc004f8e5f55627]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
17:     0xe8ae494d088c - rustc_middle[4ef0a599f320642a]::util::bug::opt_span_bug_fmt::<rustc_span[d730d412cf122864]::span_encoding::Span>::{closure#0}
18:     0xe8ae494bb8b8 - rustc_middle[4ef0a599f320642a]::ty::context::tls::with_opt::<rustc_middle[4ef0a599f320642a]::util::bug::opt_span_bug_fmt<rustc_span[d730d412cf122864]::span_encoding::Span>::{closure#0}, !>::{closure#0}
19:     0xe8ae494bb72c - rustc_middle[4ef0a599f320642a]::ty::context::tls::with_context_opt::<rustc_middle[4ef0a599f320642a]::ty::context::tls::with_opt<rustc_middle[4ef0a599f320642a]::util::bug::opt_span_bug_fmt<rustc_span[d730d412cf122864]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
20:     0xe8ae47cd4810 - rustc_middle[4ef0a599f320642a]::util::bug::bug_fmt
21:     0xe8ae47f70f5c - <rustc_query_system[2916b46b63a66511]::dep_graph::dep_node::DepNode as rustc_middle[4ef0a599f320642a]::dep_graph::dep_node::DepNodeExt>::extract_def_id
22:     0xe8ae47f6ebdc - rustc_query_impl[3a2e535b9c873a5e]::plumbing::force_from_dep_node::<rustc_query_impl[3a2e535b9c873a5e]::DynamicConfig<rustc_data_structures[9ec33fa0e07ed1b1]::vec_cache::VecCache<rustc_span[d730d412cf122864]::def_id::LocalDefId, rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[2916b46b63a66511]::dep_graph::graph::DepNodeIndex>, false, false, false>>
23:     0xe8ae47f6ebac - <rustc_query_impl[3a2e535b9c873a5e]::plumbing::query_callback<rustc_query_impl[3a2e535b9c873a5e]::query_impl::local_def_id_to_hir_id::QueryType>::{closure#0} as core[cb75fe34ca8113ae]::ops::function::FnOnce<(rustc_middle[4ef0a599f320642a]::ty::context::TyCtxt, rustc_query_system[2916b46b63a66511]::dep_graph::dep_node::DepNode)>>::call_once
24:     0xe8ae476a5490 - <rustc_query_system[2916b46b63a66511]::dep_graph::graph::DepGraphData<rustc_middle[4ef0a599f320642a]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[3a2e535b9c873a5e]::plumbing::QueryCtxt>
25:     0xe8ae4769fe8c - rustc_query_system[2916b46b63a66511]::query::plumbing::try_execute_query::<rustc_query_impl[3a2e535b9c873a5e]::DynamicConfig<rustc_query_system[2916b46b63a66511]::query::caches::DefIdCache<rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3a2e535b9c873a5e]::plumbing::QueryCtxt, true>
26:     0xe8ae4769dc20 - rustc_query_impl[3a2e535b9c873a5e]::query_impl::def_span::get_query_incr::__rust_end_short_backtrace
27:     0xe8ae47e2bba8 - rustc_middle[4ef0a599f320642a]::query::plumbing::query_get_at::<rustc_query_system[2916b46b63a66511]::query::caches::DefIdCache<rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 8usize]>>>
28:     0xe8ae47e180b0 - rustc_passes[707f7092a50cdd50]::entry::entry_fn
29:     0xe8ae47bdb0dc - rustc_query_impl[3a2e535b9c873a5e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3a2e535b9c873a5e]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 12usize]>>
30:     0xe8ae4860559c - rustc_query_system[2916b46b63a66511]::query::plumbing::try_execute_query::<rustc_query_impl[3a2e535b9c873a5e]::DynamicConfig<rustc_query_system[2916b46b63a66511]::query::caches::SingleCache<rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[3a2e535b9c873a5e]::plumbing::QueryCtxt, true>
31:     0xe8ae486050f4 - rustc_query_impl[3a2e535b9c873a5e]::query_impl::entry_fn::get_query_incr::__rust_end_short_backtrace
32:     0xe8ae47d99dac - rustc_interface[492b149e41f1f228]::passes::run_required_analyses
33:     0xe8ae47d89754 - rustc_interface[492b149e41f1f228]::passes::analysis
34:     0xe8ae47bd73a4 - rustc_query_impl[3a2e535b9c873a5e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3a2e535b9c873a5e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 0usize]>>
35:     0xe8ae486036ec - rustc_query_system[2916b46b63a66511]::query::plumbing::try_execute_query::<rustc_query_impl[3a2e535b9c873a5e]::DynamicConfig<rustc_query_system[2916b46b63a66511]::query::caches::SingleCache<rustc_middle[4ef0a599f320642a]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[3a2e535b9c873a5e]::plumbing::QueryCtxt, true>
36:     0xe8ae486033a8 - rustc_query_impl[3a2e535b9c873a5e]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
37:     0xe8ae485a36f8 - rustc_interface[492b149e41f1f228]::passes::create_and_enter_global_ctxt::<core[cb75fe34ca8113ae]::option::Option<rustc_interface[492b149e41f1f228]::queries::Linker>, rustc_driver_impl[f5f4742c5c4c0cc6]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
38:     0xe8ae48590800 - rustc_interface[492b149e41f1f228]::interface::run_compiler::<(), rustc_driver_impl[f5f4742c5c4c0cc6]::run_compiler::{closure#0}>::{closure#1}
39:     0xe8ae48564948 - std[35d4cec575854488]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[492b149e41f1f228]::util::run_in_thread_with_globals<rustc_interface[492b149e41f1f228]::util::run_in_thread_pool_with_globals<rustc_interface[492b149e41f1f228]::interface::run_compiler<(), rustc_driver_impl[f5f4742c5c4c0cc6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
40:     0xe8ae485645b8 - <<std[35d4cec575854488]::thread::Builder>::spawn_unchecked_<rustc_interface[492b149e41f1f228]::util::run_in_thread_with_globals<rustc_interface[492b149e41f1f228]::util::run_in_thread_pool_with_globals<rustc_interface[492b149e41f1f228]::interface::run_compiler<(), rustc_driver_impl[f5f4742c5c4c0cc6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[cb75fe34ca8113ae]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
41:     0xe8ae49c5a1f8 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d863de0cbcfe7e0
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/alloc/src/boxed.rs:1976:9
42:     0xe8ae49c5a1f8 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9356085160497697
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/alloc/src/boxed.rs:1976:9
43:     0xe8ae49c5a1f8 - std::sys::pal::unix::thread::Thread::new::thread_start::h3c8435bfedbb06de
                             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/pal/unix/thread.rs:106:17
44:     0xe8ae45da595c - <unknown>
45:     0xe8ae45e0ba4c - <unknown>
46:                0x0 - <unknown>

Activity

added
C-bugCategory: Clippy is not doing the correct thing
I-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
on Apr 9, 2025
samueltardieu

samueltardieu commented on Apr 9, 2025

@samueltardieu
Contributor

Thanks for the report. However, it would help a lot if you could provide us with a reduced example to reproduce this problem. At the minimum, the full compiler output would be necessary, especially because some internal errors are due to incremental compilation and marked as such (and come from libc, not Clippy — this might be the case here as the backtrace doesn't even contain a single reference to Clippy sources).

flyingmutant

flyingmutant commented on Apr 10, 2025

@flyingmutant
Author

Unfortunately, I can't provide a reproducer, because the code is private and the problem happens sporadically, only several times a day. However, I think the output I've provided is full, what should I add in case the problem will happen again?

hughe

hughe commented on Apr 22, 2025

@hughe

I'm getting the same error while running cargo test.

error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:698:32: uninterned StableCrateId: StableCrateId(0)

It's also sporadic. It happened after upgrading from 1.80.0 to 1.86.0. This code is also private.

Backtrace thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:698:32: Box stack backtrace: 0: std::panicking::begin_panic:: 1: ::emit_producing_guarantee 2: rustc_middle::util::bug::opt_span_bug_fmt::::{closure#0} 3: rustc_middle::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 4: rustc_middle::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 5: rustc_middle::util::bug::bug_fmt 6: ::extract_def_id 7: rustc_query_impl::plumbing::force_from_dep_node::, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>> 8: ::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode)>>::call_once 9: >::try_mark_previous_green:: 10: rustc_query_system::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true> 11: rustc_middle::query::plumbing::query_get_at::>> 12: rustc_passes::entry::entry_fn [... omitted 1 frame ...] 13: rustc_interface::passes::run_required_analyses 14: rustc_interface::passes::analysis [... omitted 1 frame ...] 15: rustc_interface::passes::create_and_enter_global_ctxt::, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 16: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 aarch64-unknown-linux-gnu

note: compiler flags: -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:
#0 [def_span] looking up span for main
#1 [entry_fn] looking up the entry function of a crate
#2 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 def_span(XXXXXX[acf8]::main)
end of try_mark_green dep node stack
error: could not compile XXXXXX (lib test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @samueltardieu@flyingmutant@hughe

        Issue actions

          internal compiler error: cstore_impl.rs:698:32: uninterned StableCrateId: StableCrateId(0) · Issue #14572 · rust-lang/rust-clippy