aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/pat.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-14 16:40:55 +0000
committerFlorian Diebold <[email protected]>2021-03-14 19:21:05 +0000
commit42217738e0b121a8e5d48a9a55cb51ef6c98975f (patch)
tree63b3fc22a011ae0ee37a91cb19f5dcfe390507f1 /crates/hir_ty/src/infer/pat.rs
parentaf466f8542173002361eb134e66102908c7cd024 (diff)
Don't use Substs for Ref/Raw/Array/Slice
Diffstat (limited to 'crates/hir_ty/src/infer/pat.rs')
-rw-r--r--crates/hir_ty/src/infer/pat.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
index 2e812ab94..9e8ca18ef 100644
--- a/crates/hir_ty/src/infer/pat.rs
+++ b/crates/hir_ty/src/infer/pat.rs
@@ -163,7 +163,7 @@ impl<'a> InferenceContext<'a> {
163 _ => self.result.standard_types.unknown.clone(), 163 _ => self.result.standard_types.unknown.clone(),
164 }; 164 };
165 let subty = self.infer_pat(*pat, &expectation, default_bm); 165 let subty = self.infer_pat(*pat, &expectation, default_bm);
166 TyKind::Ref(mutability, Substs::single(subty)).intern(&Interner) 166 TyKind::Ref(mutability, subty).intern(&Interner)
167 } 167 }
168 Pat::TupleStruct { path: p, args: subpats, ellipsis } => self.infer_tuple_struct_pat( 168 Pat::TupleStruct { path: p, args: subpats, ellipsis } => self.infer_tuple_struct_pat(
169 p.as_ref(), 169 p.as_ref(),
@@ -196,7 +196,7 @@ impl<'a> InferenceContext<'a> {
196 196
197 let bound_ty = match mode { 197 let bound_ty = match mode {
198 BindingMode::Ref(mutability) => { 198 BindingMode::Ref(mutability) => {
199 TyKind::Ref(mutability, Substs::single(inner_ty.clone())).intern(&Interner) 199 TyKind::Ref(mutability, inner_ty.clone()).intern(&Interner)
200 } 200 }
201 BindingMode::Move => inner_ty.clone(), 201 BindingMode::Move => inner_ty.clone(),
202 }; 202 };
@@ -206,8 +206,8 @@ impl<'a> InferenceContext<'a> {
206 } 206 }
207 Pat::Slice { prefix, slice, suffix } => { 207 Pat::Slice { prefix, slice, suffix } => {
208 let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.interned(&Interner) { 208 let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.interned(&Interner) {
209 TyKind::Array(st) => (TyKind::Array, st.as_single().clone()), 209 TyKind::Array(st) => (TyKind::Array, st.clone()),
210 TyKind::Slice(st) => (TyKind::Slice, st.as_single().clone()), 210 TyKind::Slice(st) => (TyKind::Slice, st.clone()),
211 _ => (TyKind::Slice, self.err_ty()), 211 _ => (TyKind::Slice, self.err_ty()),
212 }; 212 };
213 213
@@ -215,7 +215,7 @@ impl<'a> InferenceContext<'a> {
215 self.infer_pat(*pat_id, &elem_ty, default_bm); 215 self.infer_pat(*pat_id, &elem_ty, default_bm);
216 } 216 }
217 217
218 let pat_ty = container_ty(Substs::single(elem_ty)).intern(&Interner); 218 let pat_ty = container_ty(elem_ty).intern(&Interner);
219 if let Some(slice_pat_id) = slice { 219 if let Some(slice_pat_id) = slice {
220 self.infer_pat(*slice_pat_id, &pat_ty, default_bm); 220 self.infer_pat(*slice_pat_id, &pat_ty, default_bm);
221 } 221 }