From e4add45951511f9afe348bf6066a724deb0d3ccf Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 3 Dec 2019 14:59:29 +0100 Subject: Fix #2467 The stand-alone `unify` requires that the type doesn't contain any type variables. So we can't share the code here for now (without more refactoring)... --- crates/ra_hir_ty/src/method_resolution.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_ty/src/method_resolution.rs') diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs index 21efb196a..7220d6e0a 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/ra_hir_ty/src/method_resolution.rs @@ -437,12 +437,12 @@ fn is_valid_candidate( pub(crate) fn inherent_impl_substs( db: &impl HirDatabase, impl_id: ImplId, - self_ty: &Ty, + self_ty: &Canonical, ) -> Option { let vars = Substs::build_for_def(db, impl_id).fill_with_bound_vars(0).build(); let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars); - let self_ty_with_vars = Canonical { num_vars: vars.len(), value: &self_ty_with_vars }; - super::infer::unify(self_ty_with_vars, self_ty) + let self_ty_with_vars = Canonical { num_vars: vars.len(), value: self_ty_with_vars }; + super::infer::unify(&self_ty_with_vars, self_ty) } fn transform_receiver_ty( @@ -455,7 +455,7 @@ fn transform_receiver_ty( .push(self_ty.value.clone()) .fill_with_unknown() .build(), - hir_def::ContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty.value)?, + hir_def::ContainerId::ImplId(impl_id) => inherent_impl_substs(db, impl_id, &self_ty)?, hir_def::ContainerId::ModuleId(_) => unreachable!(), }; let sig = db.callable_item_signature(function_id.into()); -- cgit v1.2.3