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, 6 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index a16755cda..2e812ab94 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -158,11 +158,11 @@ impl<'a> InferenceContext<'a> { | |||
158 | if mutability != exp_mut { | 158 | if mutability != exp_mut { |
159 | // FIXME: emit type error? | 159 | // FIXME: emit type error? |
160 | } | 160 | } |
161 | inner_ty | 161 | inner_ty.clone() |
162 | } | 162 | } |
163 | _ => &Ty(TyKind::Unknown), | 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, Substs::single(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( |
@@ -232,11 +232,11 @@ impl<'a> InferenceContext<'a> { | |||
232 | Pat::Box { inner } => match self.resolve_boxed_box() { | 232 | Pat::Box { inner } => match self.resolve_boxed_box() { |
233 | Some(box_adt) => { | 233 | Some(box_adt) => { |
234 | let inner_expected = match expected.as_adt() { | 234 | let inner_expected = match expected.as_adt() { |
235 | Some((adt, substs)) if adt == box_adt => substs.as_single(), | 235 | Some((adt, substs)) if adt == box_adt => substs.as_single().clone(), |
236 | _ => &Ty(TyKind::Unknown), | 236 | _ => self.result.standard_types.unknown.clone(), |
237 | }; | 237 | }; |
238 | 238 | ||
239 | let inner_ty = self.infer_pat(*inner, inner_expected, default_bm); | 239 | let inner_ty = self.infer_pat(*inner, &inner_expected, default_bm); |
240 | Ty::adt_ty(box_adt, Substs::single(inner_ty)) | 240 | Ty::adt_ty(box_adt, Substs::single(inner_ty)) |
241 | } | 241 | } |
242 | None => self.err_ty(), | 242 | None => self.err_ty(), |