fix regression_11688_2

This commit is contained in:
hkalbasi 2022-03-17 12:45:04 +03:30
parent 3bff42fd14
commit 0141f28475
2 changed files with 24 additions and 1 deletions

View File

@ -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,

View File

@ -1454,3 +1454,26 @@ fn encode(self, w: &mut Writer, _: &mut S) {
"#,
);
}
#[test]
fn regression_11688_2() {
check_types(
r#"
union MaybeUninit<T> {
uninit: (),
value: T,
}
impl<T> MaybeUninit<T> {
fn uninit_array<const LEN: usize>() -> [Self; LEN] {
loop {}
}
}
fn main() {
let x = MaybeUninit::<i32>::uninit_array::<1>();
//^ [MaybeUninit<i32>; 1]
}
"#,
);
}