From 69714d36e6617800f3edea174f5d6f76c985ad4c Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 17:13:50 +0200 Subject: Hide Binders internals more --- crates/hir_ty/src/method_resolution.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src/method_resolution.rs') diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 6ace970d1..ad5022808 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -102,11 +102,11 @@ impl TraitImpls { for (_module_id, module_data) in crate_def_map.modules() { for impl_id in module_data.scope.impls() { let target_trait = match db.impl_trait(impl_id) { - Some(tr) => tr.value.hir_trait_id(), + Some(tr) => tr.skip_binders().hir_trait_id(), None => continue, }; let self_ty = db.impl_self_ty(impl_id); - let self_ty_fp = TyFingerprint::for_impl(&self_ty.value); + let self_ty_fp = TyFingerprint::for_impl(self_ty.skip_binders()); impls .map .entry(target_trait) @@ -201,7 +201,7 @@ impl InherentImpls { } let self_ty = db.impl_self_ty(impl_id); - if let Some(fp) = TyFingerprint::for_impl(&self_ty.value) { + if let Some(fp) = TyFingerprint::for_impl(self_ty.skip_binders()) { map.entry(fp).or_default().push(impl_id); } } @@ -774,7 +774,7 @@ fn transform_receiver_ty( AssocContainerId::ModuleId(_) => unreachable!(), }; let sig = db.callable_item_signature(function_id.into()); - Some(sig.value.params()[0].clone().subst_bound_vars(&substs)) + Some(sig.map(|s| s.params()[0].clone()).subst(&substs)) } pub fn implements_trait( -- cgit v1.2.3 From 05eba0db3dd76f016aabdd49af6211e70a1812ed Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 18:39:53 +0200 Subject: Binders::subst -> substitute --- crates/hir_ty/src/method_resolution.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/method_resolution.rs') diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index ad5022808..88750acf3 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -712,7 +712,7 @@ pub(crate) fn inherent_impl_substs( let vars = TyBuilder::subst_for_def(db, impl_id) .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner)) .build(); - let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars); + let self_ty_with_vars = db.impl_self_ty(impl_id).substitute(&vars); let mut kinds = self_ty.binders.interned().to_vec(); kinds.extend( iter::repeat(chalk_ir::WithKind::new( @@ -774,7 +774,7 @@ fn transform_receiver_ty( AssocContainerId::ModuleId(_) => unreachable!(), }; let sig = db.callable_item_signature(function_id.into()); - Some(sig.map(|s| s.params()[0].clone()).subst(&substs)) + Some(sig.map(|s| s.params()[0].clone()).substitute(&substs)) } pub fn implements_trait( -- cgit v1.2.3 From 30a339e038bfd94d8c91f79287be9b7db4f0cb4e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 18:49:26 +0200 Subject: Add Interner parameter to Binders::substitute --- crates/hir_ty/src/method_resolution.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/method_resolution.rs') diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 88750acf3..19a1fa793 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -712,7 +712,7 @@ pub(crate) fn inherent_impl_substs( let vars = TyBuilder::subst_for_def(db, impl_id) .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner)) .build(); - let self_ty_with_vars = db.impl_self_ty(impl_id).substitute(&vars); + let self_ty_with_vars = db.impl_self_ty(impl_id).substitute(&Interner, &vars); let mut kinds = self_ty.binders.interned().to_vec(); kinds.extend( iter::repeat(chalk_ir::WithKind::new( @@ -774,7 +774,7 @@ fn transform_receiver_ty( AssocContainerId::ModuleId(_) => unreachable!(), }; let sig = db.callable_item_signature(function_id.into()); - Some(sig.map(|s| s.params()[0].clone()).substitute(&substs)) + Some(sig.map(|s| s.params()[0].clone()).substitute(&Interner, &substs)) } pub fn implements_trait( -- cgit v1.2.3