/// Ensures that the super-predicates of the trait with def-id
/// trait_def_id are converted and stored. This also ensures that
/// the transitive super-predicates are converted;
Ensures that the super-predicates of the trait with def-id
trait_def_id are converted and stored. This also ensures that
the transitive super-predicates are converted.
Ensures that the super - predicates of the trait with def - id trait_def_id are converted and stored . This also ensures that the transitive super - predicates are converted .
fn super_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                 trait_def_id: DefId)
                                 -> ty::GenericPredicates<'tcx> {
    debug!("super_predicates(trait_def_id={:?})", trait_def_id);
    let trait_node_id = tcx.hir.as_local_node_id(trait_def_id).unwrap();
    let item = match 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::ItemKind::Trait(.., ref generics, ref supertraits, _) => (generics, supertraits),
        hir::ItemKind::TraitAlias(ref generics, ref supertraits) => (generics, supertraits),
        _ => span_bug!(item.span,
                       "super_predicates invoked on non-trait"),
    };
    let icx = ItemCtxt::new(tcx, trait_def_id);
    // 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(&icx,
                                      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 = icx.type_parameter_bounds_in_generics(generics, item.id, self_param_ty);
    // Combine the two lists to form the complete set of superbounds:
    let superbounds: Vec<_> = superbounds1.into_iter().chain(superbounds2).collect();
    // Now require that immediate supertraits are converted,
    // which will, in turn, reach indirect supertraits.
    for bound in superbounds.iter().filter_map(|p| p.to_opt_poly_trait_ref()) {
        tcx.at(item.span).super_predicates_of(bound.def_id());
    }
    ty::GenericPredicates {
        parent: None,
        predicates: superbounds
    }
}
fn super_predicates_of < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , trait_def_id : DefId ) -> ty :: GenericPredicates < ' tcx > { debug ! ( " " trait_def_id ) ; let trait_node_id = tcx . hir . as_local_node_id ( trait_def_id ) . unwrap ( ) ; let item = match tcx . hir . get ( trait_node_id ) { hir_map :: NodeItem ( item ) => item , _ => bug ! ( " " trait_node_id ) } ; let ( generics , bounds ) = match item . node { hir :: ItemKind :: Trait ( .. , ref generics , ref supertraits , _ ) => ( generics , supertraits ) , hir :: ItemKind :: TraitAlias ( ref generics , ref supertraits ) => ( generics , supertraits ) , _ => span_bug ! ( item span " " ) , } ; let icx = ItemCtxt :: new ( tcx , trait_def_id ) ; // 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 ( & icx , 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 = icx . type_parameter_bounds_in_generics ( generics , item . id , self_param_ty ) ; // Combine the two lists to form the complete set of superbounds: let superbounds : Vec < _ > = superbounds1 . into_iter ( ) . chain ( superbounds2 ) . collect ( ) ; // Now require that immediate supertraits are converted, // which will, in turn, reach indirect supertraits. for bound in superbounds . iter ( ) . filter_map ( | p | p . to_opt_poly_trait_ref ( ) ) { tcx . at ( item . span ) . super_predicates_of ( bound . def_id ( ) ) ; } ty :: GenericPredicates { parent : None , predicates : superbounds } }
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 .
tcx
TyCtxt<'a, 'tcx, 'tcx>
trait_def_id
DefId