You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Internal compiler error on HashMap/HashSet (RandomState::new): rustc_metadata panics on AnonConst #5101
thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder.rs:1494:26:
Definition key DefKey { parent: Some(DefIndex(7826)), disambiguated_data: DisambiguatedDefPathData { data: AnonConst, disambiguator: 0 } } of type `AnonConst` did not have any attributes stored
error: internal compiler error: Kani unexpectedly panicked at ...
[Kani] current codegen item: declare_function: std::hash::RandomState::new::KEYS::{constant#0}::{closure#1}::{closure#0}
[Kani] current codegen location: .../library/std/src/sys/thread_local/native/mod.rs:112
Expected
Either verification runs (stubbing RandomState::new the way tests/perf/hashset already does internally, or supporting the construct), or a clean diagnostic — not an ICE.
Notes
Uses the default --reachability=harnesses; not specific to -Z autoharness or --reachability=all_fns (both reproduce it too, which is how this was first noticed, on firecracker's vmm crate and on verus's air crate — same panic, same DefIndex(7826), same codegen item, in both).
tests/kani has no coverage at all for HashMap/HashSet; the only two mentions of either (tests/perf/hashset, tests/expected/bounded-arbitrary/hash/hash.rs) stub RandomState::new themselves and don't go through this thread_local path.
Related but distinct: HashMap::new fails to verify: syscall undefined #723 is HashMap::new failing verification ("syscall undefined") on old RMC. This is a hard crash during compilation, seemingly introduced since, probably when std's TLS implementation changed to the "native" thread_local path with an anonymous const (the panicking file is sys/thread_local/native/mod.rs).
use std::collections::HashMap;#[cfg(kani)]#[kani::proof]fnhashmap_new(){letmut m:HashMap<u8,u8> = HashMap::new();
m.insert(1,2);assert!(m.len() == 1);}
$ cargo kani -Z unstable-options --harness hashmap_new --harness-timeout 5m
error: internal compiler error: Kani unexpectedly panicked at panicked at /rustc-dev/1a2c4797ef2570bd76ca5dee34449169bc7dc457/compiler/rustc_metadata/src/rmeta/decoder.rs:1494:26:
Definition key DefKey { parent: Some(DefIndex(7826)), disambiguated_data: DisambiguatedDefPathData { data: AnonConst, disambiguator: 0 } } of type `AnonConst` did not have any att
error: Failed to compile `k01` due to an internal compiler error.: error: internal compiler error: Kani unexpectedly panicked at panicked at /rustc-dev/1a2c4797ef2570bd76ca5dee3444
Definition key DefKey { parent: Some(DefIndex(7826)), disambiguated_data: DisambiguatedDefPathData { data: AnonConst, disambiguator: 0 } } of type `AnonConst` did not have any attr
[Kani] current codegen item: declare_function: std::hash::RandomState::new::KEYS::{constant#0}::{closure#1}::{closure#0}
error: could not compile `k01` (lib); 1 warning emitted
Context: we ran AI agents that use the Kani agent plugin (#5059) to verify 101 of the most downloaded crates on crates.io with Kani 0.68.0, CBMC 6.11.0 and nightly-2026-10-22. The minimal reproducer above was re-run by hand with the same versions. This text was written with AI assistance.
Activity
feliperodri commentedon Nov 6, 2026
More evidence for this issue. Kani hit it while verifying these 12 crate(s):
Minimal reproducer (Kani 0.68.0):
Context: we ran AI agents that use the Kani agent plugin (#5059) to verify 101 of the most downloaded crates on crates.io with Kani 0.68.0, CBMC 6.11.0 and nightly-2026-10-22. The minimal reproducer above was re-run by hand with the same versions. This text was written with AI assistance.