Fix remaining interned_mut call

This commit is contained in:
Florian Diebold 2021-04-08 13:32:56 +02:00
parent 0f058d61ce
commit f43edb2151

View File

@ -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`