From f43edb2151408d0127201312ade7fef9d9328222 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 8 Apr 2021 13:32:56 +0200 Subject: Fix remaining `interned_mut` call --- crates/hir_ty/src/infer/coerce.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index fd679f444..26dc6ceba 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -71,12 +71,14 @@ impl<'a> InferenceContext<'a> { } // Pointer weakening and function to pointer - match (from_ty.interned_mut(), to_ty.kind(&Interner)) { + match (from_ty.kind(&Interner), to_ty.kind(&Interner)) { // `*mut T` -> `*const T` + (TyKind::Raw(m1, inner), TyKind::Raw(m2 @ Mutability::Not, ..)) => { + from_ty = TyKind::Raw(*m2, inner.clone()).intern(&Interner); + } // `&mut T` -> `&T` - (TyKind::Raw(m1, ..), TyKind::Raw(m2 @ Mutability::Not, ..)) - | (TyKind::Ref(m1, ..), TyKind::Ref(m2 @ Mutability::Not, ..)) => { - *m1 = *m2; + (TyKind::Ref(m1, lt, inner), TyKind::Ref(m2 @ Mutability::Not, ..)) => { + from_ty = TyKind::Ref(*m2, lt.clone(), inner.clone()).intern(&Interner); } // `&T` -> `*const T` // `&mut T` -> `*mut T`/`*const T` -- cgit v1.2.3