pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &dyn AstConv<'gcx, 'tcx>,
                                        param_ty: Ty<'tcx>,
                                        ast_bounds: &[hir::GenericBound],
                                        sized_by_default: SizedByDefault,
                                        span: Span)
                                        -> Bounds<'tcx>
{
    let mut region_bounds = vec![];
    let mut trait_bounds = vec![];
    for ast_bound in ast_bounds {
        match *ast_bound {
            hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::None) => trait_bounds.push(b),
            hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => {}
            hir::GenericBound::Outlives(ref l) => region_bounds.push(l),
        }
    }

    let mut projection_bounds = vec![];

    let mut trait_bounds: Vec<_> = trait_bounds.iter().map(|&bound| {
        astconv.instantiate_poly_trait_ref(bound, param_ty, &mut projection_bounds)
    }).collect();

    let region_bounds = region_bounds.into_iter().map(|r| {
        astconv.ast_region_to_region(r, None)
    }).collect();

    trait_bounds.sort_by_key(|t| t.def_id());

    let implicitly_sized = if let SizedByDefault::Yes = sized_by_default {
        !is_unsized(astconv, ast_bounds, span)
    } else {
        false
    };

    Bounds {
        region_bounds,
        implicitly_sized,
        trait_bounds,
        projection_bounds,
    }
}
/// Translate the AST's notion of ty param bounds (which are an enum consisting of a newtyped Ty or
/// a region) to ty's notion of ty param bounds, which can either be user-defined traits, or the
/// built-in trait (formerly known as kind): Send.
Translate the AST's notion of ty param bounds (which are an enum consisting of a newtyped Ty or
a region) to ty's notion of ty param bounds, which can either be user-defined traits, or the
built-in trait (formerly known as kind): Send.
Translate the AST ' s notion of ty param bounds ( which are an enum consisting of a newtyped Ty or a region ) to ty ' s notion of ty param bounds which can either be user - defined traits or the built - in trait ( formerly known as kind ) : Send .
pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &dyn AstConv<'gcx, 'tcx>,
                                        param_ty: Ty<'tcx>,
                                        ast_bounds: &[hir::GenericBound],
                                        sized_by_default: SizedByDefault,
                                        span: Span)
                                        -> Bounds<'tcx>
{
    let mut region_bounds = vec![];
    let mut trait_bounds = vec![];
    for ast_bound in ast_bounds {
        match *ast_bound {
            hir::GenericBound::Trait(ref b, hir::TraitBoundModifier::None) => trait_bounds.push(b),
            hir::GenericBound::Trait(_, hir::TraitBoundModifier::Maybe) => {}
            hir::GenericBound::Outlives(ref l) => region_bounds.push(l),
        }
    }
    let mut projection_bounds = vec![];
    let mut trait_bounds: Vec<_> = trait_bounds.iter().map(|&bound| {
        astconv.instantiate_poly_trait_ref(bound, param_ty, &mut projection_bounds)
    }).collect();
    let region_bounds = region_bounds.into_iter().map(|r| {
        astconv.ast_region_to_region(r, None)
    }).collect();
    trait_bounds.sort_by_key(|t| t.def_id());
    let implicitly_sized = if let SizedByDefault::Yes = sized_by_default {
        !is_unsized(astconv, ast_bounds, span)
    } else {
        false
    };
    Bounds {
        region_bounds,
        implicitly_sized,
        trait_bounds,
        projection_bounds,
    }
}
pub fn compute_bounds < ' gcx : ' tcx , ' tcx > ( astconv : & dyn AstConv < ' gcx , ' tcx > , param_ty : Ty < ' tcx > , ast_bounds : & [ hir :: GenericBound ] , sized_by_default : SizedByDefault , span : Span ) -> Bounds < ' tcx > { let mut region_bounds = vec ! [ ] ; let mut trait_bounds = vec ! [ ] ; for ast_bound in ast_bounds { match * ast_bound { hir :: GenericBound :: Trait ( ref b , hir :: TraitBoundModifier :: None ) => trait_bounds . push ( b ) , hir :: GenericBound :: Trait ( _ , hir :: TraitBoundModifier :: Maybe ) => { } hir :: GenericBound :: Outlives ( ref l ) => region_bounds . push ( l ) , } } let mut projection_bounds = vec ! [ ] ; let mut trait_bounds : Vec < _ > = trait_bounds . iter ( ) . map ( | & bound | { astconv . instantiate_poly_trait_ref ( bound , param_ty , & mut projection_bounds ) } ) . collect ( ) ; let region_bounds = region_bounds . into_iter ( ) . map ( | r | { astconv . ast_region_to_region ( r , None ) } ) . collect ( ) ; trait_bounds . sort_by_key ( | t | t . def_id ( ) ) ; let implicitly_sized = if let SizedByDefault :: Yes = sized_by_default { ! is_unsized ( astconv , ast_bounds , span ) } else { false } ; Bounds { region_bounds , implicitly_sized , trait_bounds , projection_bounds , } }
Translate the AST's notion of ty param bounds (which are an enum consisting of a newtyped Ty or
a region) to ty's notion of ty param bounds, which can either be user-defined traits, or the
built-in trait (formerly known as kind): Send.
Translate the AST ' s notion of ty param bounds ( which are an enum consisting of a newtyped Ty or a region ) to ty ' s notion of ty param bounds which can either be user - defined traits or the built - in trait ( formerly known as kind ) : Send .
astconv
&dyn AstConv<'gcx, 'tcx>
param_ty
Ty<'tcx>
ast_bounds
&[hir::GenericBound]
sized_by_default
SizedByDefault
span
Span
astconv
&dyn AstConv<'gcx, 'tcx>
param_ty
Ty<'tcx>
ast_bounds
&[hir::GenericBound]
sized_by_default
SizedByDefault
span
Span