From 4fe0545bb673e687644ca4f87913a61c361aafa6 Mon Sep 17 00:00:00 2001 From: hkalbasi Date: Tue, 29 Mar 2022 11:03:55 +0430 Subject: [PATCH] fix regression_11688_3 --- crates/hir_ty/src/lower.rs | 4 ++-- crates/hir_ty/src/tests/regression.rs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 41bb94c5d554..2247c8d13de9 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 7a7470fd3545..14c6af943abc 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] + } + } + "#, + ); +}