diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 18:25:19 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 18:25:19 +0100 |
commit | c91b5376835ab54cd4bca02953625ef1f1fabeba (patch) | |
tree | 390be0ec3c0a57db5188b06c86f0a7df0242b01c /crates/hir_ty/src/method_resolution.rs | |
parent | 467a5c6cd13af6ccb76e9ebdb35f96fc10fb438f (diff) | |
parent | a316d583600e11ee1fcc8027a838efafe435f03c (diff) |
Merge #8348
8348: Make `Binders` more like Chalk r=flodiebold a=flodiebold
Working towards #8313.
- hide `value`
- use `VariableKinds`
- adjust `subst` to be like Chalk's `substitute`
- also clean up some other `TypeWalk` stuff to prepare for it being replaced by Chalk's `Fold`
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 6ace970d1..19a1fa793 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -102,11 +102,11 @@ impl TraitImpls { | |||
102 | for (_module_id, module_data) in crate_def_map.modules() { | 102 | for (_module_id, module_data) in crate_def_map.modules() { |
103 | for impl_id in module_data.scope.impls() { | 103 | for impl_id in module_data.scope.impls() { |
104 | let target_trait = match db.impl_trait(impl_id) { | 104 | let target_trait = match db.impl_trait(impl_id) { |
105 | Some(tr) => tr.value.hir_trait_id(), | 105 | Some(tr) => tr.skip_binders().hir_trait_id(), |
106 | None => continue, | 106 | None => continue, |
107 | }; | 107 | }; |
108 | let self_ty = db.impl_self_ty(impl_id); | 108 | let self_ty = db.impl_self_ty(impl_id); |
109 | let self_ty_fp = TyFingerprint::for_impl(&self_ty.value); | 109 | let self_ty_fp = TyFingerprint::for_impl(self_ty.skip_binders()); |
110 | impls | 110 | impls |
111 | .map | 111 | .map |
112 | .entry(target_trait) | 112 | .entry(target_trait) |
@@ -201,7 +201,7 @@ impl InherentImpls { | |||
201 | } | 201 | } |
202 | 202 | ||
203 | let self_ty = db.impl_self_ty(impl_id); | 203 | let self_ty = db.impl_self_ty(impl_id); |
204 | if let Some(fp) = TyFingerprint::for_impl(&self_ty.value) { | 204 | if let Some(fp) = TyFingerprint::for_impl(self_ty.skip_binders()) { |
205 | map.entry(fp).or_default().push(impl_id); | 205 | map.entry(fp).or_default().push(impl_id); |
206 | } | 206 | } |
207 | } | 207 | } |
@@ -712,7 +712,7 @@ pub(crate) fn inherent_impl_substs( | |||
712 | let vars = TyBuilder::subst_for_def(db, impl_id) | 712 | let vars = TyBuilder::subst_for_def(db, impl_id) |
713 | .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner)) | 713 | .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.binders.len(&Interner)) |
714 | .build(); | 714 | .build(); |
715 | let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars); | 715 | let self_ty_with_vars = db.impl_self_ty(impl_id).substitute(&Interner, &vars); |
716 | let mut kinds = self_ty.binders.interned().to_vec(); | 716 | let mut kinds = self_ty.binders.interned().to_vec(); |
717 | kinds.extend( | 717 | kinds.extend( |
718 | iter::repeat(chalk_ir::WithKind::new( | 718 | iter::repeat(chalk_ir::WithKind::new( |
@@ -774,7 +774,7 @@ fn transform_receiver_ty( | |||
774 | AssocContainerId::ModuleId(_) => unreachable!(), | 774 | AssocContainerId::ModuleId(_) => unreachable!(), |
775 | }; | 775 | }; |
776 | let sig = db.callable_item_signature(function_id.into()); | 776 | let sig = db.callable_item_signature(function_id.into()); |
777 | Some(sig.value.params()[0].clone().subst_bound_vars(&substs)) | 777 | Some(sig.map(|s| s.params()[0].clone()).substitute(&Interner, &substs)) |
778 | } | 778 | } |
779 | 779 | ||
780 | pub fn implements_trait( | 780 | pub fn implements_trait( |