diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 18:25:19 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 18:25:19 +0100 |
commit | c91b5376835ab54cd4bca02953625ef1f1fabeba (patch) | |
tree | 390be0ec3c0a57db5188b06c86f0a7df0242b01c /crates/hir_ty/src/infer/pat.rs | |
parent | 467a5c6cd13af6ccb76e9ebdb35f96fc10fb438f (diff) | |
parent | a316d583600e11ee1fcc8027a838efafe435f03c (diff) |
Merge #8348
8348: Make `Binders` more like Chalk r=flodiebold a=flodiebold
Working towards #8313.
- hide `value`
- use `VariableKinds`
- adjust `subst` to be like Chalk's `substitute`
- also clean up some other `TypeWalk` stuff to prepare for it being replaced by Chalk's `Fold`
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/pat.rs')
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 9 |
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 | } |