1
Fork 0

Rollup merge of #137617 - BoxyUwU:generic_const_parameter_types, r=lcnr

Introduce `feature(generic_const_parameter_types)`

Allows to define const generic parameters whose type depends on other generic parameters, e.g. `Foo<const N: usize, const ARR: [u8; N]>;`

Wasn't going to implement for this for a while until we could implement it with `bad_inference.rs` resolved but apparently the project simd folks would like to be able to use this for some intrinsics and the inference issue isn't really a huge problem there aiui. (cc ``@workingjubilee`` )
This commit is contained in:
Matthias Krüger 2025-03-01 11:33:58 +01:00 committed by GitHub
commit 415b207b7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 419 additions and 154 deletions

View file

@ -342,6 +342,7 @@ impl ParamConst {
ParamConst::new(def.index, def.name)
}
#[instrument(level = "debug")]
pub fn find_ty_from_env<'tcx>(self, env: ParamEnv<'tcx>) -> Ty<'tcx> {
let mut candidates = env.caller_bounds().iter().filter_map(|clause| {
// `ConstArgHasType` are never desugared to be higher ranked.