pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> Vec<TraitRef> {
    // 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];
    let mut i = 0;
    while i < result.len() {
        let t = &result[i];
        // yeah this is quadratic, but trait hierarchies should be flat
        // enough that this doesn't matter
        for tt in direct_super_trait_refs(db, t) {
            if !result.iter().any(|tr| tr.trait_id == tt.trait_id) {
                result.push(tt);
            }
        }
        i += 1;
    }
    result
}
/// Given a trait ref (`Self: Trait`), builds all the implied trait refs for
/// super traits. The original trait ref will be included. So the difference to
/// `all_super_traits` is that we keep track of type parameters; for example if
/// we have `Self: Trait<u32, i32>` and `Trait<T, U>: OtherTrait<U>` we'll get
/// `Self: OtherTrait<i32>`.
Given a trait ref (`Self: Trait`), builds all the implied trait refs for
super traits. The original trait ref will be included.
Given a trait ref ( ` Self : Trait ` ) builds all the implied trait refs for super traits . The original trait ref will be included .
pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> Vec<TraitRef> {
    // 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];
    let mut i = 0;
    while i < result.len() {
        let t = &result[i];
        // yeah this is quadratic, but trait hierarchies should be flat
        // enough that this doesn't matter
        for tt in direct_super_trait_refs(db, t) {
            if !result.iter().any(|tr| tr.trait_id == tt.trait_id) {
                result.push(tt);
            }
        }
        i += 1;
    }
    result
}
pub ( super ) fn all_super_trait_refs ( db : & dyn HirDatabase , trait_ref : TraitRef ) -> Vec < TraitRef > { // 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 ] ; let mut i = 0 ; while i < result . len ( ) { let t = & result [ i ] ; // yeah this is quadratic, but trait hierarchies should be flat // enough that this doesn't matter for tt in direct_super_trait_refs ( db , t ) { if ! result . iter ( ) . any ( | tr | tr . trait_id == tt . trait_id ) { result . push ( tt ) ; } } i += 1 ; } result }
Given a trait ref (`Self: Trait`), builds all the implied trait refs for
super traits.
Given a trait ref ( ` Self : Trait ` ) builds all the implied trait refs for super traits .
db
&dyn HirDatabase
trait_ref
TraitRef
db
&dyn HirDatabase
trait_ref
TraitRef