Skip to content

ICE: impl xxx was matchable against Binder xxx but now is not #149015

Description

@rucsesec

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`.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Nov 17, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 17, 2025
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 28, 2025
  4. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.
    on Sep 7, 2026
  5. added
    fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.
    on Oct 6, 2026
  6. added 3 commits that reference this issue on Oct 7, 2026
  7. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions