aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/method_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r--crates/hir_ty/src/method_resolution.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index be72c4a1c..943d3339b 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -21,7 +21,7 @@ use crate::{
21 primitive::{self, FloatTy, IntTy, UintTy}, 21 primitive::{self, FloatTy, IntTy, UintTy},
22 utils::all_super_traits, 22 utils::all_super_traits,
23 AdtId, Canonical, DebruijnIndex, FnPointer, FnSig, ForeignDefId, InEnvironment, Interner, 23 AdtId, Canonical, DebruijnIndex, FnPointer, FnSig, ForeignDefId, InEnvironment, Interner,
24 Scalar, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeWalk, 24 Scalar, Substitution, TraitEnvironment, TraitRef, Ty, TyKind, TypeWalk,
25}; 25};
26 26
27/// This is used as a key for indexing impls. 27/// This is used as a key for indexing impls.
@@ -672,10 +672,10 @@ pub(crate) fn inherent_impl_substs(
672 db: &dyn HirDatabase, 672 db: &dyn HirDatabase,
673 impl_id: ImplId, 673 impl_id: ImplId,
674 self_ty: &Canonical<Ty>, 674 self_ty: &Canonical<Ty>,
675) -> Option<Substs> { 675) -> Option<Substitution> {
676 // we create a var for each type parameter of the impl; we need to keep in 676 // we create a var for each type parameter of the impl; we need to keep in
677 // mind here that `self_ty` might have vars of its own 677 // mind here that `self_ty` might have vars of its own
678 let vars = Substs::build_for_def(db, impl_id) 678 let vars = Substitution::build_for_def(db, impl_id)
679 .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.kinds.len()) 679 .fill_with_bound_vars(DebruijnIndex::INNERMOST, self_ty.kinds.len())
680 .build(); 680 .build();
681 let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars); 681 let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars);
@@ -693,7 +693,7 @@ pub(crate) fn inherent_impl_substs(
693 693
694/// This replaces any 'free' Bound vars in `s` (i.e. those with indices past 694/// This replaces any 'free' Bound vars in `s` (i.e. those with indices past
695/// num_vars_to_keep) by `TyKind::Unknown`. 695/// num_vars_to_keep) by `TyKind::Unknown`.
696fn fallback_bound_vars(s: Substs, num_vars_to_keep: usize) -> Substs { 696fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution {
697 s.fold_binders( 697 s.fold_binders(
698 &mut |ty, binders| { 698 &mut |ty, binders| {
699 if let TyKind::BoundVar(bound) = ty.interned(&Interner) { 699 if let TyKind::BoundVar(bound) = ty.interned(&Interner) {
@@ -716,13 +716,13 @@ fn transform_receiver_ty(
716 self_ty: &Canonical<Ty>, 716 self_ty: &Canonical<Ty>,
717) -> Option<Ty> { 717) -> Option<Ty> {
718 let substs = match function_id.lookup(db.upcast()).container { 718 let substs = match function_id.lookup(db.upcast()).container {
719 AssocContainerId::TraitId(_) => Substs::build_for_def(db, function_id) 719 AssocContainerId::TraitId(_) => Substitution::build_for_def(db, function_id)
720 .push(self_ty.value.clone()) 720 .push(self_ty.value.clone())
721 .fill_with_unknown() 721 .fill_with_unknown()
722 .build(), 722 .build(),
723 AssocContainerId::ImplId(impl_id) => { 723 AssocContainerId::ImplId(impl_id) => {
724 let impl_substs = inherent_impl_substs(db, impl_id, &self_ty)?; 724 let impl_substs = inherent_impl_substs(db, impl_id, &self_ty)?;
725 Substs::build_for_def(db, function_id) 725 Substitution::build_for_def(db, function_id)
726 .use_parent_substs(&impl_substs) 726 .use_parent_substs(&impl_substs)
727 .fill_with_unknown() 727 .fill_with_unknown()
728 .build() 728 .build()
@@ -768,7 +768,7 @@ fn generic_implements_goal(
768 self_ty: Canonical<Ty>, 768 self_ty: Canonical<Ty>,
769) -> Canonical<InEnvironment<super::Obligation>> { 769) -> Canonical<InEnvironment<super::Obligation>> {
770 let mut kinds = self_ty.kinds.to_vec(); 770 let mut kinds = self_ty.kinds.to_vec();
771 let substs = super::Substs::build_for_def(db, trait_) 771 let substs = super::Substitution::build_for_def(db, trait_)
772 .push(self_ty.value) 772 .push(self_ty.value)
773 .fill_with_bound_vars(DebruijnIndex::INNERMOST, kinds.len()) 773 .fill_with_bound_vars(DebruijnIndex::INNERMOST, kinds.len())
774 .build(); 774 .build();