fn predicates_from_bound<'tcx>(astconv: &dyn AstConv<'tcx, 'tcx>,
                               param_ty: Ty<'tcx>,
                               bound: &hir::GenericBound)
                               -> Vec<ty::Predicate<'tcx>>
{
    match *bound {
        hir::GenericBound::Trait(ref tr, hir::TraitBoundModifier::None) => {
            let mut projections = Vec::new();
            let pred = astconv.instantiate_poly_trait_ref(tr,
                                                          param_ty,
                                                          &mut projections);
            projections.into_iter()
                       .map(|p| p.to_predicate())
                       .chain(Some(pred.to_predicate()))
                       .collect()
        }
        hir::GenericBound::Outlives(ref lifetime) => {
            let region = astconv.ast_region_to_region(lifetime, None);
            let pred = ty::Binder::bind(ty::OutlivesPredicate(param_ty, region));
            vec![ty::Predicate::TypeOutlives(pred)]
        }
        hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => vec![],
    }
}
/// Converts a specific GenericBound from the AST into a set of
/// predicates that apply to the self-type. A vector is returned
/// because this can be anywhere from 0 predicates (`T:?Sized` adds no
/// predicates) to 1 (`T:Foo`) to many (`T:Bar<X=i32>` adds `T:Bar`
/// and `<T as Bar>::X == i32`).
Converts a specific GenericBound from the AST into a set of
predicates that apply to the self-type.
Converts a specific GenericBound from the AST into a set of predicates that apply to the self - type .
fn predicates_from_bound<'tcx>(astconv: &dyn AstConv<'tcx, 'tcx>,
                               param_ty: Ty<'tcx>,
                               bound: &hir::GenericBound)
                               -> Vec<ty::Predicate<'tcx>>
{
    match *bound {
        hir::GenericBound::Trait(ref tr, hir::TraitBoundModifier::None) => {
            let mut projections = Vec::new();
            let pred = astconv.instantiate_poly_trait_ref(tr,
                                                          param_ty,
                                                          &mut projections);
            projections.into_iter()
                       .map(|p| p.to_predicate())
                       .chain(Some(pred.to_predicate()))
                       .collect()
        }
        hir::GenericBound::Outlives(ref lifetime) => {
            let region = astconv.ast_region_to_region(lifetime, None);
            let pred = ty::Binder::bind(ty::OutlivesPredicate(param_ty, region));
            vec![ty::Predicate::TypeOutlives(pred)]
        }
        hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => vec![],
    }
}
fn predicates_from_bound < ' tcx > ( astconv : & dyn AstConv < ' tcx , ' tcx > , param_ty : Ty < ' tcx > , bound : & hir :: GenericBound ) -> Vec < ty :: Predicate < ' tcx > > { match * bound { hir :: GenericBound :: Trait ( ref tr , hir :: TraitBoundModifier :: None ) => { let mut projections = Vec :: new ( ) ; let pred = astconv . instantiate_poly_trait_ref ( tr , param_ty , & mut projections ) ; projections . into_iter ( ) . map ( | p | p . to_predicate ( ) ) . chain ( Some ( pred . to_predicate ( ) ) ) . collect ( ) } hir :: GenericBound :: Outlives ( ref lifetime ) => { let region = astconv . ast_region_to_region ( lifetime , None ) ; let pred = ty :: Binder :: bind ( ty :: OutlivesPredicate ( param_ty , region ) ) ; vec ! [ ty Predicate TypeOutlives ( pred ) ] } hir :: GenericBound :: Trait ( _ , hir :: TraitBoundModifier :: Maybe ) => vec ! [ ] , } }
Converts a specific GenericBound from the AST into a set of
predicates that apply to the self-type.
Converts a specific GenericBound from the AST into a set of predicates that apply to the self - type .
astconv
&dyn AstConv<'tcx, 'tcx>
param_ty
Ty<'tcx>
bound
&hir::GenericBound
astconv
&dyn AstConv<'tcx, 'tcx>
param_ty
Ty<'tcx>
bound
&hir::GenericBound