Skip to content

Commit e11cd8f

Browse files
committed
Remove exposing unification
1 parent d9bb86a commit e11cd8f

File tree

4 files changed

+1
-23
lines changed

4 files changed

+1
-23
lines changed

crates/hir/src/code_model.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,12 +1118,6 @@ impl Local {
11181118
ast.map_left(|it| it.cast().unwrap().to_node(&root)).map_right(|it| it.to_node(&root))
11191119
})
11201120
}
1121-
1122-
pub fn can_unify(self, other: Type, db: &dyn HirDatabase) -> bool {
1123-
let def = DefWithBodyId::from(self.parent);
1124-
let infer = db.infer(def);
1125-
db.can_unify(def, infer[self.pat_id].clone(), other.ty.value)
1126-
}
11271121
}
11281122

11291123
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]

crates/hir_ty/src/db.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
2626
#[salsa::invoke(crate::infer::infer_query)]
2727
fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
2828

29-
#[salsa::invoke(crate::infer::can_unify)]
30-
fn can_unify(&self, def: DefWithBodyId, ty1: Ty, ty2: Ty) -> bool;
31-
3229
#[salsa::invoke(crate::lower::ty_query)]
3330
#[salsa::cycle(crate::lower::ty_recover)]
3431
fn ty(&self, def: TyDefId) -> Binders<Ty>;

crates/hir_ty/src/infer.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
7878
Arc::new(ctx.resolve_all())
7979
}
8080

81-
pub(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-
9481
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
9582
enum ExprOrPatId {
9683
ExprId(ExprId),

crates/ide/src/completion/presentation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl Completions {
194194
fn add_arg(arg: &str, ty: &Type, ctx: &CompletionContext) -> String {
195195
if let Some(derefed_ty) = ty.remove_ref() {
196196
for (name, local) in ctx.locals.iter() {
197-
if name == arg && local.can_unify(derefed_ty.clone(), ctx.db) {
197+
if name == arg && local.ty(ctx.db) == derefed_ty {
198198
return (if ty.is_mutable_reference() { "&mut " } else { "&" }).to_string()
199199
+ &arg.to_string();
200200
}

0 commit comments

Comments
 (0)