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/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_ty/src/utils.rs') diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index df0ea4368..a63075a19 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs @@ -72,7 +72,7 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec None, }) }) - .map(|pred| pred.subst(&trait_ref.substitution)) + .map(|pred| pred.substitute(&trait_ref.substitution)) .collect() } -- 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/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_ty/src/utils.rs') diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index a63075a19..c7786a199 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs @@ -72,7 +72,7 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec None, }) }) - .map(|pred| pred.substitute(&trait_ref.substitution)) + .map(|pred| pred.substitute(&Interner, &trait_ref.substitution)) .collect() } -- cgit v1.2.3 From a316d583600e11ee1fcc8027a838efafe435f03c Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 19:15:13 +0200 Subject: Rename shift_bound_vars{_out} to align with Chalk --- crates/hir_ty/src/utils.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/utils.rs') diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index c7786a199..d11708299 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs @@ -66,9 +66,11 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec { - Some(tr.clone().shift_bound_vars_out(DebruijnIndex::ONE)) - } + WhereClause::Implemented(tr) => Some( + tr.clone() + .shifted_out_to(DebruijnIndex::ONE) + .expect("FIXME unexpected higher-ranked trait bound"), + ), _ => None, }) }) @@ -103,6 +105,8 @@ pub(super) fn all_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec` and `Trait: OtherTrait` we'll get /// `Self: OtherTrait`. pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> Vec { + // FIXME: replace by Chalk's `super_traits`, maybe make this a query + // we need to take care a bit here to avoid infinite loops in case of cycles // (i.e. if we have `trait A: B; trait B: A;`) let mut result = vec![trait_ref]; -- cgit v1.2.3