From 42217738e0b121a8e5d48a9a55cb51ef6c98975f Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 14 Mar 2021 17:40:55 +0100 Subject: Don't use Substs for Ref/Raw/Array/Slice --- crates/hir_ty/src/infer/coerce.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'crates/hir_ty/src/infer/coerce.rs') 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> { // Auto Deref if cannot coerce match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { // FIXME: DerefMut - (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => { - self.unify_autoderef_behind_ref(&st1[0], &st2[0]) - } + (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2), // Otherwise, normal unify _ => self.unify(&from_ty, to_ty), @@ -178,11 +176,7 @@ impl<'a> InferenceContext<'a> { // Stop when constructor matches. if from_ty.equals_ctor(&to_ty) { // It will not recurse to `coerce`. - return match (from_ty.substs(), to_ty.substs()) { - (Some(st1), Some(st2)) => self.table.unify_substs(st1, st2, 0), - (None, None) => true, - _ => false, - }; + return self.table.unify(&from_ty, &to_ty); } else if self.table.unify_inner_trivial(&derefed_ty, &to_ty, 0) { return true; } -- cgit v1.2.3