/// Returns an iterator over the whole super trait hierarchy (including the
/// trait itself).
Returns an iterator over the whole super trait hierarchy (including the
trait itself).
Returns an iterator over the whole super trait hierarchy ( including the trait itself ) .
pub(super) fn all_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
    // 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_];
    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_traits(db, t) {
            if !result.contains(&tt) {
                result.push(tt);
            }
        }
        i += 1;
    }
    result
}
pub ( super ) fn all_super_traits ( db : & dyn DefDatabase , trait_ : TraitId ) -> Vec < TraitId > { // 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_ ] ; 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_traits ( db , t ) { if ! result . contains ( & tt ) { result . push ( tt ) ; } } i += 1 ; } result }
Returns an iterator over the whole super trait hierarchy (including the
trait itself).
Returns an iterator over the whole super trait hierarchy ( including the trait itself ) .
db
&dyn DefDatabase
trait_
TraitId