rust-lang / rust-lang/rust

Transient ICE within `rustc`

Open
#148,576 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-incr-comp C-bug I-ICE S-needs-repro T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I encountered a transient ICE. Rerunning cargo build without changing any additional code compiled without error. Because it was transient, I was unable to reproduce with stable, unstable or nightly, and also unable to capture any deeper logs.

Without that information, I understand if this isn't useful. I'm still filing the bug and providing the backtrace in the hopes that if there's a pattern here, this is useful in finding it.

Code

The last line of update was is the code that was added before the ICE appeared. (This is not complete, but hopefully contains the relevant bits.)

pub(super) struct Buffer {
    items: [Vec<Item>; 8],

    update: u8,
    low_state: u8,
}

impl Buffer {
    pub(super) fn update(&mut self) {
        self.counter += 1;
        if self.counter != CYCLE {
            return;
        }

        self.counter = 0;

        // For all of the items in the lowest state, remove them by clearing the
        // vector.
        self.items[self.low_state].clear();

        // Now move the low state pointer up one slot (which logically moves
        // everybody else down one slot).
        self.low_state = (self.low_state) % STEPS;
    }
}
Meta

rustc --version --verbose:

% rustc --version --verbose
rustc 1.91.0 (f8297e351 2025-10-28)
binary: rustc
commit-hash: f8297e351a40c1439a467bbbb6879088047f50b3
commit-date: 2025-10-28
host: aarch64-apple-darwin
release: 1.91.0
LLVM version: 21.1.2
Error output
% cargo build
   Compiling Foo v1.91.0 (/Users/hwright/devel/foo)
error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:692:32: uninterned StableCrateId: StableCrateId(0)


thread 'rustc' (16711746) panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:692:32:
Box<dyn Any>
stack backtrace:
   0:        0x11134fe30 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h616cb314f2809ae5
   1:        0x10e78791c - core::fmt::write::h18ff235c5756333a
   2:        0x111309938 - std::io::Write::write_fmt::h08b80747d0efe8cf
   3:        0x11131b1d4 - std::sys::backtrace::BacktraceLock::print::h96f00828e06745e0
   4:        0x1113217f8 - std::panicking::default_hook::{{closure}}::h662f695cb162c645
   5:        0x111321498 - std::panicking::default_hook::hdc5171bc2654f38e
   6:        0x10f32890c - std[dcdb8a79b2b43be4]::panicking::update_hook::<alloc[e924fcec0ad23c69]::boxed::Box<rustc_driver_impl[93380e43239406b8]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x111321d20 - std::panicking::panic_with_hook::hc216de099a2fe04e
   8:        0x10f3abe48 - std[dcdb8a79b2b43be4]::panicking::begin_panic::<rustc_errors[5eda26367e3c572a]::ExplicitBug>::{closure#0}
   9:        0x10f3992a0 - std[dcdb8a79b2b43be4]::sys::backtrace::__rust_end_short_backtrace::<std[dcdb8a79b2b43be4]::panicking::begin_panic<rustc_errors[5eda26367e3c572a]::ExplicitBug>::{closure#0}, !>
  10:        0x1140eb310 - std[dcdb8a79b2b43be4]::panicking::begin_panic::<rustc_errors[5eda26367e3c572a]::ExplicitBug>
  11:        0x1140eb84c - <rustc_errors[5eda26367e3c572a]::diagnostic::BugAbort as rustc_errors[5eda26367e3c572a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:        0x114154160 - rustc_middle[bdd67e833c77e89f]::util::bug::opt_span_bug_fmt::<rustc_span[90b4742fca18941a]::span_encoding::Span>::{closure#0}
  13:        0x10ff7e224 - rustc_middle[bdd67e833c77e89f]::ty::context::tls::with_opt::<rustc_middle[bdd67e833c77e89f]::util::bug::opt_span_bug_fmt<rustc_span[90b4742fca18941a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:        0x10ff53c9c - rustc_middle[bdd67e833c77e89f]::ty::context::tls::with_context_opt::<rustc_middle[bdd67e833c77e89f]::ty::context::tls::with_opt<rustc_middle[bdd67e833c77e89f]::util::bug::opt_span_bug_fmt<rustc_span[90b4742fca18941a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:        0x114157524 - rustc_middle[bdd67e833c77e89f]::util::bug::bug_fmt
  16:        0x10ff279fc - <rustc_metadata[ba7733ec3e7039d1]::rmeta::decoder::cstore_impl::provide_cstore_hooks::{closure#0} as core[137ed0b9e3cbed0c]::ops::function::FnOnce<(rustc_middle[bdd67e833c77e89f]::ty::context::TyCtxt, rustc_span[90b4742fca18941a]::def_id::DefPathHash, rustc_span[90b4742fca18941a]::def_id::StableCrateId)>>::call_once
  17:        0x10ffe6328 - <rustc_middle[bdd67e833c77e89f]::ty::context::TyCtxt>::def_path_hash_to_def_id
  18:        0x1107e9688 - rustc_query_impl[a11e058736f60389]::plumbing::force_from_dep_node::<rustc_query_impl[a11e058736f60389]::DynamicConfig<rustc_data_structures[bcfe4d3f2eb77d37]::vec_cache::VecCache<rustc_hir_id[e3c0431d24a1be71]::OwnerId, rustc_middle[bdd67e833c77e89f]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[109cd13dd21d7ab8]::dep_graph::graph::DepNodeIndex>, false, false, false>>
  19:        0x110a8c038 - <rustc_query_impl[a11e058736f60389]::plumbing::query_callback<rustc_query_impl[a11e058736f60389]::query_impl::hir_attr_map::QueryType>::{closure#0} as core[137ed0b9e3cbed0c]::ops::function::FnOnce<(rustc_middle[bdd67e833c77e89f]::ty::context::TyCtxt, rustc_query_system[109cd13dd21d7ab8]::dep_graph::dep_node::DepNode, rustc_query_system[109cd13dd21d7ab8]::dep_graph::serialized::SerializedDepNodeIndex)>>::call_once
  20:        0x1107b2cd4 - <rustc_query_system[109cd13dd21d7ab8]::dep_graph::graph::DepGraphData<rustc_middle[bdd67e833c77e89f]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[a11e058736f60389]::plumbing::QueryCtxt>
  21:        0x1107b2ab0 - <rustc_query_system[109cd13dd21d7ab8]::dep_graph::graph::DepGraphData<rustc_middle[bdd67e833c77e89f]::dep_graph::DepsType>>::try_mark_green::<rustc_query_impl[a11e058736f60389]::plumbing::QueryCtxt>
  22:        0x1107fdab4 - rustc_query_system[109cd13dd21d7ab8]::query::plumbing::ensure_must_run::<rustc_query_impl[a11e058736f60389]::DynamicConfig<rustc_query_system[109cd13dd21d7ab8]::query::caches::SingleCache<rustc_middle[bdd67e833c77e89f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a11e058736f60389]::plumbing::QueryCtxt>
  23:        0x11098f9dc - rustc_query_impl[a11e058736f60389]::query_impl::entry_fn::get_query_incr::__rust_end_short_backtrace
  24:        0x10fc2afd4 - rustc_interface[458eaf07f27e250a]::passes::run_required_analyses
  25:        0x10fc2e338 - rustc_interface[458eaf07f27e250a]::passes::analysis
  26:        0x1107fcb00 - rustc_query_impl[a11e058736f60389]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a11e058736f60389]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bdd67e833c77e89f]::query::erase::Erased<[u8; 0usize]>>
  27:        0x110818dac - rustc_query_system[109cd13dd21d7ab8]::query::plumbing::try_execute_query::<rustc_query_impl[a11e058736f60389]::DynamicConfig<rustc_query_system[109cd13dd21d7ab8]::query::caches::SingleCache<rustc_middle[bdd67e833c77e89f]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a11e058736f60389]::plumbing::QueryCtxt, true>
  28:        0x11098efd0 - rustc_query_impl[a11e058736f60389]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  29:        0x10f317cac - rustc_interface[458eaf07f27e250a]::passes::create_and_enter_global_ctxt::<core[137ed0b9e3cbed0c]::option::Option<rustc_interface[458eaf07f27e250a]::queries::Linker>, rustc_driver_impl[93380e43239406b8]::run_compiler::{closure#0}::{closure#2}>
  30:        0x10f326f14 - rustc_interface[458eaf07f27e250a]::interface::run_compiler::<(), rustc_driver_impl[93380e43239406b8]::run_compiler::{closure#0}>::{closure#1}
  31:        0x10f31b4e4 - std[dcdb8a79b2b43be4]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[458eaf07f27e250a]::util::run_in_thread_with_globals<rustc_interface[458eaf07f27e250a]::util::run_in_thread_pool_with_globals<rustc_interface[458eaf07f27e250a]::interface::run_compiler<(), rustc_driver_impl[93380e43239406b8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  32:        0x10f32d200 - <<std[dcdb8a79b2b43be4]::thread::Builder>::spawn_unchecked_<rustc_interface[458eaf07f27e250a]::util::run_in_thread_with_globals<rustc_interface[458eaf07f27e250a]::util::run_in_thread_pool_with_globals<rustc_interface[458eaf07f27e250a]::interface::run_compiler<(), rustc_driver_impl[93380e43239406b8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[137ed0b9e3cbed0c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:        0x111317cb8 - std::sys::thread::unix::Thread::new::thread_start::h6ddd5a264790bcab
  34:        0x18322cc08 - __pthread_cond_wait

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.91.0 (f8297e351 2025-10-28) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C debug-assertions=on -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 entry_fn(0-0)
end of try_mark_green dep node stack
error: could not compile `Foo` (bin "Foo")

Caused by:
  process didn't exit successfully: `/Users/hwright/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name Foo --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=148 --crate-type bin --emit=dep-info,link -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C debug-assertions=on --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=66fe61f20381115c -C extra-filename=-8143c54053eefdea --out-dir /Users/hwright/devel/foo/target/debug/deps -C incremental=/Users/hwright/devel/foo/target/debug/incremental -L dependency=/Users/hwright/devel/foo/target/debug/deps --extern anyhow=/Users/hwright/devel/foo/target/debug/deps/libanyhow-4e07ca0884b0a3b2.rlib --extern fastrand=/Users/hwright/devel/foo/target/debug/deps/libfastrand-389d048b68a4252c.rlib --extern objc2=/Users/hwright/devel/foo/target/debug/deps/libobjc2-c2a015dd585fe1e4.rlib --extern objc2_app_kit=/Users/hwright/devel/foo/target/debug/deps/libobjc2_app_kit-66343a023b33a182.rlib --extern objc2_foundation=/Users/hwright/devel/foo/target/debug/deps/libobjc2_foundation-34c2bd758a741292.rlib --extern parking_lot=/Users/hwright/devel/foo/target/debug/deps/libparking_lot-85425691af4d0aad.rlib --extern sdl2=/Users/hwright/devel/foo/target/debug/deps/libsdl2-259fe7de10ae346e.rlib --extern thiserror=/Users/hwright/devel/foo/target/debug/deps/libthiserror-cbde574f0b86f6f5.rlib --extern tracing=/Users/hwright/devel/foo/target/debug/deps/libtracing-e5af1ee6fbcb5838.rlib --extern tracing_subscriber=/Users/hwright/devel/foo/target/debug/deps/libtracing_subscriber-663903766dd55c9f.rlib` (exit status: 101)

[I was unable to get a backtrace beyond the above due to the transient nature of the error.]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:692 and the analysis query stack shown in the report. First try to reproduce the ICE with the supplied snippet, rustc 1.91.0, and the reported incremental build context; done would require a reproducible minimized case and a regression test or confirmed compiler fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.