Skip to content

Commit 89d495e

Browse files
bors[bot]HKalbasi
andauthored
Merge #11840
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 <[email protected]>
2 parents bc08b8e + 4fe0545 commit 89d495e

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

crates/hir_ty/src/lower.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a> TyLoweringContext<'a> {
205205
len,
206206
self.type_param_mode,
207207
|| self.generics(),
208-
DebruijnIndex::INNERMOST,
208+
self.in_binders,
209209
);
210210

211211
TyKind::Array(inner_ty, const_len).intern(Interner)
@@ -728,7 +728,7 @@ impl<'a> TyLoweringContext<'a> {
728728
c,
729729
self.type_param_mode,
730730
|| self.generics(),
731-
DebruijnIndex::INNERMOST,
731+
self.in_binders,
732732
)
733733
},
734734
) {

crates/hir_ty/src/tests/regression.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,3 +1477,23 @@ fn regression_11688_2() {
14771477
"#,
14781478
);
14791479
}
1480+
1481+
#[test]
1482+
fn regression_11688_3() {
1483+
check_types(
1484+
r#"
1485+
//- minicore: iterator
1486+
struct Ar<T, const N: u8>(T);
1487+
fn f<const LEN: usize, T, const BASE: u8>(
1488+
num_zeros: usize,
1489+
) -> dyn Iterator<Item = [Ar<T, BASE>; LEN]> {
1490+
loop {}
1491+
}
1492+
fn dynamic_programming() {
1493+
for board in f::<9, u8, 7>(1) {
1494+
//^^^^^ [Ar<u8, 7>; 9]
1495+
}
1496+
}
1497+
"#,
1498+
);
1499+
}

0 commit comments

Comments
 (0)