Skip to content

ICE: overflow evaluating the requirement / impl was matchable against binder but now it is not #141124

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

trait a {
    type b;
}
impl<c> a for c
where
    c: d,
{
    type b = <(c,) as a>::b;
}
trait d {}
struct e;
impl d for <e as a>::b {}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (16d2276fa 2025-05-16)
binary: rustc
commit-hash: 16d2276fa6fccb0cc239a542d4c3f0eb46f660ec
commit-date: 2025-05-16
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4

Error output

warning: trait `a` should have an upper camel case name
 --> code.rs:1:7
  |
1 | trait a {
  |       ^ help: convert the identifier to upper camel case: `A`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

warning: associated type `b` should have an upper camel case name
 --> code.rs:2:10
  |
2 |     type b;
  |          ^ help: convert the identifier to upper camel case: `B`

warning: type parameter `c` should have an upper camel case name
 --> code.rs:4:6
  |
4 | impl<c> a for c
  |      ^ help: convert the identifier to upper camel case (notice the capitalization): `C`

warning: trait `d` should have an upper camel case name
  --> code.rs:10:7
   |
10 | trait d {}
   |       ^ help: convert the identifier to upper camel case: `D`

warning: type `e` should have an upper camel case name
  --> code.rs:11:8
   |
11 | struct e;
   |        ^ help: convert the identifier to upper camel case: `E`

error[E0275]: overflow evaluating the requirement `(((((((...,),),),),),),): Sized`
 --> code.rs:8:14
  |
8 |     type b = <(c,) as a>::b;
  |              ^^^^^^^^^^^^^^
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`code`)
note: required for `(((((((((((((((((((((((((((((((((((((((((((((((((((...,),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),)` to implement `a`
 --> code.rs:4:9
  |
4 | impl<c> a for c
  |      -  ^     ^
  |      |
  |      unsatisfied trait bound introduced here
  = note: the full name for the type has been written to 'code.long-type-5344617421428250298.txt'
  = note: consider using `--verbose` to print the full type name to the console
Backtrace

error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/mod.rs:2463:17: impl DefId(0:11 ~ code[7efa]::{impl#1}) was matchable against Binder { value: TraitPredicate(<((e,),) as d>, polarity:Positive), bound_vars: [] } but now is not


thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/select/mod.rs:2463:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f6eca165b33 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8ce760ad42a959df
   1:     0x7f6eca805977 - core::fmt::write::h17deacb9d093717d
   2:     0x7f6ecb85bdd1 - std::io::Write::write_fmt::h8edc637e3ed34e58
   3:     0x7f6eca165992 - std::sys::backtrace::BacktraceLock::print::hf4e931b5b8f47af6
   4:     0x7f6eca16958a - std::panicking::default_hook::{{closure}}::h1aa602af6f79c655
   5:     0x7f6eca16910f - std::panicking::default_hook::hb6d5039bf2b4cecd
   6:     0x7f6ec9194e13 - std[23b1014898398f3a]::panicking::update_hook::<alloc[189bd33173793ff9]::boxed::Box<rustc_driver_impl[c8796dbdb0a790d0]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f6eca169e03 - std::panicking::rust_panic_with_hook::h1a38b2651d61b684
   8:     0x7f6ec91d1281 - std[23b1014898398f3a]::panicking::begin_panic::<rustc_errors[84d6361680d21c4f]::ExplicitBug>::{closure#0}
   9:     0x7f6ec91c5156 - std[23b1014898398f3a]::sys::backtrace::__rust_end_short_backtrace::<std[23b1014898398f3a]::panicking::begin_panic<rustc_errors[84d6361680d21c4f]::ExplicitBug>::{closure#0}, !>
  10:     0x7f6ec91c513b - std[23b1014898398f3a]::panicking::begin_panic::<rustc_errors[84d6361680d21c4f]::ExplicitBug>
  11:     0x7f6ec91db9f1 - <rustc_errors[84d6361680d21c4f]::diagnostic::BugAbort as rustc_errors[84d6361680d21c4f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f6ec984a14a - rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt::<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}
  13:     0x7f6ec982394a - rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_opt::<rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f6ec98237bb - rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_context_opt::<rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_opt<rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f6ec6a87ff0 - rustc_middle[3cba1f9493d37f78]::util::bug::bug_fmt
  16:     0x7f6eca99b058 - <rustc_trait_selection[c3f3da74ab5cc5d9]::traits::select::SelectionContext>::confirm_candidate
  17:     0x7f6ecb2cc36f - <rustc_trait_selection[c3f3da74ab5cc5d9]::traits::fulfill::FulfillProcessor as rustc_data_structures[766a8a49e9a623b6]::obligation_forest::ObligationProcessor>::process_obligation
  18:     0x7f6eca807fd5 - <rustc_data_structures[766a8a49e9a623b6]::obligation_forest::ObligationForest<rustc_trait_selection[c3f3da74ab5cc5d9]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[c3f3da74ab5cc5d9]::traits::fulfill::FulfillProcessor>
  19:     0x7f6ecafd43ab - <rustc_trait_selection[c3f3da74ab5cc5d9]::traits::fulfill::FulfillmentContext<rustc_trait_selection[c3f3da74ab5cc5d9]::traits::FulfillmentError> as rustc_infer[7388de4d28332a4e]::traits::engine::TraitEngine<rustc_trait_selection[c3f3da74ab5cc5d9]::traits::FulfillmentError>>::select_all_or_error
  20:     0x7f6ecb05fea8 - rustc_hir_analysis[2ff1991ffb30aa1a]::check::wfcheck::check_well_formed
  21:     0x7f6ecb05e90b - rustc_query_impl[efffa611636c8e5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[efffa611636c8e5b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 1usize]>>
  22:     0x7f6ecb05e1b1 - rustc_query_system[194713339954f907]::query::plumbing::try_execute_query::<rustc_query_impl[efffa611636c8e5b]::DynamicConfig<rustc_data_structures[766a8a49e9a623b6]::vec_cache::VecCache<rustc_span[10508ddd74bd9d4e]::def_id::LocalDefId, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[194713339954f907]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[efffa611636c8e5b]::plumbing::QueryCtxt, false>
  23:     0x7f6ecb05dca6 - rustc_query_impl[efffa611636c8e5b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f6ecb05b225 - rustc_hir_analysis[2ff1991ffb30aa1a]::check::wfcheck::check_mod_type_wf
  25:     0x7f6ecb05b01f - rustc_query_impl[efffa611636c8e5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[efffa611636c8e5b]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f6ecb7fc284 - rustc_query_system[194713339954f907]::query::plumbing::try_execute_query::<rustc_query_impl[efffa611636c8e5b]::DynamicConfig<rustc_query_system[194713339954f907]::query::caches::DefaultCache<rustc_span[10508ddd74bd9d4e]::def_id::LocalModDefId, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[efffa611636c8e5b]::plumbing::QueryCtxt, false>
  27:     0x7f6ecb7fc011 - rustc_query_impl[efffa611636c8e5b]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f6ecaae36ae - rustc_hir_analysis[2ff1991ffb30aa1a]::check_crate
  29:     0x7f6ecac41245 - rustc_interface[88f95fb9e776d181]::passes::run_required_analyses
  30:     0x7f6ecb6f8ade - rustc_interface[88f95fb9e776d181]::passes::analysis
  31:     0x7f6ecb6f8ab5 - rustc_query_impl[efffa611636c8e5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[efffa611636c8e5b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7f6ecb6fabba - rustc_query_system[194713339954f907]::query::plumbing::try_execute_query::<rustc_query_impl[efffa611636c8e5b]::DynamicConfig<rustc_query_system[194713339954f907]::query::caches::SingleCache<rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[efffa611636c8e5b]::plumbing::QueryCtxt, false>
  33:     0x7f6ecb6fa88f - rustc_query_impl[efffa611636c8e5b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f6ecb926607 - rustc_interface[88f95fb9e776d181]::passes::create_and_enter_global_ctxt::<core[64e60dbc053b37]::option::Option<rustc_interface[88f95fb9e776d181]::queries::Linker>, rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  35:     0x7f6ecb879ba6 - rustc_interface[88f95fb9e776d181]::interface::run_compiler::<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7f6ecb8528be - std[23b1014898398f3a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[88f95fb9e776d181]::util::run_in_thread_with_globals<rustc_interface[88f95fb9e776d181]::util::run_in_thread_pool_with_globals<rustc_interface[88f95fb9e776d181]::interface::run_compiler<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7f6ecb852d2b - <<std[23b1014898398f3a]::thread::Builder>::spawn_unchecked_<rustc_interface[88f95fb9e776d181]::util::run_in_thread_with_globals<rustc_interface[88f95fb9e776d181]::util::run_in_thread_pool_with_globals<rustc_interface[88f95fb9e776d181]::interface::run_compiler<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[64e60dbc053b37]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f6ecb85412b - std::sys::pal::unix::thread::Thread::new::thread_start::ha2537cf437130d92
  39:     0x7f6ec56a370a - <unknown>
  40:     0x7f6ec5727aac - <unknown>
  41:                0x0 - <unknown>

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 `/home/matthias/vcs/github/CRED/rustc-ice-2025-05-17T12_23_23-1960773.txt` to your bug report

query stack during panic:
#0 [check_well_formed] checking that `<impl at code.rs:12:1: 12:23>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 2 previous errors; 5 warnings emitted

For more information about this error, try `rustc --explain E0275`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: a bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-typesRelevant to the types team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions