aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r--crates/hir_ty/src/infer/unify.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index 8674c1b0c..4987795e0 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -70,7 +70,7 @@ impl<T: HasInterner<Interner = Interner>> Canonicalized<T> {
70 let ty = ctx.normalize_associated_types_in(new_vars.apply(ty.clone(), &Interner)); 70 let ty = ctx.normalize_associated_types_in(new_vars.apply(ty.clone(), &Interner));
71 ctx.unify(var.assert_ty_ref(&Interner), &ty); 71 ctx.unify(var.assert_ty_ref(&Interner), &ty);
72 } else { 72 } else {
73 let _ = ctx.unify_inner(&var, &new_vars.apply(v.clone(), &Interner)); 73 let _ = ctx.try_unify(&var, &new_vars.apply(v.clone(), &Interner));
74 } 74 }
75 } 75 }
76 } 76 }
@@ -300,9 +300,8 @@ impl<'a> InferenceTable<'a> {
300 } 300 }
301 301
302 /// Unify two types and register new trait goals that arise from that. 302 /// Unify two types and register new trait goals that arise from that.
303 // TODO give these two functions better names
304 pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { 303 pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
305 let result = if let Ok(r) = self.unify_inner(ty1, ty2) { 304 let result = if let Ok(r) = self.try_unify(ty1, ty2) {
306 r 305 r
307 } else { 306 } else {
308 return false; 307 return false;
@@ -313,7 +312,7 @@ impl<'a> InferenceTable<'a> {
313 312
314 /// Unify two types and return new trait goals arising from it, so the 313 /// Unify two types and return new trait goals arising from it, so the
315 /// caller needs to deal with them. 314 /// caller needs to deal with them.
316 pub(crate) fn unify_inner<T: Zip<Interner>>(&mut self, t1: &T, t2: &T) -> InferResult { 315 pub(crate) fn try_unify<T: Zip<Interner>>(&mut self, t1: &T, t2: &T) -> InferResult {
317 match self.var_unification_table.relate( 316 match self.var_unification_table.relate(
318 &Interner, 317 &Interner,
319 &self.db, 318 &self.db,