ICE: impl xxx was matchable against Binder xxx but now is not
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code.
I think this issue is very similar to #141124, #122529, and #125014, but this one seems to involve a slightly different query stack, so I’m not sure whether it is a duplicate of any of them.
Code
trait Trait1 {
type Assoc;
}
trait Trait2 {}
impl Trait1 for <dyn Trait2 as Trait1>::Assoc {
type Assoc = ();
}
Meta
rustc --version --verbose:
rustc 1.93.0-nightly (e65b98316 2025-11-15)
binary: rustc
commit-hash: e65b983161d52688ff8e05245ed5dc70ef01a904
commit-date: 2025-11-15
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5
Program Output
error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/mod.rs:2496:17: impl DefId(0:6 ~ example[c63e]::{impl#0}) was matchable against Binder { value: TraitPredicate(<dyn Trait2 as Trait1>, polarity:Positive), bound_vars: [] } but now is not
thread 'rustc' (3) panicked at compiler/rustc_trait_selection/src/traits/select/mod.rs:2496:17:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: 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}, !>
5: rustc_middle::util::bug::bug_fmt
6: <rustc_trait_selection::traits::select::SelectionContext>::poly_select::{closure#0}
7: rustc_trait_selection::traits::project::opt_normalize_projection_term
8: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_term::{closure#0}>
9: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_root_obligation
10: rustc_traits::evaluate_obligation::evaluate_obligation
[... omitted 1 frame ...]
11: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
12: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
13: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
14: <rustc_trait_selection::traits::engine::ObligationCtxt<rustc_trait_selection::traits::FulfillmentError>>::assumed_wf_types_and_report_errors
15: rustc_hir_analysis::check::compare_impl_item::check_type_bounds
16: rustc_hir_analysis::check::compare_impl_item::compare_impl_item
[... omitted 1 frame ...]
17: rustc_hir_analysis::check::check::check_item_type
18: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
19: rustc_hir_analysis::check::wfcheck::check_type_wf
[... omitted 1 frame ...]
20: rustc_hir_analysis::check_crate
21: rustc_interface::passes::analysis
[... omitted 1 frame ...]
22: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
23: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
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: please make sure that you have updated to the latest nightly
note: please attach the file at `/app/rustc-ice-2025-11-17T06_38_33-1.txt` to your bug report
note: compiler flags: -C debuginfo=2 --crate-type bin -C linker=/opt/compiler-explorer/gcc-15.2.0/bin/gcc
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `<dyn Trait2 as Trait1>::Assoc == dyn Trait2`
#1 [compare_impl_item] checking assoc item `<impl at <source>:7:1: 7:46>::Assoc` is compatible with trait definition
#2 [check_well_formed] checking that `<impl at <source>:7:1: 7:46>` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `example`
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0601`.
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
Start by compiling the minimal example with the reported nightly version and inspect compiler/rustc_trait_selection/src/traits/select/mod.rs around line 2496. Trace the evaluate_obligation and compare_impl_item query entries shown in the stack. Done means the example no longer triggers an internal compiler error and instead receives a valid compiler result or diagnostic.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100