diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 9e69785ac2..0854d06548 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -712,7 +712,7 @@ impl<'a> TyLoweringContext<'a> { .filter(|arg| !matches!(arg, GenericArg::Lifetime(_))) .skip(skip) .take(expected_num) - .zip(def_generics.iter_id().skip(skip)) + .zip(def_generics.iter_id().skip(parent_params + skip)) { if let Some(x) = generic_arg_to_chalk( self.db, diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 63faecbfaf..7a7470fd35 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -1454,3 +1454,26 @@ fn regression_11688_1() { "#, ); } + +#[test] +fn regression_11688_2() { + check_types( + r#" + union MaybeUninit { + uninit: (), + value: T, + } + + impl MaybeUninit { + fn uninit_array() -> [Self; LEN] { + loop {} + } + } + + fn main() { + let x = MaybeUninit::::uninit_array::<1>(); + //^ [MaybeUninit; 1] + } + "#, + ); +}