diff options
Diffstat (limited to 'crates/hir_ty/src/infer/coerce.rs')
-rw-r--r-- | crates/hir_ty/src/infer/coerce.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 435f7d0db..137419264 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
@@ -111,9 +111,7 @@ impl<'a> InferenceContext<'a> { | |||
111 | // Auto Deref if cannot coerce | 111 | // Auto Deref if cannot coerce |
112 | match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { | 112 | match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { |
113 | // FIXME: DerefMut | 113 | // FIXME: DerefMut |
114 | (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => { | 114 | (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2), |
115 | self.unify_autoderef_behind_ref(&st1[0], &st2[0]) | ||
116 | } | ||
117 | 115 | ||
118 | // Otherwise, normal unify | 116 | // Otherwise, normal unify |
119 | _ => self.unify(&from_ty, to_ty), | 117 | _ => self.unify(&from_ty, to_ty), |
@@ -178,11 +176,7 @@ impl<'a> InferenceContext<'a> { | |||
178 | // Stop when constructor matches. | 176 | // Stop when constructor matches. |
179 | if from_ty.equals_ctor(&to_ty) { | 177 | if from_ty.equals_ctor(&to_ty) { |
180 | // It will not recurse to `coerce`. | 178 | // It will not recurse to `coerce`. |
181 | return match (from_ty.substs(), to_ty.substs()) { | 179 | return self.table.unify(&from_ty, &to_ty); |
182 | (Some(st1), Some(st2)) => self.table.unify_substs(st1, st2, 0), | ||
183 | (None, None) => true, | ||
184 | _ => false, | ||
185 | }; | ||
186 | } else if self.table.unify_inner_trivial(&derefed_ty, &to_ty, 0) { | 180 | } else if self.table.unify_inner_trivial(&derefed_ty, &to_ty, 0) { |
187 | return true; | 181 | return true; |
188 | } | 182 | } |