Skip to content

[ICE]: assumptions on binders: item_bounds called on DefId #157774

@matthiaskrgr

Description

@matthiaskrgr

Code

//@compile-flags: -Znext-solver=globally -Zassumptions-on-binders
#![feature(inherent_associated_types)]
struct Foo<'a> {
    x: &'a (),
}
impl<'a> Foo<'a> {
    type Assoc = &'a Foo<'a>::Assoc;
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.98.0-nightly (485ec3fbc 2026-06-10)
binary: rustc
commit-hash: 485ec3fbcc12fa14ef6596dabb125ad710499c9e
commit-date: 2026-06-10
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Error output

<output>
Backtrace

warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./code.rs:1:12
  |
1 | #![feature(inherent_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0271]: type mismatch resolving `Foo<'a>::Assoc normalizes-to &_`
 --> ./code.rs:6:5
  |
6 |     type Assoc = &'a Foo<'a>::Assoc;
  |     ^^^^^^^^^^ types differ

error: internal compiler error: /rustc-dev/485ec3fbcc12fa14ef6596dabb125ad710499c9e/compiler/rustc_hir_analysis/src/collect/item_bounds.rs:486:17: item_bounds called on DefId(0:8 ~ code[92e0]::{impl#0}::Assoc) => ImplItem(ImplItem { ident: Assoc#0, owner_id: DefId(0:8 ~ code[92e0]::{impl#0}::Assoc), generics: Generics { params: [], predicates: [], has_where_clause_predicates: false, where_clause_span: ./code.rs:6:36: 6:36 (#0), span: ./code.rs:6:15: 6:15 (#0) }, kind: Type(Ty { hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).7), span: ./code.rs:6:18: 6:36 (#0), kind: Ref(Lifetime { hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).1), ident: 'a#0, kind: Param(DefId(0:7 ~ code[92e0]::{impl#0}::'a)), source: Reference, syntax: ExplicitBound }, MutTy { ty: Ty { hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).2), span: ./code.rs:6:22: 6:36 (#0), kind: Path(TypeRelative(Ty { hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).5), span: ./code.rs:6:22: 6:29 (#0), kind: Path(Resolved(None, Path { span: ./code.rs:6:22: 6:29 (#0), res: Def(Struct, DefId(0:3 ~ code[92e0]::Foo)), segments: [PathSegment { ident: Foo#0, hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).4), res: Def(Struct, DefId(0:3 ~ code[92e0]::Foo)), args: Some(GenericArgs { args: [Lifetime(Lifetime { hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).3), ident: 'a#0, kind: Param(DefId(0:7 ~ code[92e0]::{impl#0}::'a)), source: Path { angle_brackets: Full }, syntax: ExplicitBound })], constraints: [], parenthesized: No, span_ext: ./code.rs:6:25: 6:29 (#0) }), infer_args: false }] })) }, PathSegment { ident: Assoc#0, hir_id: HirId(DefId(0:8 ~ code[92e0]::{impl#0}::Assoc).6), res: Err, args: None, infer_args: false })) }, mutbl: Not }) }), impl_kind: Inherent { vis_span: ./code.rs:6:5: 6:5 (#0) }, span: ./code.rs:6:5: 6:37 (#0), has_delayed_lints: false })


thread 'rustc' (2066695) panicked at /rustc-dev/485ec3fbcc12fa14ef6596dabb125ad710499c9e/compiler/rustc_hir_analysis/src/collect/item_bounds.rs:486:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f10932ac6c9 - <<std[3e0755d7ee10f1c0]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[53a3f952d0a3e8e5]::fmt::Display>::fmt
   1:     0x7f1093a17648 - core[53a3f952d0a3e8e5]::fmt::write
   2:     0x7f10932c2756 - <std[3e0755d7ee10f1c0]::sys::stdio::unix::Stderr as std[3e0755d7ee10f1c0]::io::Write>::write_fmt
   3:     0x7f1093281e5e - std[3e0755d7ee10f1c0]::panicking::default_hook::{closure#0}
   4:     0x7f109329f623 - std[3e0755d7ee10f1c0]::panicking::default_hook
   5:     0x7f109208f031 - std[3e0755d7ee10f1c0]::panicking::update_hook::<alloc[a394d862aa68610c]::boxed::Box<rustc_driver_impl[61600b431d86695d]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f109329f902 - std[3e0755d7ee10f1c0]::panicking::panic_with_hook
   7:     0x7f10920bcca1 - std[3e0755d7ee10f1c0]::panicking::begin_panic::<rustc_errors[ee594b6ed387c9a3]::ExplicitBug>::{closure#0}
   8:     0x7f10920b5a16 - std[3e0755d7ee10f1c0]::sys::backtrace::__rust_end_short_backtrace::<std[3e0755d7ee10f1c0]::panicking::begin_panic<rustc_errors[ee594b6ed387c9a3]::ExplicitBug>::{closure#0}, !>
   9:     0x7f10920b39a7 - std[3e0755d7ee10f1c0]::panicking::begin_panic::<rustc_errors[ee594b6ed387c9a3]::ExplicitBug>
  10:     0x7f10920c7cd1 - <rustc_errors[ee594b6ed387c9a3]::diagnostic::BugAbort as rustc_errors[ee594b6ed387c9a3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f109275b319 - rustc_middle[50c0d6b250d15545]::util::bug::opt_span_bug_fmt::<rustc_span[59dee30aae84166]::span_encoding::Span>::{closure#0}
  12:     0x7f109275b482 - rustc_middle[50c0d6b250d15545]::ty::context::tls::with_opt::<rustc_middle[50c0d6b250d15545]::util::bug::opt_span_bug_fmt<rustc_span[59dee30aae84166]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f1092749b3b - rustc_middle[50c0d6b250d15545]::ty::context::tls::with_context_opt::<rustc_middle[50c0d6b250d15545]::ty::context::tls::with_opt<rustc_middle[50c0d6b250d15545]::util::bug::opt_span_bug_fmt<rustc_span[59dee30aae84166]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f108f767044 - rustc_middle[50c0d6b250d15545]::util::bug::bug_fmt
  15:     0x7f1094b83aa8 - rustc_hir_analysis[8d3cdd21889740d0]::collect::item_bounds::explicit_item_bounds_with_filter
  16:     0x7f1094b8376e - rustc_hir_analysis[8d3cdd21889740d0]::collect::item_bounds::explicit_item_self_bounds
  17:     0x7f1094b84316 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::explicit_item_self_bounds::invoke_provider_fn::__rust_begin_short_backtrace
  18:     0x7f1093c69645 - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_middle[50c0d6b250d15545]::query::caches::DefIdCache<rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 16usize]>>, false>
  19:     0x7f1093eb89cd - rustc_query_impl[fe6d0954731ad3fa]::query_impl::explicit_item_self_bounds::execute_query_non_incr::__rust_end_short_backtrace
  20:     0x7f1093eb86cd - rustc_hir_analysis[8d3cdd21889740d0]::collect::item_bounds::item_self_bounds
  21:     0x7f1093a2484d - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_middle[50c0d6b250d15545]::query::caches::DefIdCache<rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 8usize]>>, false>
  22:     0x7f10949a3e54 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::item_self_bounds::execute_query_non_incr::__rust_end_short_backtrace
  23:     0x7f10943d98ed - <rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt as rustc_type_ir[4e08b533ed31ae3f]::interner::Interner>::item_self_bounds
  24:     0x7f1092fefe74 - <rustc_next_trait_solver[7474f56787e62491]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[3655874cae0de3f5]::solve::delegate::SolverDelegate, rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt>>::destructure_components
  25:     0x7f1095095b84 - <rustc_next_trait_solver[7474f56787e62491]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[3655874cae0de3f5]::solve::delegate::SolverDelegate, rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt>>::compute_type_outlives_goal
  26:     0x7f10944d0db8 - <rustc_next_trait_solver[7474f56787e62491]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[3655874cae0de3f5]::solve::delegate::SolverDelegate> as rustc_type_ir[4e08b533ed31ae3f]::search_graph::Delegate>::compute_goal::{closure#0}
  27:     0x7f10944ccd1d - <rustc_type_ir[4e08b533ed31ae3f]::search_graph::SearchGraph<rustc_next_trait_solver[7474f56787e62491]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[3655874cae0de3f5]::solve::delegate::SolverDelegate>, rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt>>::evaluate_goal_in_task
  28:     0x7f10944cbfe8 - rustc_trait_selection[3655874cae0de3f5]::solve::evaluate_root_goal_for_proof_tree_raw
  29:     0x7f10944cbe18 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::evaluate_root_goal_for_proof_tree_raw::invoke_provider_fn::__rust_begin_short_backtrace
  30:     0x7f10944ca9a3 - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_middle[50c0d6b250d15545]::query::caches::DefaultCache<rustc_type_ir[4e08b533ed31ae3f]::canonical::CanonicalQueryInput<rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt, rustc_type_ir[4e08b533ed31ae3f]::solve::QueryInput<rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt, rustc_middle[50c0d6b250d15545]::ty::predicate::Predicate>>, rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 48usize]>>, false>
  31:     0x7f10944ca5cb - rustc_query_impl[fe6d0954731ad3fa]::query_impl::evaluate_root_goal_for_proof_tree_raw::execute_query_non_incr::__rust_end_short_backtrace
  32:     0x7f1090f76106 - <rustc_middle[50c0d6b250d15545]::ty::context::TyCtxt as rustc_type_ir[4e08b533ed31ae3f]::interner::Interner>::evaluate_root_goal_for_proof_tree_raw
  33:     0x7f1094c9d6e4 - <rustc_trait_selection[3655874cae0de3f5]::solve::delegate::SolverDelegate as rustc_next_trait_solver[7474f56787e62491]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal_for_proof_tree
  34:     0x7f1094c9cbd3 - <rustc_trait_selection[3655874cae0de3f5]::solve::inspect::analyse::InspectCandidate>::instantiate_proof_tree_for_nested_goal
  35:     0x7f1094ca1e0a - <rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::derive_errors::BestObligation as rustc_trait_selection[3655874cae0de3f5]::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
  36:     0x7f1094ca0850 - <rustc_infer[13cc7dad91134d3]::infer::InferCtxt as rustc_trait_selection[3655874cae0de3f5]::solve::inspect::analyse::InferCtxtProofTreeExt>::visit_proof_tree_at_depth::<rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::derive_errors::BestObligation>
  37:     0x7f10946a29f6 - rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::derive_errors::find_best_leaf_obligation
  38:     0x7f10946a216f - <rustc_trait_selection[3655874cae0de3f5]::traits::FulfillmentError as rustc_infer[13cc7dad91134d3]::traits::engine::FromSolverError<rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::NextSolverError>>::from_solver_error
  39:     0x7f10944eb35a - <rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[3655874cae0de3f5]::traits::FulfillmentError> as rustc_infer[13cc7dad91134d3]::traits::engine::TraitEngine<rustc_trait_selection[3655874cae0de3f5]::traits::FulfillmentError>>::try_evaluate_obligations
  40:     0x7f10944eab61 - <rustc_trait_selection[3655874cae0de3f5]::solve::fulfill::FulfillmentCtxt<rustc_trait_selection[3655874cae0de3f5]::traits::FulfillmentError> as rustc_infer[13cc7dad91134d3]::traits::engine::TraitEngine<rustc_trait_selection[3655874cae0de3f5]::traits::FulfillmentError>>::evaluate_obligations_error_on_ambiguity
  41:     0x7f10943caa9d - rustc_hir_analysis[8d3cdd21889740d0]::check::wfcheck::enter_wf_checking_ctxt::<rustc_hir_analysis[8d3cdd21889740d0]::check::wfcheck::check_associated_item::{closure#0}>
  42:     0x7f1094202f00 - rustc_hir_analysis[8d3cdd21889740d0]::check::check::check_item_type
  43:     0x7f10941fbca6 - rustc_hir_analysis[8d3cdd21889740d0]::check::wfcheck::check_well_formed
  44:     0x7f10941fbc87 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  45:     0x7f10941fb272 - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_data_structures[e395eede3e8835c3]::vec_cache::VecCache<rustc_span[59dee30aae84166]::def_id::LocalDefId, rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[50c0d6b250d15545]::dep_graph::graph::DepNodeIndex>, false>
  46:     0x7f10941fb007 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  47:     0x7f10941f7960 - rustc_hir_analysis[8d3cdd21889740d0]::check::wfcheck::check_type_wf
  48:     0x7f10941f7855 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  49:     0x7f1094c5f54d - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_middle[50c0d6b250d15545]::query::caches::SingleCache<rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 1usize]>>, false>
  50:     0x7f1094c5f329 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  51:     0x7f109421cb9b - rustc_hir_analysis[8d3cdd21889740d0]::check_crate
  52:     0x7f10941059bf - rustc_interface[e1940d23c19151a4]::passes::analysis
  53:     0x7f1094c61b06 - rustc_query_impl[fe6d0954731ad3fa]::execution::try_execute_query::<rustc_middle[50c0d6b250d15545]::query::caches::SingleCache<rustc_middle[50c0d6b250d15545]::query::erase::ErasedData<[u8; 0usize]>>, false>
  54:     0x7f1094c617e9 - rustc_query_impl[fe6d0954731ad3fa]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  55:     0x7f1094c1e55a - rustc_interface[e1940d23c19151a4]::interface::run_compiler::<(), rustc_driver_impl[61600b431d86695d]::run_compiler::{closure#0}>::{closure#1}
  56:     0x7f1094c4e13a - std[3e0755d7ee10f1c0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e1940d23c19151a4]::util::run_in_thread_with_globals<rustc_interface[e1940d23c19151a4]::util::run_in_thread_pool_with_globals<rustc_interface[e1940d23c19151a4]::interface::run_compiler<(), rustc_driver_impl[61600b431d86695d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  57:     0x7f1094c4deed - <std[3e0755d7ee10f1c0]::thread::lifecycle::spawn_unchecked<rustc_interface[e1940d23c19151a4]::util::run_in_thread_with_globals<rustc_interface[e1940d23c19151a4]::util::run_in_thread_pool_with_globals<rustc_interface[e1940d23c19151a4]::interface::run_compiler<(), rustc_driver_impl[61600b431d86695d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[53a3f952d0a3e8e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x7f1094c44590 - <std[3e0755d7ee10f1c0]::sys::thread::unix::Thread>::new::thread_start
  59:     0x7f108e0981b9 - <unknown>
  60:     0x7f108e11d21c - <unknown>
  61:                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-2026-06-11T15_10_40-2066685.txt` to your bug report

note: rustc 1.98.0-nightly (485ec3fbc 2026-06-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z assumptions-on-binders

query stack during panic:
#0 [explicit_item_self_bounds] finding item bounds for `<impl at ./code.rs:5:1: 5:17>::Assoc`
#1 [item_self_bounds] elaborating item assumptions for `<impl at ./code.rs:5:1: 5:17>::Assoc`
#2 [evaluate_root_goal_for_proof_tree_raw] computing proof tree for `Foo<'_>::Assoc: '_`
#3 [check_well_formed] checking that `<impl at ./code.rs:5:1: 5:17>::Assoc` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `code`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zassumptions-on-bindersUnstable option: `-Zassumptions-on-bindersC-bugCategory: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]`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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions