diff options
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 6bad61a2a..66940ec30 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -937,19 +937,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
937 | }; | 937 | }; |
938 | 938 | ||
939 | for sub_pat in sub_pats { | 939 | for sub_pat in sub_pats { |
940 | let tyref = fields | 940 | let matching_field = fields.iter().find(|field| field.name == sub_pat.name); |
941 | .iter() | ||
942 | .find(|field| field.name == sub_pat.name) | ||
943 | .map(|field| &field.type_ref); | ||
944 | 941 | ||
945 | if let Some(typeref) = tyref { | 942 | if let Some(field) = matching_field { |
943 | let typeref = &field.type_ref; | ||
946 | let sub_ty = Ty::from_hir(self.db, &self.module, self.impl_block.as_ref(), typeref); | 944 | let sub_ty = Ty::from_hir(self.db, &self.module, self.impl_block.as_ref(), typeref); |
947 | 945 | self.infer_pat(sub_pat.pat, &Expectation::has_type(sub_ty)); | |
948 | if let Some(pat) = sub_pat.pat { | ||
949 | self.infer_pat(pat, &Expectation::has_type(sub_ty)); | ||
950 | } else { | ||
951 | // TODO: deal with this case: S { x, y } | ||
952 | } | ||
953 | } | 946 | } |
954 | } | 947 | } |
955 | 948 | ||