diff options
author | Lukas Wirth <[email protected]> | 2021-04-05 21:08:16 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-04-06 09:45:30 +0100 |
commit | 96756f1b1df4729fd00ca96a59971b3997c91934 (patch) | |
tree | 1daa47d67081772ed1a61b0db13ff041337ddf8b /crates/hir_ty/src/infer/coerce.rs | |
parent | 4bc8a018302d53951ae855ba57d07095a16ef182 (diff) |
Add Lifetime to TyKind::Ref
Diffstat (limited to 'crates/hir_ty/src/infer/coerce.rs')
-rw-r--r-- | crates/hir_ty/src/infer/coerce.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 32c273afc..d6c48870a 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
@@ -81,7 +81,7 @@ impl<'a> InferenceContext<'a> { | |||
81 | // `&T` -> `*const T` | 81 | // `&T` -> `*const T` |
82 | // `&mut T` -> `*mut T`/`*const T` | 82 | // `&mut T` -> `*mut T`/`*const T` |
83 | (TyKind::Ref(.., substs), &TyKind::Raw(m2 @ Mutability::Not, ..)) | 83 | (TyKind::Ref(.., substs), &TyKind::Raw(m2 @ Mutability::Not, ..)) |
84 | | (TyKind::Ref(Mutability::Mut, substs), &TyKind::Raw(m2, ..)) => { | 84 | | (TyKind::Ref(Mutability::Mut, _, substs), &TyKind::Raw(m2, ..)) => { |
85 | from_ty = TyKind::Raw(m2, substs.clone()).intern(&Interner); | 85 | from_ty = TyKind::Raw(m2, substs.clone()).intern(&Interner); |
86 | } | 86 | } |
87 | 87 | ||
@@ -111,7 +111,9 @@ impl<'a> InferenceContext<'a> { | |||
111 | // Auto Deref if cannot coerce | 111 | // Auto Deref if cannot coerce |
112 | match (from_ty.kind(&Interner), to_ty.kind(&Interner)) { | 112 | match (from_ty.kind(&Interner), to_ty.kind(&Interner)) { |
113 | // FIXME: DerefMut | 113 | // FIXME: DerefMut |
114 | (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2), | 114 | (TyKind::Ref(.., st1), TyKind::Ref(.., st2)) => { |
115 | self.unify_autoderef_behind_ref(st1, st2) | ||
116 | } | ||
115 | 117 | ||
116 | // Otherwise, normal unify | 118 | // Otherwise, normal unify |
117 | _ => self.unify(&from_ty, to_ty), | 119 | _ => self.unify(&from_ty, to_ty), |