Open
Description
Code
Hand-reduced
#![feature(associated_const_equality)]
trait Trait {
type TT;
}
pub struct NoPin;
pub trait PinA<PER> {
const A: u8;
}
impl<PER> PinA<PER> for NoPin {
const A: u8 = 0;
}
pub trait Pins<USART> {}
impl<USART, T> Pins<USART> for T where T: PinA<USART, A = 42> {}
struct S<T> {
x: T,
}
impl<T> S<&dyn Trait> where NoPin: Pins<T> {}
fn main() {}
A mutant of tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs
Meta
rustc --version --verbose
:
rustc 1.89.0-nightly (99e7c15e8 2025-06-01)
binary: rustc
commit-hash: 99e7c15e81385b38a8186b51edc4577d5d7b5bdd
commit-date: 2025-06-01
host: aarch64-apple-darwin
release: 1.89.0-nightly
LLVM version: 20.1.5
Error output
command: rustc
error[E0191]: the value of the associated type `TT` in `Trait` must be specified
--> afidt_1_c2.rs:25:16
|
4 | type TT;
| ------- `TT` defined here
...
25 | impl<T> S<&dyn Trait> where NoPin: Pins<T> {}
| ^^^^^ help: specify the associated type: `Trait<TT = Type>`
thread 'rustc' panicked at /rustc/99e7c15e81385b38a8186b51edc4577d5d7b5bdd/compiler/rustc_type_ir/src/binder.rs:753:9:
type parameter `T/#1` (T/#1/1) out of range when instantiating, args=[?2t]
Backtrace
thread 'rustc' panicked at /rustc/99e7c15e81385b38a8186b51edc4577d5d7b5bdd/compiler/rustc_type_ir/src/binder.rs:753:9:
type parameter `T/#1` (T/#1/1) out of range when instantiating, args=[?2t]
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>::type_param_out_of_range
3: <rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
4: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>
5: <rustc_middle::ty::consts::Const as rustc_type_ir::fold::TypeSuperFoldable<rustc_middle::ty::context::TyCtxt>>::super_fold_with::<rustc_type_ir::binder::ArgFolder<rustc_middle::ty::context::TyCtxt>>
6: rustc_trait_selection::traits::project::opt_normalize_projection_term
7: <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}>
8: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively::{closure#0}::{closure#0}
9: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
10: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_candidate::{closure#0}::{closure#0}
11: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>, <rustc_trait_selection::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_candidate::{closure#0}::{closure#0}>::{closure#0}>
12: <rustc_trait_selection::traits::select::SelectionContext>::in_task::<<rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>::{closure#0}
13: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation
14: <rustc_trait_selection::traits::select::SelectionContext>::poly_select::{closure#0}
15: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::process_trait_obligation
16: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
17: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
18: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::select_where_possible
19: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::select_all_or_error
20: rustc_hir_analysis::check::wfcheck::check_item
21: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
22: <rustc_middle::hir::ModuleItems>::par_opaques::<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#4}>::{closure#0}
23: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
24: rustc_hir_analysis::check_crate
25: rustc_interface::passes::run_required_analyses
26: rustc_interface::passes::analysis
[... omitted 1 frame ...]
27: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
28: 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.
error: the compiler unexpectedly panicked. this is a bug.
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 `/Users/jisukbyun/workspace/250203 scratch/rustc-ice-2025-06-02T15_09_43-2051.txt` to your bug report
query stack during panic:
#0 [check_well_formed] checking that `<impl at afidt_1_c2.rs:25:1: 25:43>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0191`.
Bisects to
searched nightlies: from nightly-2025-01-01 to nightly-2025-06-01
regressed nightly: nightly-2025-05-24
searched commit range: 2eef478...3e674b0
regressed commit: 52bf0cf
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --end=2025-06-01 --regress ice --preserve --script rustc -- afidt_1_c2.rs
Notes
-
ICE location:
compiler/rustc_type_ir/src/binder.rs Line-753
rust/compiler/rustc_type_ir/src/binder.rs
Lines 752 to 760 in 99e7c15
-
Other open ICE issues of "type parameter ... out of range when instantiating" requires different features
@rustbot label +F-associated_const_equality
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(associated_const_equality)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Can Do