diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index d0226cec263..de56414d308 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -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, ) }, ) { diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 7a7470fd354..14c6af943ab 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -1477,3 +1477,23 @@ fn regression_11688_2() { "#, ); } + +#[test] +fn regression_11688_3() { + check_types( + r#" + //- minicore: iterator + struct Ar(T); + fn f( + num_zeros: usize, + ) -> dyn Iterator; LEN]> { + loop {} + } + fn dynamic_programming() { + for board in f::<9, u8, 7>(1) { + //^^^^^ [Ar; 9] + } + } + "#, + ); +}