aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/coerce.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/coerce.rs')
-rw-r--r--crates/hir_ty/src/infer/coerce.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs
index 40b4db926..765a02b1c 100644
--- a/crates/hir_ty/src/infer/coerce.rs
+++ b/crates/hir_ty/src/infer/coerce.rs
@@ -146,7 +146,7 @@ impl<'a> InferenceContext<'a> {
146 } 146 }
147 _ => { 147 _ => {
148 // Otherwise, just use unification rules. 148 // Otherwise, just use unification rules.
149 self.unify_inner(&from_ty, to_ty) 149 self.table.try_unify(&from_ty, to_ty)
150 } 150 }
151 } 151 }
152 } 152 }
@@ -155,7 +155,7 @@ impl<'a> InferenceContext<'a> {
155 let (_is_ref, from_mt, from_inner) = match from_ty.kind(&Interner) { 155 let (_is_ref, from_mt, from_inner) = match from_ty.kind(&Interner) {
156 TyKind::Ref(mt, _, ty) => (true, mt, ty), 156 TyKind::Ref(mt, _, ty) => (true, mt, ty),
157 TyKind::Raw(mt, ty) => (false, mt, ty), 157 TyKind::Raw(mt, ty) => (false, mt, ty),
158 _ => return self.unify_inner(&from_ty, to_ty), 158 _ => return self.table.try_unify(&from_ty, to_ty),
159 }; 159 };
160 160
161 coerce_mutabilities(*from_mt, to_mt)?; 161 coerce_mutabilities(*from_mt, to_mt)?;
@@ -163,7 +163,7 @@ impl<'a> InferenceContext<'a> {
163 // Check that the types which they point at are compatible. 163 // Check that the types which they point at are compatible.
164 let from_raw = TyKind::Raw(to_mt, from_inner.clone()).intern(&Interner); 164 let from_raw = TyKind::Raw(to_mt, from_inner.clone()).intern(&Interner);
165 // FIXME: behavior differs based on is_ref once we're computing adjustments 165 // FIXME: behavior differs based on is_ref once we're computing adjustments
166 self.unify_inner(&from_raw, to_ty) 166 self.table.try_unify(&from_raw, to_ty)
167 } 167 }
168 168
169 /// Reborrows `&mut A` to `&mut B` and `&(mut) A` to `&B`. 169 /// Reborrows `&mut A` to `&mut B` and `&(mut) A` to `&B`.
@@ -174,7 +174,7 @@ impl<'a> InferenceContext<'a> {
174 TyKind::Ref(mt, _, _) => { 174 TyKind::Ref(mt, _, _) => {
175 coerce_mutabilities(*mt, to_mt)?; 175 coerce_mutabilities(*mt, to_mt)?;
176 } 176 }
177 _ => return self.unify_inner(&from_ty, to_ty), 177 _ => return self.table.try_unify(&from_ty, to_ty),
178 }; 178 };
179 179
180 // NOTE: this code is mostly copied and adapted from rustc, and 180 // NOTE: this code is mostly copied and adapted from rustc, and
@@ -228,7 +228,7 @@ impl<'a> InferenceContext<'a> {
228 // from `&mut T` to `&U`. 228 // from `&mut T` to `&U`.
229 let lt = static_lifetime(); // FIXME: handle lifetimes correctly, see rustc 229 let lt = static_lifetime(); // FIXME: handle lifetimes correctly, see rustc
230 let derefd_from_ty = TyKind::Ref(to_mt, lt, referent_ty).intern(&Interner); 230 let derefd_from_ty = TyKind::Ref(to_mt, lt, referent_ty).intern(&Interner);
231 match self.unify_inner(&derefd_from_ty, to_ty) { 231 match self.table.try_unify(&derefd_from_ty, to_ty) {
232 Ok(result) => { 232 Ok(result) => {
233 found = Some(result); 233 found = Some(result);
234 break; 234 break;
@@ -274,7 +274,7 @@ impl<'a> InferenceContext<'a> {
274 274
275 Ok(ok) 275 Ok(ok)
276 } 276 }
277 _ => self.unify_inner(&from_ty, to_ty), 277 _ => self.table.try_unify(&from_ty, to_ty),
278 } 278 }
279 } 279 }
280 280
@@ -299,10 +299,10 @@ impl<'a> InferenceContext<'a> {
299 { 299 {
300 let from_unsafe = 300 let from_unsafe =
301 TyKind::Function(safe_to_unsafe_fn_ty(from_fn_ptr.clone())).intern(&Interner); 301 TyKind::Function(safe_to_unsafe_fn_ty(from_fn_ptr.clone())).intern(&Interner);
302 return self.unify_inner(&from_unsafe, to_ty); 302 return self.table.try_unify(&from_unsafe, to_ty);
303 } 303 }
304 } 304 }
305 self.unify_inner(&from_ty, to_ty) 305 self.table.try_unify(&from_ty, to_ty)
306 } 306 }
307 307
308 /// Attempts to coerce from the type of a non-capturing closure into a 308 /// Attempts to coerce from the type of a non-capturing closure into a
@@ -323,9 +323,9 @@ impl<'a> InferenceContext<'a> {
323 // `unsafe fn(arg0,arg1,...) -> _` 323 // `unsafe fn(arg0,arg1,...) -> _`
324 let safety = fn_ty.sig.safety; 324 let safety = fn_ty.sig.safety;
325 let pointer_ty = coerce_closure_fn_ty(from_substs, safety); 325 let pointer_ty = coerce_closure_fn_ty(from_substs, safety);
326 self.unify_inner(&pointer_ty, to_ty) 326 self.table.try_unify(&pointer_ty, to_ty)
327 } 327 }
328 _ => self.unify_inner(&from_ty, to_ty), 328 _ => self.table.try_unify(&from_ty, to_ty),
329 } 329 }
330 } 330 }
331 331