aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/db.rs3
-rw-r--r--crates/hir_ty/src/infer.rs13
2 files changed, 0 insertions, 16 deletions
diff --git a/crates/hir_ty/src/db.rs b/crates/hir_ty/src/db.rs
index 57e60c53b..25cf9eb7f 100644
--- a/crates/hir_ty/src/db.rs
+++ b/crates/hir_ty/src/db.rs
@@ -26,9 +26,6 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
26 #[salsa::invoke(crate::infer::infer_query)] 26 #[salsa::invoke(crate::infer::infer_query)]
27 fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 27 fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
28 28
29 #[salsa::invoke(crate::infer::can_unify)]
30 fn can_unify(&self, def: DefWithBodyId, ty1: Ty, ty2: Ty) -> bool;
31
32 #[salsa::invoke(crate::lower::ty_query)] 29 #[salsa::invoke(crate::lower::ty_query)]
33 #[salsa::cycle(crate::lower::ty_recover)] 30 #[salsa::cycle(crate::lower::ty_recover)]
34 fn ty(&self, def: TyDefId) -> Binders<Ty>; 31 fn ty(&self, def: TyDefId) -> Binders<Ty>;
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index d461e077b..2db05ae78 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -78,19 +78,6 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
78 Arc::new(ctx.resolve_all()) 78 Arc::new(ctx.resolve_all())
79} 79}
80 80
81pub(crate) fn can_unify(db: &dyn HirDatabase, def: DefWithBodyId, ty1: Ty, ty2: Ty) -> bool {
82 let resolver = def.resolver(db.upcast());
83 let mut ctx = InferenceContext::new(db, def, resolver);
84
85 let ty1 = ctx.canonicalizer().canonicalize_ty(ty1).value;
86 let ty2 = ctx.canonicalizer().canonicalize_ty(ty2).value;
87 let mut kinds = Vec::from(ty1.kinds.to_vec());
88 kinds.extend_from_slice(ty2.kinds.as_ref());
89 let tys = crate::Canonical::new((ty1.value, ty2.value), kinds);
90
91 unify(&tys).is_some()
92}
93
94#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] 81#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
95enum ExprOrPatId { 82enum ExprOrPatId {
96 ExprId(ExprId), 83 ExprId(ExprId),