aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/pat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/pat.rs')
-rw-r--r--crates/hir_ty/src/infer/pat.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
index 469f37dd9..252ae914a 100644
--- a/crates/hir_ty/src/infer/pat.rs
+++ b/crates/hir_ty/src/infer/pat.rs
@@ -49,7 +49,9 @@ impl<'a> InferenceContext<'a> {
49 let expected_ty = var_data 49 let expected_ty = var_data
50 .as_ref() 50 .as_ref()
51 .and_then(|d| d.field(&Name::new_tuple_field(i))) 51 .and_then(|d| d.field(&Name::new_tuple_field(i)))
52 .map_or(self.err_ty(), |field| field_tys[field].clone().subst(&substs)); 52 .map_or(self.err_ty(), |field| {
53 field_tys[field].clone().substitute(&Interner, &substs)
54 });
53 let expected_ty = self.normalize_associated_types_in(expected_ty); 55 let expected_ty = self.normalize_associated_types_in(expected_ty);
54 self.infer_pat(subpat, &expected_ty, default_bm); 56 self.infer_pat(subpat, &expected_ty, default_bm);
55 } 57 }
@@ -83,8 +85,9 @@ impl<'a> InferenceContext<'a> {
83 self.result.record_pat_field_resolutions.insert(subpat.pat, field_def); 85 self.result.record_pat_field_resolutions.insert(subpat.pat, field_def);
84 } 86 }
85 87
86 let expected_ty = matching_field 88 let expected_ty = matching_field.map_or(self.err_ty(), |field| {
87 .map_or(self.err_ty(), |field| field_tys[field].clone().subst(&substs)); 89 field_tys[field].clone().substitute(&Interner, &substs)
90 });
88 let expected_ty = self.normalize_associated_types_in(expected_ty); 91 let expected_ty = self.normalize_associated_types_in(expected_ty);
89 self.infer_pat(subpat.pat, &expected_ty, default_bm); 92 self.infer_pat(subpat.pat, &expected_ty, default_bm);
90 } 93 }