diff options
Diffstat (limited to 'crates/hir_ty/src/infer/pat.rs')
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 9e8ca18ef..befa0d69b 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -12,7 +12,9 @@ use hir_def::{ | |||
12 | use hir_expand::name::Name; | 12 | use hir_expand::name::Name; |
13 | 13 | ||
14 | use super::{BindingMode, Expectation, InferenceContext}; | 14 | use super::{BindingMode, Expectation, InferenceContext}; |
15 | use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Interner, Substs, Ty, TyKind}; | 15 | use crate::{ |
16 | lower::lower_to_chalk_mutability, utils::variant_data, Interner, Substitution, Ty, TyKind, | ||
17 | }; | ||
16 | 18 | ||
17 | impl<'a> InferenceContext<'a> { | 19 | impl<'a> InferenceContext<'a> { |
18 | fn infer_tuple_struct_pat( | 20 | fn infer_tuple_struct_pat( |
@@ -31,7 +33,7 @@ impl<'a> InferenceContext<'a> { | |||
31 | } | 33 | } |
32 | self.unify(&ty, expected); | 34 | self.unify(&ty, expected); |
33 | 35 | ||
34 | let substs = ty.substs().cloned().unwrap_or_else(Substs::empty); | 36 | let substs = ty.substs().cloned().unwrap_or_else(Substitution::empty); |
35 | 37 | ||
36 | let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); | 38 | let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); |
37 | let (pre, post) = match ellipsis { | 39 | let (pre, post) = match ellipsis { |
@@ -70,7 +72,7 @@ impl<'a> InferenceContext<'a> { | |||
70 | 72 | ||
71 | self.unify(&ty, expected); | 73 | self.unify(&ty, expected); |
72 | 74 | ||
73 | let substs = ty.substs().cloned().unwrap_or_else(Substs::empty); | 75 | let substs = ty.substs().cloned().unwrap_or_else(Substitution::empty); |
74 | 76 | ||
75 | let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); | 77 | let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); |
76 | for subpat in subpats { | 78 | for subpat in subpats { |
@@ -138,7 +140,7 @@ impl<'a> InferenceContext<'a> { | |||
138 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); | 140 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); |
139 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); | 141 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); |
140 | 142 | ||
141 | TyKind::Tuple(inner_tys.len(), Substs(inner_tys.into())).intern(&Interner) | 143 | TyKind::Tuple(inner_tys.len(), Substitution(inner_tys.into())).intern(&Interner) |
142 | } | 144 | } |
143 | Pat::Or(ref pats) => { | 145 | Pat::Or(ref pats) => { |
144 | if let Some((first_pat, rest)) = pats.split_first() { | 146 | if let Some((first_pat, rest)) = pats.split_first() { |
@@ -237,7 +239,7 @@ impl<'a> InferenceContext<'a> { | |||
237 | }; | 239 | }; |
238 | 240 | ||
239 | let inner_ty = self.infer_pat(*inner, &inner_expected, default_bm); | 241 | let inner_ty = self.infer_pat(*inner, &inner_expected, default_bm); |
240 | Ty::adt_ty(box_adt, Substs::single(inner_ty)) | 242 | Ty::adt_ty(box_adt, Substitution::single(inner_ty)) |
241 | } | 243 | } |
242 | None => self.err_ty(), | 244 | None => self.err_ty(), |
243 | }, | 245 | }, |