Code
This reproduces with a small Cargo project containing a private path dependency.
Cargo.toml:
[package]
name = "pubdep_ice_repro"
version = "0.1.0"
edition = "2021"
[dependencies]
dep = { path = "dep" }
src/lib.rs:
pub fn expose(_: dep::FromDep) {}
dep/Cargo.toml:
[package]
name = "dep"
version = "0.1.0"
edition = "2021"
dep/src/lib.rs:
Reproduction steps:
cargo +nightly check --message-format=short
touch src/lib.rs
RUST_BACKTRACE=1 cargo +nightly -Zpublic-dependency check --message-format=short
The first build populates the incremental cache without -Zpublic-dependency.
The second build recompiles the root library with -Zpublic-dependency, which enables the exported_private_dependencies warning for the private dependency in the public API.
This does not ICE for me when:
- the first build is already run with
-Zpublic-dependency, or
- the same steps are run with
CARGO_INCREMENTAL=0.
I originally noticed this while investigating rust-lang/cargo#16962, but this ICE is separate from Cargo's stale-cache behavior. The minimized repro above does not need an intermediate stale Cargo run; touching src/lib.rs is enough to force the root library to rebuild with the changed -Zpublic-dependency state.
Meta
rustc +nightly --version --verbose:
rustc 1.97.0-nightly (cb40c25f6 2026-05-04)
binary: rustc
commit-hash: cb40c25f6aebb637163d26bf76a680ed6e5d1eda
commit-date: 2026-05-04
host: aarch64-apple-darwin
release: 1.97.0-nightly
LLVM version: 22.1.4
cargo +nightly -Vv:
cargo 1.97.0-nightly (4f9b52075 2026-05-01)
release: 1.97.0-nightly
commit-hash: 4f9b52075316e9ced380c8fa492858048d5758b6
commit-date: 2026-05-01
host: aarch64-apple-darwin
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.7.1 (sys:0.4.88+curl-8.20.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.6.2 7 Apr 2026
os: Mac OS 26.4.1 [64-bit]
Error output
Checking pubdep_ice_repro v0.1.0 (/private/tmp/rustc-public-dep-ice-min.z9t2F2)
src/lib.rs:1:1: warning: type `FromDep` from private dependency 'dep' in public interface
error: internal compiler error: encountered incremental compilation error with lints_that_dont_need_to_run(0-0)
thread 'rustc' (6131573) panicked at /rustc-dev/cb40c25f6aebb637163d26bf76a680ed6e5d1eda/compiler/rustc_middle/src/verify_ich.rs:82:9:
Found unstable fingerprints for lints_that_dont_need_to_run(0-0): ...
note: rustc 1.97.0-nightly (cb40c25f6 2026-05-04) 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] -Z unstable-options
query stack during panic:
#0 [lints_that_dont_need_to_run] Computing all lints that are explicitly enabled or with a default level greater than Allow
#1 [analysis] running analysis passes on crate `pubdep_ice_repro`
end of query stack
warning: `pubdep_ice_repro` (lib) generated 1 warning
error: could not compile `pubdep_ice_repro` (lib) due to 1 previous error; 1 warning emitted
Backtrace
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: rustc_middle::verify_ich::incremental_verify_ich_failed
3: rustc_middle::verify_ich::incremental_verify_ich::<rustc_middle::query::erase::ErasedData<[u8; 8]>>
4: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, true>
5: rustc_lint::late::check_crate::{closure#0}
6: rustc_lint::late::check_crate
7: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
8: rustc_data_structures::sync::parallel::par_fns
9: rustc_interface::passes::analysis::{closure#0}::{closure#0}
10: rustc_data_structures::sync::parallel::par_fns
11: rustc_interface::passes::analysis
12: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, true>
13: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
14: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
Code
This reproduces with a small Cargo project containing a private path dependency.
Cargo.toml:src/lib.rs:dep/Cargo.toml:dep/src/lib.rs:Reproduction steps:
The first build populates the incremental cache without
-Zpublic-dependency.The second build recompiles the root library with
-Zpublic-dependency, which enables theexported_private_dependencieswarning for the private dependency in the public API.This does not ICE for me when:
-Zpublic-dependency, orCARGO_INCREMENTAL=0.I originally noticed this while investigating rust-lang/cargo#16962, but this ICE is separate from Cargo's stale-cache behavior. The minimized repro above does not need an intermediate stale Cargo run; touching
src/lib.rsis enough to force the root library to rebuild with the changed-Zpublic-dependencystate.Meta
rustc +nightly --version --verbose:cargo +nightly -Vv:Error output
Backtrace