fn ensure_super_predicates_step(ccx: &CrateCtxt,
                                trait_def_id: DefId)
                                -> Vec<DefId>
{
    let tcx = ccx.tcx;

    debug!("ensure_super_predicates_step(trait_def_id={:?})", trait_def_id);

    let trait_node_id = if let Some(n) = tcx.hir.as_local_node_id(trait_def_id) {
        n
    } else {
        // If this trait comes from an external crate, then all of the
        // supertraits it may depend on also must come from external
        // crates, and hence all of them already have their
        // super-predicates "converted" (and available from crate
        // meta-data), so there is no need to transitively test them.
        return Vec::new();
    };

    let superpredicates = tcx.super_predicates.borrow().get(&trait_def_id).cloned();
    let superpredicates = superpredicates.unwrap_or_else(|| {
        let item = match ccx.tcx.hir.get(trait_node_id) {
            hir_map::NodeItem(item) => item,
            _ => bug!("trait_node_id {} is not an item", trait_node_id)
        };

        let (generics, bounds) = match item.node {
            hir::ItemTrait(_, ref generics, ref supertraits, _) => (generics, supertraits),
            _ => span_bug!(item.span,
                           "ensure_super_predicates_step invoked on non-trait"),
        };

        // In-scope when converting the superbounds for `Trait` are
        // that `Self:Trait` as well as any bounds that appear on the
        // generic types:
        generics_of_def_id(ccx, trait_def_id);
        trait_def_of_item(ccx, item);
        let trait_ref = ty::TraitRef {
            def_id: trait_def_id,
            substs: Substs::identity_for_item(tcx, trait_def_id)
        };
        let self_predicate = ty::GenericPredicates {
            parent: None,
            predicates: vec![trait_ref.to_predicate()]
        };
        let scope = &(generics, &self_predicate);

        // Convert the bounds that follow the colon, e.g. `Bar+Zed` in `trait Foo : Bar+Zed`.
        let self_param_ty = tcx.mk_self_type();
        let superbounds1 = compute_bounds(&ccx.icx(scope),
                                          self_param_ty,
                                          bounds,
                                          SizedByDefault::No,
                                          item.span);

        let superbounds1 = superbounds1.predicates(tcx, self_param_ty);

        // Convert any explicit superbounds in the where clause,
        // e.g. `trait Foo where Self : Bar`:
        let superbounds2 = generics.get_type_parameter_bounds(&ccx.icx(scope), item.span, item.id);

        // Combine the two lists to form the complete set of superbounds:
        let superbounds = superbounds1.into_iter().chain(superbounds2).collect();
        let superpredicates = ty::GenericPredicates {
            parent: None,
            predicates: superbounds
        };
        debug!("superpredicates for trait {:?} = {:?}",
               tcx.hir.local_def_id(item.id),
               superpredicates);

        tcx.super_predicates.borrow_mut().insert(trait_def_id, superpredicates.clone());

        superpredicates
    });

    let def_ids: Vec<_> = superpredicates.predicates
                                         .iter()
                                         .filter_map(|p| p.to_opt_poly_trait_ref())
                                         .map(|tr| tr.def_id())
                                         .collect();

    debug!("ensure_super_predicates_step: def_ids={:?}", def_ids);

    def_ids
}
/// Ensures that the super-predicates of the trait with def-id
/// trait_def_id are converted and stored. This does NOT ensure that
/// the transitive super-predicates are converted; that is the job of
/// the `ensure_super_predicates()` method in the `AstConv` impl
/// above. Returns a list of trait def-ids that must be ensured as
/// well to guarantee that the transitive superpredicates are
/// converted.
Ensures that the super-predicates of the trait with def-id
trait_def_id are converted and stored. This does NOT ensure that
the transitive super-predicates are converted; that is the job of
the `ensure_super_predicates()` method in the `AstConv` impl
above. Returns a list of trait def-ids that must be ensured as
well to guarantee that the transitive superpredicates are
converted.
Ensures that the super - predicates of the trait with def - id trait_def_id are converted and stored . This does NOT ensure that the transitive super - predicates are converted ; that is the job of the ` ensure_super_predicates () ` method in the ` AstConv ` impl above . Returns a list of trait def - ids that must be ensured as well to guarantee that the transitive superpredicates are converted .
fn ensure_super_predicates_step(ccx: &CrateCtxt,
                                trait_def_id: DefId)
                                -> Vec<DefId>
{
    let tcx = ccx.tcx;
    debug!("ensure_super_predicates_step(trait_def_id={:?})", trait_def_id);
    let trait_node_id = if let Some(n) = tcx.hir.as_local_node_id(trait_def_id) {
        n
    } else {
        // If this trait comes from an external crate, then all of the
        // supertraits it may depend on also must come from external
        // crates, and hence all of them already have their
        // super-predicates "converted" (and available from crate
        // meta-data), so there is no need to transitively test them.
        return Vec::new();
    };
    let superpredicates = tcx.super_predicates.borrow().get(&trait_def_id).cloned();
    let superpredicates = superpredicates.unwrap_or_else(|| {
        let item = match ccx.tcx.hir.get(trait_node_id) {
            hir_map::NodeItem(item) => item,
            _ => bug!("trait_node_id {} is not an item", trait_node_id)
        };
        let (generics, bounds) = match item.node {
            hir::ItemTrait(_, ref generics, ref supertraits, _) => (generics, supertraits),
            _ => span_bug!(item.span,
                           "ensure_super_predicates_step invoked on non-trait"),
        };
        // In-scope when converting the superbounds for `Trait` are
        // that `Self:Trait` as well as any bounds that appear on the
        // generic types:
        generics_of_def_id(ccx, trait_def_id);
        trait_def_of_item(ccx, item);
        let trait_ref = ty::TraitRef {
            def_id: trait_def_id,
            substs: Substs::identity_for_item(tcx, trait_def_id)
        };
        let self_predicate = ty::GenericPredicates {
            parent: None,
            predicates: vec![trait_ref.to_predicate()]
        };
        let scope = &(generics, &self_predicate);
        // Convert the bounds that follow the colon, e.g. `Bar+Zed` in `trait Foo : Bar+Zed`.
        let self_param_ty = tcx.mk_self_type();
        let superbounds1 = compute_bounds(&ccx.icx(scope),
                                          self_param_ty,
                                          bounds,
                                          SizedByDefault::No,
                                          item.span);
        let superbounds1 = superbounds1.predicates(tcx, self_param_ty);
        // Convert any explicit superbounds in the where clause,
        // e.g. `trait Foo where Self : Bar`:
        let superbounds2 = generics.get_type_parameter_bounds(&ccx.icx(scope), item.span, item.id);
        // Combine the two lists to form the complete set of superbounds:
        let superbounds = superbounds1.into_iter().chain(superbounds2).collect();
        let superpredicates = ty::GenericPredicates {
            parent: None,
            predicates: superbounds
        };
        debug!("superpredicates for trait {:?} = {:?}",
               tcx.hir.local_def_id(item.id),
               superpredicates);
        tcx.super_predicates.borrow_mut().insert(trait_def_id, superpredicates.clone());
        superpredicates
    });
    let def_ids: Vec<_> = superpredicates.predicates
                                         .iter()
                                         .filter_map(|p| p.to_opt_poly_trait_ref())
                                         .map(|tr| tr.def_id())
                                         .collect();
    debug!("ensure_super_predicates_step: def_ids={:?}", def_ids);
    def_ids
}
fn ensure_super_predicates_step ( ccx : & CrateCtxt , trait_def_id : DefId ) -> Vec < DefId > { let tcx = ccx . tcx ; debug ! ( " " trait_def_id ) ; let trait_node_id = if let Some ( n ) = tcx . hir . as_local_node_id ( trait_def_id ) { n } else { // If this trait comes from an external crate, then all of the // supertraits it may depend on also must come from external // crates, and hence all of them already have their // super-predicates "converted" (and available from crate // meta-data), so there is no need to transitively test them. return Vec :: new ( ) ; } ; let superpredicates = tcx . super_predicates . borrow ( ) . get ( & trait_def_id ) . cloned ( ) ; let superpredicates = superpredicates . unwrap_or_else ( | | { let item = match ccx . tcx . hir . get ( trait_node_id ) { hir_map :: NodeItem ( item ) => item , _ => bug ! ( " " trait_node_id ) } ; let ( generics , bounds ) = match item . node { hir :: ItemTrait ( _ , ref generics , ref supertraits , _ ) => ( generics , supertraits ) , _ => span_bug ! ( item span " " ) , } ; // In-scope when converting the superbounds for `Trait` are // that `Self:Trait` as well as any bounds that appear on the // generic types: generics_of_def_id ( ccx , trait_def_id ) ; trait_def_of_item ( ccx , item ) ; let trait_ref = ty :: TraitRef { def_id : trait_def_id , substs : Substs :: identity_for_item ( tcx , trait_def_id ) } ; let self_predicate = ty :: GenericPredicates { parent : None , predicates : vec ! [ trait_ref to_predicate ( ) ] } ; let scope = & ( generics , & self_predicate ) ; // Convert the bounds that follow the colon, e.g. `Bar+Zed` in `trait Foo : Bar+Zed`. let self_param_ty = tcx . mk_self_type ( ) ; let superbounds1 = compute_bounds ( & ccx . icx ( scope ) , self_param_ty , bounds , SizedByDefault :: No , item . span ) ; let superbounds1 = superbounds1 . predicates ( tcx , self_param_ty ) ; // Convert any explicit superbounds in the where clause, // e.g. `trait Foo where Self : Bar`: let superbounds2 = generics . get_type_parameter_bounds ( & ccx . icx ( scope ) , item . span , item . id ) ; // Combine the two lists to form the complete set of superbounds: let superbounds = superbounds1 . into_iter ( ) . chain ( superbounds2 ) . collect ( ) ; let superpredicates = ty :: GenericPredicates { parent : None , predicates : superbounds } ; debug ! ( " " tcx hir local_def_id ( item id ) superpredicates ) ; tcx . super_predicates . borrow_mut ( ) . insert ( trait_def_id , superpredicates . clone ( ) ) ; superpredicates } ) ; let def_ids : Vec < _ > = superpredicates . predicates . iter ( ) . filter_map ( | p | p . to_opt_poly_trait_ref ( ) ) . map ( | tr | tr . def_id ( ) ) . collect ( ) ; debug ! ( " " def_ids ) ; def_ids }
Ensures that the super-predicates of the trait with def-id
trait_def_id are converted and stored.
Ensures that the super - predicates of the trait with def - id trait_def_id are converted and stored .
ccx
&CrateCtxt
trait_def_id
DefId