Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/infer.rs4
-rw-r--r--crates/hir-ty/src/infer/expr.rs2
-rw-r--r--crates/hir-ty/src/infer/path.rs2
-rw-r--r--crates/hir-ty/src/infer/unify.rs15
4 files changed, 4 insertions, 19 deletions
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 50809f4621..467a1a92dd 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -1791,10 +1791,6 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
self.table.insert_type_vars(ty)
}
- fn unify(&mut self, ty1: Ty<'db>, ty2: Ty<'db>) -> bool {
- self.table.unify(ty1, ty2)
- }
-
/// Attempts to returns the deeply last field of nested structures, but
/// does not apply any normalization in its search. Returns the same type
/// if input `ty` is not a structure at all.
diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs
index db8ab67d2b..90daa13576 100644
--- a/crates/hir-ty/src/infer/expr.rs
+++ b/crates/hir-ty/src/infer/expr.rs
@@ -1434,7 +1434,7 @@ impl<'db> InferenceContext<'_, 'db> {
// NB: this should *not* coerce.
// tail calls don't support any coercions except lifetimes ones (like `&'static u8 -> &'a u8`).
- self.unify(call_expr_ty, ret_ty);
+ _ = self.demand_eqtype(expr.into(), call_expr_ty, ret_ty);
}
None => {
// FIXME: diagnose `become` outside of functions
diff --git a/crates/hir-ty/src/infer/path.rs b/crates/hir-ty/src/infer/path.rs
index 835721942a..10a561215f 100644
--- a/crates/hir-ty/src/infer/path.rs
+++ b/crates/hir-ty/src/infer/path.rs
@@ -334,7 +334,7 @@ impl<'db> InferenceContext<'_, 'db> {
let impl_substs = self.table.fresh_args_for_item(impl_id.into());
let impl_self_ty =
self.db.impl_self_ty(impl_id).instantiate(self.interner(), impl_substs);
- self.unify(impl_self_ty, ty);
+ _ = self.demand_eqtype(id, impl_self_ty, ty);
impl_substs
}
ItemContainerId::TraitId(trait_) => {
diff --git a/crates/hir-ty/src/infer/unify.rs b/crates/hir-ty/src/infer/unify.rs
index 38b1388b9e..4df198e002 100644
--- a/crates/hir-ty/src/infer/unify.rs
+++ b/crates/hir-ty/src/infer/unify.rs
@@ -20,8 +20,8 @@ use crate::{
TypingMode,
fulfill::{FulfillmentCtxt, NextSolverError},
infer::{
- DbInternerInferExt, InferCtxt, InferOk, InferResult,
- at::{At, ToTrace},
+ DbInternerInferExt, InferCtxt, InferOk,
+ at::At,
snapshot::CombinedSnapshot,
traits::{Obligation, ObligationCause, PredicateObligation},
},
@@ -293,17 +293,6 @@ impl<'db> InferenceTable<'db> {
value.fold_with(&mut resolve_completely::Resolver::new(self, true, &mut goals))
}
- /// Unify two relatable values (e.g. `Ty`) and register new trait goals that arise from that.
- pub(crate) fn unify<T: ToTrace<'db>>(&mut self, ty1: T, ty2: T) -> bool {
- self.try_unify(ty1, ty2).map(|infer_ok| self.register_infer_ok(infer_ok)).is_ok()
- }
-
- /// Unify two relatable values (e.g. `Ty`) and return new trait goals arising from it, so the
- /// caller needs to deal with them.
- pub(crate) fn try_unify<T: ToTrace<'db>>(&mut self, t1: T, t2: T) -> InferResult<'db, ()> {
- self.at(&ObligationCause::new()).eq(t1, t2)
- }
-
pub(crate) fn at<'a>(&'a self, cause: &'a ObligationCause) -> At<'a, 'db> {
self.infer_ctxt.at(cause, self.param_env)
}