diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 9e69785ac29..0854d065483 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -712,7 +712,7 @@ fn substs_from_path_segment( .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 63faecbfafa..7a7470fd354 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -1454,3 +1454,26 @@ fn encode(self, w: &mut Writer, _: &mut S) { "#, ); } + +#[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] + } + "#, + ); +}