Skip to content

Commit

Permalink
Merge #11840
Browse files Browse the repository at this point in the history
11840: Fix another const generic panic r=flodiebold a=HKalbasi

fix #11835

If I change `dyn` to `impl` in the test, it will infer the type as `IntoIterator::Item<impl Iterator<Item = [Ar<u8, 7>; 9]> + ?Sized>` instead of `[Ar<u8, 7>; 9]`. Maybe it needs some action?

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
bors[bot] and HKalbasi authored Mar 29, 2022
2 parents bc08b8e + 4fe0545 commit 89d495e
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/hir_ty/src/lower.rs
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ impl<'a> TyLoweringContext<'a> {
len,
self.type_param_mode,
|| self.generics(),
DebruijnIndex::INNERMOST,
self.in_binders,
);

TyKind::Array(inner_ty, const_len).intern(Interner)
@@ -728,7 +728,7 @@ impl<'a> TyLoweringContext<'a> {
c,
self.type_param_mode,
|| self.generics(),
DebruijnIndex::INNERMOST,
self.in_binders,
)
},
) {
20 changes: 20 additions & 0 deletions crates/hir_ty/src/tests/regression.rs
Original file line number Diff line number Diff line change
@@ -1477,3 +1477,23 @@ fn regression_11688_2() {
"#,
);
}

#[test]
fn regression_11688_3() {
check_types(
r#"
//- minicore: iterator
struct Ar<T, const N: u8>(T);
fn f<const LEN: usize, T, const BASE: u8>(
num_zeros: usize,
) -> dyn Iterator<Item = [Ar<T, BASE>; LEN]> {
loop {}
}
fn dynamic_programming() {
for board in f::<9, u8, 7>(1) {
//^^^^^ [Ar<u8, 7>; 9]
}
}
"#,
);
}

0 comments on commit 89d495e

Please sign in to comment.