Skip to content

ICE: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:595:32: uninterned StableCrateId #112700

Open
@bjorn3

Description

@bjorn3
Member

I tried this code:

./x.py build compiler/rustc_codegen_cranelift

with the compiler profile which enables incr comp.

I expected to see this happen: It worked.

Instead, this happened: Got an incr comp related ICE.

Meta

Base commit is c84d5e7. Commit of the previous build is bjorn3@15d3eee.

Backtrace

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

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/eff24c06d8f4397802b546aa2e52450e1022fc02/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::HandlerInner>::bug::<alloc::string::String>
   2: <rustc_errors::Handler>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_metadata::creader::CStore as rustc_session::cstore::CrateStore>::stable_crate_id_to_crate_num
   8: <rustc_span::span_encoding::Span as rustc_serialize::serialize::Decodable<rustc_middle::query::on_disk_cache::CacheDecoder>>::decode
   9: <alloc::vec::Vec<(rustc_middle::ty::Predicate, rustc_span::span_encoding::Span)> as alloc::vec::spec_from_iter::SpecFromIter<(rustc_middle::ty::Predicate, rustc_span::span_encoding::Span), core::iter::adapters::map::Map<core::ops::range::Range<usize>, <[(rustc_middle::ty::Predicate, rustc_span::span_encoding::Span)] as rustc_middle::ty::codec::RefDecodable<rustc_middle::query::on_disk_cache::CacheDecoder>>::decode::{closure#0}>>>::from_iter
  10: <[(rustc_middle::ty::Predicate, rustc_span::span_encoding::Span)] as rustc_middle::ty::codec::RefDecodable<rustc_middle::query::on_disk_cache::CacheDecoder>>::decode
  11: <rustc_middle::query::on_disk_cache::OnDiskCache>::load_indexed::<rustc_middle::ty::generics::GenericPredicates>
  12: rustc_query_impl::plumbing::try_load_from_disk::<rustc_middle::ty::generics::GenericPredicates>
  13: <rustc_query_impl::query_impl::implied_predicates_of::dynamic_query::{closure#6} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, &rustc_span::def_id::DefId, rustc_query_system::dep_graph::serialized::SerializedDepNodeIndex, rustc_query_system::dep_graph::graph::DepNodeIndex)>>::call_once
  14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
  15: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 24]>>>
  16: <rustc_privacy::ReachEverythingInTheInterfaceVisitor>::predicates
  17: <rustc_privacy::EmbargoVisitor as rustc_hir::intravisit::Visitor>::visit_item
  18: <rustc_middle::hir::map::Map>::visit_all_item_likes_in_crate::<rustc_privacy::EmbargoVisitor>
  19: rustc_privacy::effective_visibilities
  20: rustc_passes::stability::check_unused_or_stable_features
  21: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}::{closure#2}::{closure#0}>
  22: rustc_interface::passes::analysis
  23: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  24: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  25: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
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.71.0-beta.1 (eff24c06d 2023-05-29) running on aarch64-unknown-linux-gnu

note: compiler flags: --crate-type dylib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=v0 -Z unstable-options -Z macro-backtrace -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C split-debuginfo=off -C llvm-args=-import-instr-limit=10 -Z binary-dep-depinfo -Z force-unstable-if-unmarked

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

query stack during panic:
thread panicked while processing panic. aborting.
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `rustc_codegen_cranelift` (lib)

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
C-bugCategory: This is a bug.
on Jun 16, 2023
bjorn3

bjorn3 commented on Jun 16, 2023

@bjorn3
MemberAuthor

cc @jyn514 looks like #111329 didn't fix everything yet.

jyn514

jyn514 commented on Jun 16, 2023

@jyn514
Member

This is an ICE in beta, not stage 1. So this is probably a real incr comp bug, not a bug in bootstrap..

changed the title [-]Bootstrap error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:595:32: uninterned StableCrateId: StableCrateId(16163198275912615384)[/-] [+]ICE: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:595:32: uninterned StableCrateId[/+] on Jun 16, 2023
jyn514

jyn514 commented on Jun 16, 2023

@jyn514
Member

#88488 might be related.

added this to the 1.71.0 milestone on Jul 2, 2023
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Jul 3, 2023
dpaoliello

dpaoliello commented on Aug 11, 2023

@dpaoliello
Contributor

I'm reliably hitting this using x86_64-pc-windows-msvc. Please let me know if you need any info to debug it.

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
and removed
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Aug 12, 2023

11 remaining items

apiraino

apiraino commented on Dec 11, 2023

@apiraino
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

added and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Dec 11, 2023
michaelwoerister

michaelwoerister commented on Dec 19, 2023

@michaelwoerister
Member

I'm having a hard time writing a small reproducer for this. Simply changing -Cmetadata of an upstream dependency is not sufficient. I think it also needs to involved certain things to be read from the incr. comp. cache in order to trigger the ICE.

added 2 commits that reference this issue on Dec 19, 2023

Auto merge of rust-lang#119139 - michaelwoerister:cleanup-stable-sour…

Auto merge of rust-lang#119139 - michaelwoerister:cleanup-stable-sour…

michaelwoerister

michaelwoerister commented on Jan 3, 2024

@michaelwoerister
Member

A potential fix for this has been merged in #119139 last week. Since the issue seems to most easily trigger during bootstrap, we'll have to wait for the fix to make it to beta before we can tell if it worked. I wasn't able to come up with a small reproducer, unfortunately.

vegardgs-ksat

vegardgs-ksat commented on Apr 16, 2024

@vegardgs-ksat

I encountered this issue in stable (1.77.1) today.

$ cargo test contacts::search
   Compiling fjalar-database v0.1.0 (/Users/vegardgs/workspace/kogs/fjalar/database)
error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:613:32: uninterned StableCrateId: StableCrateId(0)

thread 'rustc' panicked at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/compiler/rustc_errors/src/lib.rs:932:30:
Box<dyn Any>
stack backtrace:
   0:        0x1014448d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4e6df6dd376d525
   1:        0x1014872b4 - core::fmt::write::h5a442bf928ef18fb
   2:        0x10143ab9c - std::io::Write::write_fmt::h01fe6f9cc882fac7
   3:        0x101444708 - std::sys_common::backtrace::print::h249c7fd853efd630
   4:        0x1014471d0 - std::panicking::default_hook::{{closure}}::h539bfee0454d0951
   5:        0x101446f18 - std::panicking::default_hook::he5a7d244fe90fc13
   6:        0x109b65408 - <alloc[b606dcf9f479e37c]::boxed::Box<rustc_driver_impl[64327daa3a5146a5]::install_ice_hook::{closure#0}> as core[13280c881f35522b]::ops::function::Fn<(&dyn for<'a, 'b> core[13280c881f35522b]::ops::function::Fn<(&'a core[13280c881f35522b]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[13280c881f35522b]::marker::Sync + core[13280c881f35522b]::marker::Send, &core[13280c881f35522b]::panic::panic_info::PanicInfo)>>::call
   7:        0x10144785c - std::panicking::rust_panic_with_hook::h9b82bdc13ccb171b
   8:        0x10de19584 - std[d41acc809eeea868]::panicking::begin_panic::<rustc_errors[b61bc3038148d90f]::ExplicitBug>::{closure#0}
   9:        0x10de18ec8 - std[d41acc809eeea868]::sys_common::backtrace::__rust_end_short_backtrace::<std[d41acc809eeea868]::panicking::begin_panic<rustc_errors[b61bc3038148d90f]::ExplicitBug>::{closure#0}, !>
  10:        0x10e24166c - std[d41acc809eeea868]::panicking::begin_panic::<rustc_errors[b61bc3038148d90f]::ExplicitBug>
  11:        0x10de0d298 - <rustc_errors[b61bc3038148d90f]::diagnostic_builder::BugAbort as rustc_errors[b61bc3038148d90f]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  12:        0x10dc02c34 - <rustc_errors[b61bc3038148d90f]::DiagCtxt>::bug::<alloc[b606dcf9f479e37c]::string::String>
  13:        0x10dc2ea54 - rustc_middle[ca4af2868b1ce88d]::util::bug::opt_span_bug_fmt::<rustc_span[4db8343918321063]::span_encoding::Span>::{closure#0}
  14:        0x10dc2ca48 - rustc_middle[ca4af2868b1ce88d]::ty::context::tls::with_opt::<rustc_middle[ca4af2868b1ce88d]::util::bug::opt_span_bug_fmt<rustc_span[4db8343918321063]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:        0x10dc2ca14 - rustc_middle[ca4af2868b1ce88d]::ty::context::tls::with_context_opt::<rustc_middle[ca4af2868b1ce88d]::ty::context::tls::with_opt<rustc_middle[ca4af2868b1ce88d]::util::bug::opt_span_bug_fmt<rustc_span[4db8343918321063]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:        0x10e224690 - rustc_middle[ca4af2868b1ce88d]::util::bug::bug_fmt
  17:        0x10d7ce124 - <rustc_metadata[f797ad83e140e687]::creader::CStore as rustc_session[d6cbb4e49a2d8117]::cstore::CrateStore>::stable_crate_id_to_crate_num
  18:        0x10db88b70 - <rustc_middle[ca4af2868b1ce88d]::ty::context::TyCtxt>::def_path_hash_to_def_id
  19:        0x10dc8b4a8 - <rustc_query_system[49d49f6d7647d37d]::dep_graph::dep_node::DepNode as rustc_middle[ca4af2868b1ce88d]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  20:        0x10cfba918 - <rustc_query_impl[c8aba89b8a3b468f]::plumbing::query_callback<rustc_query_impl[c8aba89b8a3b468f]::query_impl::hir_attrs::QueryType>::{closure#0} as core[13280c881f35522b]::ops::function::FnOnce<(rustc_middle[ca4af2868b1ce88d]::ty::context::TyCtxt, rustc_query_system[49d49f6d7647d37d]::dep_graph::dep_node::DepNode)>>::call_once
  21:        0x10d01dc64 - <rustc_query_system[49d49f6d7647d37d]::dep_graph::graph::DepGraphData<rustc_middle[ca4af2868b1ce88d]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[c8aba89b8a3b468f]::plumbing::QueryCtxt>
  22:        0x10d01da38 - <rustc_query_system[49d49f6d7647d37d]::dep_graph::graph::DepGraphData<rustc_middle[ca4af2868b1ce88d]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[c8aba89b8a3b468f]::plumbing::QueryCtxt>
  23:        0x10cf3cc3c - rustc_query_system[49d49f6d7647d37d]::query::plumbing::ensure_must_run::<rustc_query_impl[c8aba89b8a3b468f]::DynamicConfig<rustc_query_system[49d49f6d7647d37d]::query::caches::SingleCache<rustc_middle[ca4af2868b1ce88d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c8aba89b8a3b468f]::plumbing::QueryCtxt>
  24:        0x10d10cd2c - rustc_query_impl[c8aba89b8a3b468f]::query_impl::proc_macro_decls_static::get_query_incr::__rust_end_short_backtrace
  25:        0x109ce48bc - <rustc_session[d6cbb4e49a2d8117]::session::Session>::time::<(), rustc_interface[4bd36eacb978473d]::passes::analysis::{closure#0}::{closure#0}::{closure#0}::{closure#1}>
  26:        0x109d2130c - std[d41acc809eeea868]::panicking::try::<(), core[13280c881f35522b]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[4bd36eacb978473d]::passes::analysis::{closure#0}::{closure#0}::{closure#0}>>
  27:        0x109ce520c - <rustc_session[d6cbb4e49a2d8117]::session::Session>::time::<(), rustc_interface[4bd36eacb978473d]::passes::analysis::{closure#0}>
  28:        0x109cccbb8 - rustc_interface[4bd36eacb978473d]::passes::analysis
  29:        0x10cfd4520 - rustc_query_impl[c8aba89b8a3b468f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c8aba89b8a3b468f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca4af2868b1ce88d]::query::erase::Erased<[u8; 1usize]>>
  30:        0x10cff9310 - <rustc_query_impl[c8aba89b8a3b468f]::query_impl::analysis::dynamic_query::{closure#2} as core[13280c881f35522b]::ops::function::FnOnce<(rustc_middle[ca4af2868b1ce88d]::ty::context::TyCtxt, ())>>::call_once
  31:        0x10cf52d98 - rustc_query_system[49d49f6d7647d37d]::query::plumbing::try_execute_query::<rustc_query_impl[c8aba89b8a3b468f]::DynamicConfig<rustc_query_system[49d49f6d7647d37d]::query::caches::SingleCache<rustc_middle[ca4af2868b1ce88d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c8aba89b8a3b468f]::plumbing::QueryCtxt, true>
  32:        0x10d0ef96c - rustc_query_impl[c8aba89b8a3b468f]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  33:        0x109b78a1c - <rustc_middle[ca4af2868b1ce88d]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[64327daa3a5146a5]::run_compiler::{closure#0}::{closure#0}::{closure#3}, core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>>
  34:        0x109b78338 - <rustc_interface[4bd36eacb978473d]::interface::Compiler>::enter::<rustc_driver_impl[64327daa3a5146a5]::run_compiler::{closure#0}::{closure#0}, core[13280c881f35522b]::result::Result<core[13280c881f35522b]::option::Option<rustc_interface[4bd36eacb978473d]::queries::Linker>, rustc_span[4db8343918321063]::ErrorGuaranteed>>
  35:        0x109ba4ec4 - rustc_span[4db8343918321063]::create_session_globals_then::<core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>, rustc_interface[4bd36eacb978473d]::interface::run_compiler<core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>, rustc_driver_impl[64327daa3a5146a5]::run_compiler::{closure#0}>::{closure#0}>
  36:        0x109b92400 - std[d41acc809eeea868]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4bd36eacb978473d]::util::run_in_thread_with_globals<rustc_interface[4bd36eacb978473d]::interface::run_compiler<core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>, rustc_driver_impl[64327daa3a5146a5]::run_compiler::{closure#0}>::{closure#0}, core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>>
  37:        0x109badad4 - <<std[d41acc809eeea868]::thread::Builder>::spawn_unchecked_<rustc_interface[4bd36eacb978473d]::util::run_in_thread_with_globals<rustc_interface[4bd36eacb978473d]::interface::run_compiler<core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>, rustc_driver_impl[64327daa3a5146a5]::run_compiler::{closure#0}>::{closure#0}, core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[13280c881f35522b]::result::Result<(), rustc_span[4db8343918321063]::ErrorGuaranteed>>::{closure#1} as core[13280c881f35522b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:        0x10144f378 - std::sys::pal::unix::thread::Thread::new::thread_start::h028c70d4ad289ac9
  39:        0x1940d2f94 - __pthread_joiner_wake

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.77.1 (7cf61ebde 2024-03-27) running on aarch64-apple-darwin

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

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

query stack during panic:
#0 [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 proc_macro_decls_static(0-0)
end of try_mark_green dep node stack
error: could not compile `fjalar-database` (lib
michaelwoerister

michaelwoerister commented on Apr 17, 2024

@michaelwoerister
Member

Thanks for the report, @vegardgs-ksat!

This looks like a different issue. It's the same error but triggered by a different code path. Do you have a reproducer for the ICE? Then it would be best to open a new issue.

vegardgs-ksat

vegardgs-ksat commented on Apr 18, 2024

@vegardgs-ksat

Thanks for the report, @vegardgs-ksat!

This looks like a different issue. It's the same error but triggered by a different code path. Do you have a reproducer for the ICE? Then it would be best to open a new issue.

I was not aware it was a different issue.

I do not have a reproducer - it was a one-off error that occurred when I made two consecutive changes within sqlx::QueryBuilder string contents (I believe - I do not think it was the sqlx::query! macro). I have worked a lot with this kind of code, and I have only gotten this ICE once - so its definitely not a common issue.

michaelwoerister

michaelwoerister commented on Apr 19, 2024

@michaelwoerister
Member

I was not aware it was a different issue.

No worries, there's no way to tell that this has a different root cause unless one knows the relevant parts of the compiler's internals. You absolutely did the right thing reporting the backtrace here.

We'll have to wait for a reproducer to dig into this more.

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

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @michaelwoerister@Mark-Simulacrum@apiraino@surechen@dpaoliello

        Issue actions

          ICE: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:595:32: uninterned StableCrateId · Issue #112700 · rust-lang/rust