diff options
author | Florian Diebold <[email protected]> | 2021-04-05 18:15:13 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-05 18:21:03 +0100 |
commit | a316d583600e11ee1fcc8027a838efafe435f03c (patch) | |
tree | d4448b520724757956ba653e5c0a318b3abdb52c /crates/hir_ty/src/utils.rs | |
parent | fbab69cbffed37291b463c0e57fade49581e1de2 (diff) |
Rename shift_bound_vars{_out} to align with Chalk
Diffstat (limited to 'crates/hir_ty/src/utils.rs')
-rw-r--r-- | crates/hir_ty/src/utils.rs | 10 |
1 files changed, 7 insertions, 3 deletions
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<Tr | |||
66 | .filter_map(|pred| { | 66 | .filter_map(|pred| { |
67 | pred.as_ref().filter_map(|pred| match pred.skip_binders() { | 67 | pred.as_ref().filter_map(|pred| match pred.skip_binders() { |
68 | // FIXME: how to correctly handle higher-ranked bounds here? | 68 | // FIXME: how to correctly handle higher-ranked bounds here? |
69 | WhereClause::Implemented(tr) => { | 69 | WhereClause::Implemented(tr) => Some( |
70 | Some(tr.clone().shift_bound_vars_out(DebruijnIndex::ONE)) | 70 | tr.clone() |
71 | } | 71 | .shifted_out_to(DebruijnIndex::ONE) |
72 | .expect("FIXME unexpected higher-ranked trait bound"), | ||
73 | ), | ||
72 | _ => None, | 74 | _ => None, |
73 | }) | 75 | }) |
74 | }) | 76 | }) |
@@ -103,6 +105,8 @@ pub(super) fn all_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<Tra | |||
103 | /// we have `Self: Trait<u32, i32>` and `Trait<T, U>: OtherTrait<U>` we'll get | 105 | /// we have `Self: Trait<u32, i32>` and `Trait<T, U>: OtherTrait<U>` we'll get |
104 | /// `Self: OtherTrait<i32>`. | 106 | /// `Self: OtherTrait<i32>`. |
105 | pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> Vec<TraitRef> { | 107 | pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> Vec<TraitRef> { |
108 | // FIXME: replace by Chalk's `super_traits`, maybe make this a query | ||
109 | |||
106 | // we need to take care a bit here to avoid infinite loops in case of cycles | 110 | // we need to take care a bit here to avoid infinite loops in case of cycles |
107 | // (i.e. if we have `trait A: B; trait B: A;`) | 111 | // (i.e. if we have `trait A: B; trait B: A;`) |
108 | let mut result = vec![trait_ref]; | 112 | let mut result = vec![trait_ref]; |