[ICE]: encountered incremental compilation error with evaluate_obligation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
The bug appears only during the incremental build. Compile this code first:
struct S(&'static Box<S>);
trait I<T> {}
impl<F: Fn()> I<()> for F {}
impl<F: Fn(T), T: Sync> I<(T,)> for F {}
fn f<T>(_: impl I<T>) {}
fn main() {
f(|_: S| {});
}
Then change the closure body to something that won't compile:
struct S(&'static Box<S>);
trait I<T> {}
impl<F: Fn()> I<()> for F {}
impl<F: Fn(T), T: Sync> I<(T,)> for F {}
fn f<T>(_: impl I<T>) {}
fn main() {
f(|_: S| { foo; });
}
It seems to me that this is a minimal example because I have tried:
- Remove
impl(1 and 2) - Remove
: Syncbound in 2impl - Change
struct S(&'static Box<S>);tostruct S(&'static S);,struct S;,struct S(Box<S>);andstruct S<'a>(&'a S<'a>);
And in such cases, the bug did not appear.
Also, the bug does not appear when compiling this code with set RUSTFLAGS=-Znext-solver=globally but appears when compiling this code with set RUSTFLAGS=-Znext-solver=coherence.
Meta
rustc --version --verbose:
rustc 1.98.0-nightly (b30f3df3b 2026-06-11)
binary: rustc
commit-hash: b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d
commit-date: 2026-06-11
host: x86_64-pc-windows-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6
cargo-bisect-rustc:
regressed nightly: nightly-2026-04-28
regressed commit: https://github.com/rust-lang/rust/commit/345a975e76de74f090c55d5b56f5f6dd41b655a2
*Expected* error output
error[E0425]: cannot find value `foo` in this scope
--> src\main.rs:10:16
|
10 | f(|_: S| { foo; });
| ^^^ not found in this scope
For more information about this error, try `rustc --explain E0425`.
Actual error output
Backtrace (set RUST_BACKTRACE=full)
error[E0425]: cannot find value `foo` in this scope
--> src\main.rs:10:16
|
10 | f(|_: S| { foo; });
| ^^^ not found in this scope
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(d1ac10e602167c8b-c563356326046502)
|
= note: please follow the instructions below to create a bug report with the provided information
= note: for incremental compilation bugs, having a reproduction is vital
= note: an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
= note: as a workaround, you can run `cargo clean -p ice` or `cargo clean` to allow your project to compile
thread 'rustc' panicked at /rustc-dev/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/compiler\rustc_middle\src\verify_ich.rs:82:9:
Found unstable fingerprints for evaluate_obligation(d1ac10e602167c8b-c563356326046502): Ok(EvaluatedToOk)
stack backtrace:
0: 0x7ffa09930ee2 - std[975dac06280ee588]::backtrace_rs::backtrace::win64::trace
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src\..\..\backtrace\src\backtrace/win64.rs:85:14
1: 0x7ffa09930ee2 - std[975dac06280ee588]::backtrace_rs::backtrace::trace_unsynchronized::<<std[975dac06280ee588]::backtrace::Backtrace>::create::{closure#0}>
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src\..\..\backtrace\src\backtrace/mod.rs:66:14
2: 0x7ffa09930ee2 - <std[975dac06280ee588]::backtrace::Backtrace>::create
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src/backtrace.rs:331:13
3: 0x7ffa09930e2a - <std[975dac06280ee588]::backtrace::Backtrace>::force_capture
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src/backtrace.rs:312:9
4: 0x7ff9777c514b - <alloc[6a4def3c5115624e]::boxed::Box<rustc_driver_impl[a32bea28605b67b1]::install_ice_hook::{closure#1}> as core[13d6f8de8fa2646b]::ops::function::Fn<(&dyn for<'a, 'b> core[13d6f8de8fa2646b]::ops::function::Fn<(&'a std[975dac06280ee588]::panic::PanicHookInfo<'b>,), Output = ()> + core[13d6f8de8fa2646b]::marker::Send + core[13d6f8de8fa2646b]::marker::Sync, &std[975dac06280ee588]::panic::PanicHookInfo)>>::call
5: 0x7ffa099482b9 - <alloc[6a4def3c5115624e]::boxed::Box<dyn for<'a, 'b> core[13d6f8de8fa2646b]::ops::function::Fn<(&'a std[975dac06280ee588]::panic::PanicHookInfo<'b>,), Output = ()> + core[13d6f8de8fa2646b]::marker::Send + core[13d6f8de8fa2646b]::marker::Sync> as core[13d6f8de8fa2646b]::ops::function::Fn<(&std[975dac06280ee588]::panic::PanicHookInfo,)>>::call
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\alloc\src/boxed.rs:2291:9
6: 0x7ffa099482b9 - std[975dac06280ee588]::panicking::panic_with_hook
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src/panicking.rs:822:13
7: 0x7ffa099276e7 - std[975dac06280ee588]::panicking::panic_handler::{closure#0}
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src/panicking.rs:687:13
8: 0x7ffa0991d7ef - std[975dac06280ee588]::sys::backtrace::__rust_end_short_backtrace::<std[975dac06280ee588]::panicking::panic_handler::{closure#0}, !>
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src\sys/backtrace.rs:182:18
9: 0x7ffa099283ce - __rustc[677cb191fb83bdf4]::rust_begin_unwind
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src/panicking.rs:678:5
10: 0x7ffa09998d0d - core[13d6f8de8fa2646b]::panicking::panic_fmt
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\core\src/panicking.rs:80:14
11: 0x7ff97b3840ae - rustc_middle[be1906b5999c5051]::verify_ich::incremental_verify_ich_failed
12: 0x7ff979d603cd - rustc_middle[be1906b5999c5051]::verify_ich::incremental_verify_ich::<rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 2usize]>>
13: 0x7ff979d49d69 - <std[975dac06280ee588]::thread::local::LocalKey<core[13d6f8de8fa2646b]::cell::Cell<*const ()>>>::with::<rustc_middle[be1906b5999c5051]::ty::context::tls::enter_context<rustc_query_impl[545e00a1719b0118]::execution::execute_job_incr<rustc_middle[be1906b5999c5051]::query::caches::DefaultCache<rustc_type_ir[4a3cb01a6b641947]::canonical::CanonicalQueryInput<rustc_middle[be1906b5999c5051]::ty::context::TyCtxt, rustc_middle[be1906b5999c5051]::ty::ParamEnvAnd<rustc_middle[be1906b5999c5051]::ty::predicate::Predicate>>, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 2usize]>>>::{closure#0}, core[13d6f8de8fa2646b]::option::Option<(rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 2usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>>::{closure#0}, core[13d6f8de8fa2646b]::option::Option<(rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 2usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>>
14: 0x7ff979ca2b19 - rustc_query_impl[545e00a1719b0118]::execution::try_execute_query::<rustc_middle[be1906b5999c5051]::query::caches::DefaultCache<rustc_type_ir[4a3cb01a6b641947]::canonical::CanonicalQueryInput<rustc_middle[be1906b5999c5051]::ty::context::TyCtxt, rustc_middle[be1906b5999c5051]::ty::ParamEnvAnd<rustc_middle[be1906b5999c5051]::ty::predicate::Predicate>>, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 2usize]>>, true>
15: 0x7ff979e2f92f - rustc_query_impl[545e00a1719b0118]::query_impl::evaluate_obligation::execute_query_incr::__rust_end_short_backtrace
16: 0x7ff97a554c28 - <rustc_infer[d9a935eeb29f8b5c]::infer::InferCtxt as rustc_trait_selection[a5304aa0c53b9a09]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
17: 0x7ff97a554daa - <rustc_infer[d9a935eeb29f8b5c]::infer::InferCtxt as rustc_trait_selection[a5304aa0c53b9a09]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
18: 0x7ff97a67a958 - <rustc_trait_selection[a5304aa0c53b9a09]::traits::fulfill::FulfillProcessor>::process_trait_obligation
19: 0x7ff97a68c5d7 - <rustc_trait_selection[a5304aa0c53b9a09]::traits::fulfill::FulfillProcessor as rustc_data_structures[f0f68af8e28217e5]::obligation_forest::ObligationProcessor>::process_obligation
20: 0x7ff97a6508be - <rustc_data_structures[f0f68af8e28217e5]::obligation_forest::ObligationForest<rustc_trait_selection[a5304aa0c53b9a09]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[a5304aa0c53b9a09]::traits::fulfill::FulfillProcessor>
21: 0x7ff977fba581 - <rustc_trait_selection[a5304aa0c53b9a09]::traits::fulfill::FulfillmentContext<rustc_trait_selection[a5304aa0c53b9a09]::traits::FulfillmentError> as rustc_infer[d9a935eeb29f8b5c]::traits::engine::TraitEngine<rustc_trait_selection[a5304aa0c53b9a09]::traits::FulfillmentError>>::try_evaluate_obligations
22: 0x7ff977df55d9 - <rustc_hir_typeck[5bc60d0a485b6cb]::fn_ctxt::FnCtxt>::type_inference_fallback
23: 0x7ff977fa6392 - rustc_hir_typeck[5bc60d0a485b6cb]::typeck_with_inspect
24: 0x7ff979e88e3b - rustc_query_impl[545e00a1719b0118]::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
25: 0x7ff979d60a71 - rustc_middle[be1906b5999c5051]::ty::context::tls::with_context_opt::<rustc_middle[be1906b5999c5051]::ty::context::tls::with_context<rustc_middle[be1906b5999c5051]::dep_graph::with_deps<rustc_query_impl[545e00a1719b0118]::execution::execute_job_incr<rustc_data_structures[f0f68af8e28217e5]::vec_cache::VecCache<rustc_hir_id[503c5d8d8a01e8e7]::OwnerId, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex>>::{closure#1}::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>>::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>>::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>>
26: 0x7ff979d34ce3 - <std[975dac06280ee588]::thread::local::LocalKey<core[13d6f8de8fa2646b]::cell::Cell<*const ()>>>::with::<rustc_middle[be1906b5999c5051]::ty::context::tls::enter_context<rustc_query_impl[545e00a1719b0118]::execution::execute_job_incr<rustc_data_structures[f0f68af8e28217e5]::vec_cache::VecCache<rustc_span[d249aa4da89d9988]::def_id::LocalDefId, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex>>::{closure#1}, (rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>
27: 0x7ff979c50cd4 - rustc_query_impl[545e00a1719b0118]::execution::try_execute_query::<rustc_data_structures[f0f68af8e28217e5]::vec_cache::VecCache<rustc_span[d249aa4da89d9988]::def_id::LocalDefId, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex>, true>
28: 0x7ff979f30215 - rustc_query_impl[545e00a1719b0118]::query_impl::typeck_root::execute_query_incr::__rust_end_short_backtrace
29: 0x7ff9782cefb4 - <rustc_middle[be1906b5999c5051]::query::plumbing::TyCtxtEnsureOk>::typeck::<rustc_span[d249aa4da89d9988]::def_id::LocalDefId>
30: 0x7ff978430a65 - <rustc_middle[be1906b5999c5051]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[15a4cfb08166e2b8]::check_crate::{closure#1}>::{closure#0}
31: 0x7ff97842d39c - rustc_data_structures[f0f68af8e28217e5]::sync::parallel::par_for_each_in::<&rustc_span[d249aa4da89d9988]::def_id::LocalDefId, &[rustc_span[d249aa4da89d9988]::def_id::LocalDefId], <rustc_middle[be1906b5999c5051]::ty::context::TyCtxt>::par_hir_body_owners<rustc_hir_analysis[15a4cfb08166e2b8]::check_crate::{closure#1}>::{closure#0}>
32: 0x7ff978284f8e - rustc_hir_analysis[15a4cfb08166e2b8]::check_crate
33: 0x7ff977b3a2af - rustc_interface[de74aac462be2857]::passes::analysis
34: 0x7ff979ecb2fa - rustc_query_impl[545e00a1719b0118]::query_impl::analysis::invoke_provider_fn::__rust_begin_short_backtrace
35: 0x7ff979d62963 - rustc_middle[be1906b5999c5051]::ty::context::tls::with_context_opt::<rustc_middle[be1906b5999c5051]::ty::context::tls::with_context<rustc_middle[be1906b5999c5051]::dep_graph::with_deps<rustc_query_impl[545e00a1719b0118]::execution::execute_job_incr<rustc_middle[be1906b5999c5051]::query::caches::SingleCache<rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>>::{closure#1}::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>::{closure#0}, rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>
36: 0x7ff979d3e024 - <std[975dac06280ee588]::thread::local::LocalKey<core[13d6f8de8fa2646b]::cell::Cell<*const ()>>>::with::<rustc_middle[be1906b5999c5051]::ty::context::tls::enter_context<rustc_query_impl[545e00a1719b0118]::execution::execute_job_incr<rustc_middle[be1906b5999c5051]::query::caches::SingleCache<rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>>::{closure#1}, (rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>, rustc_middle[be1906b5999c5051]::dep_graph::graph::DepNodeIndex)>
37: 0x7ff979c745f9 - rustc_query_impl[545e00a1719b0118]::execution::try_execute_query::<rustc_middle[be1906b5999c5051]::query::caches::SingleCache<rustc_middle[be1906b5999c5051]::query::erase::ErasedData<[u8; 0usize]>>, true>
38: 0x7ff979e3ae9f - rustc_query_impl[545e00a1719b0118]::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace
39: 0x7ff9777cd995 - <std[975dac06280ee588]::thread::local::LocalKey<core[13d6f8de8fa2646b]::cell::Cell<*const ()>>>::with::<rustc_middle[be1906b5999c5051]::ty::context::tls::enter_context<<rustc_middle[be1906b5999c5051]::ty::context::GlobalCtxt>::enter<rustc_interface[de74aac462be2857]::passes::create_and_enter_global_ctxt<core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>, rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>>::{closure#1}, core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>>::{closure#0}, core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>>
40: 0x7ff97778b915 - <rustc_middle[be1906b5999c5051]::ty::context::TyCtxt>::create_global_ctxt::<core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>, rustc_interface[de74aac462be2857]::passes::create_and_enter_global_ctxt<core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>, rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
41: 0x7ff97783f6db - rustc_interface[de74aac462be2857]::passes::create_and_enter_global_ctxt::<core[13d6f8de8fa2646b]::option::Option<rustc_interface[de74aac462be2857]::queries::Linker>, rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}::{closure#2}>
42: 0x7ff97780e287 - rustc_interface[de74aac462be2857]::interface::run_compiler::<(), rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}>::{closure#1}
43: 0x7ff977801e8e - <scoped_tls[9905f0651e59278e]::ScopedKey<rustc_span[d249aa4da89d9988]::SessionGlobals>>::set::<rustc_interface[de74aac462be2857]::util::run_in_thread_with_globals<rustc_interface[de74aac462be2857]::util::run_in_thread_pool_with_globals<rustc_interface[de74aac462be2857]::interface::run_compiler<(), rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
44: 0x7ff9777cd3da - rustc_span[d249aa4da89d9988]::create_session_globals_then::<(), rustc_interface[de74aac462be2857]::util::run_in_thread_with_globals<rustc_interface[de74aac462be2857]::util::run_in_thread_pool_with_globals<rustc_interface[de74aac462be2857]::interface::run_compiler<(), rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
45: 0x7ff9777bc394 - std[975dac06280ee588]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[de74aac462be2857]::util::run_in_thread_with_globals<rustc_interface[de74aac462be2857]::util::run_in_thread_pool_with_globals<rustc_interface[de74aac462be2857]::interface::run_compiler<(), rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
46: 0x7ff97780eb6c - <std[975dac06280ee588]::thread::lifecycle::spawn_unchecked<rustc_interface[de74aac462be2857]::util::run_in_thread_with_globals<rustc_interface[de74aac462be2857]::util::run_in_thread_pool_with_globals<rustc_interface[de74aac462be2857]::interface::run_compiler<(), rustc_driver_impl[a32bea28605b67b1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[13d6f8de8fa2646b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
47: 0x7ffa099558f3 - <alloc[6a4def3c5115624e]::boxed::Box<dyn core[13d6f8de8fa2646b]::ops::function::FnOnce<(), Output = ()> + core[13d6f8de8fa2646b]::marker::Send> as core[13d6f8de8fa2646b]::ops::function::FnOnce<()>>::call_once
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\alloc\src/boxed.rs:2277:9
48: 0x7ffa099558f3 - <std[975dac06280ee588]::sys::thread::windows::Thread>::new::thread_start
at /rustc/b30f3df3ba3c4c9de2f58f1a75dd9500b79b3f8d/library\std\src\sys\thread/windows.rs:58:13
49: 0x7ffa3c7ce957 - <unknown>
50: 0x7ffa3d687c1c - <unknown>
rustc version: 1.98.0-nightly (b30f3df3b 2026-06-11)
platform: x86_64-pc-windows-gnu
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `alloc::boxed::Box<S>: core::marker::Sync`
#1 [typeck_root] type-checking `main`
#2 [analysis] running analysis passes on crate `ice`
end of query stack
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two-stage incremental build using the supplied Rust code and -Znext-solver=coherence, then inspect compiler/rustc_middle/src/verify_ich.rs and the evaluate_obligation path shown in the backtrace. Compare behavior with -Znext-solver=globally and the bisected commit. Done means the invalid foo diagnostic remains, but the incremental compilation error and ICE no longer occur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100