fn type_parameter_bounds_in_generics(&self,
                                         ast_generics: &hir::Generics,
                                         param_id: ast::NodeId,
                                         ty: Ty<'tcx>)
                                         -> Vec<ty::Predicate<'tcx>>
    {
        let from_ty_params =
            ast_generics.params.iter()
                .filter_map(|param| match param.kind {
                    GenericParamKind::Type { .. } if param.id == param_id => Some(&param.bounds),
                    _ => None
                })
                .flat_map(|bounds| bounds.iter())
                .flat_map(|b| predicates_from_bound(self, ty, b));

        let from_where_clauses =
            ast_generics.where_clause
                .predicates
                .iter()
                .filter_map(|wp| match *wp {
                    hir::WherePredicate::BoundPredicate(ref bp) => Some(bp),
                    _ => None
                })
                .filter(|bp| is_param(self.tcx, &bp.bounded_ty, param_id))
                .flat_map(|bp| bp.bounds.iter())
                .flat_map(|b| predicates_from_bound(self, ty, b));

        from_ty_params.chain(from_where_clauses).collect()
    }
/// Find bounds from hir::Generics. This requires scanning through the
/// AST. We do this to avoid having to convert *all* the bounds, which
/// would create artificial cycles. Instead we can only convert the
/// bounds for a type parameter `X` if `X::Foo` is used.
Find bounds from hir::Generics. This requires scanning through the
AST. We do this to avoid having to convert *all* the bounds, which
would create artificial cycles. Instead we can only convert the
bounds for a type parameter `X` if `X::Foo` is used.
Find bounds from hir :: Generics . This requires scanning through the AST . We do this to avoid having to convert * all * the bounds which would create artificial cycles . Instead we can only convert the bounds for a type parameter ` X ` if ` X :: Foo ` is used .
fn type_parameter_bounds_in_generics(&self,
                                         ast_generics: &hir::Generics,
                                         param_id: ast::NodeId,
                                         ty: Ty<'tcx>)
                                         -> Vec<ty::Predicate<'tcx>>
    {
        let from_ty_params =
            ast_generics.params.iter()
                .filter_map(|param| match param.kind {
                    GenericParamKind::Type { .. } if param.id == param_id => Some(&param.bounds),
                    _ => None
                })
                .flat_map(|bounds| bounds.iter())
                .flat_map(|b| predicates_from_bound(self, ty, b));
        let from_where_clauses =
            ast_generics.where_clause
                .predicates
                .iter()
                .filter_map(|wp| match *wp {
                    hir::WherePredicate::BoundPredicate(ref bp) => Some(bp),
                    _ => None
                })
                .filter(|bp| is_param(self.tcx, &bp.bounded_ty, param_id))
                .flat_map(|bp| bp.bounds.iter())
                .flat_map(|b| predicates_from_bound(self, ty, b));
        from_ty_params.chain(from_where_clauses).collect()
    }
fn type_parameter_bounds_in_generics ( & self , ast_generics : & hir :: Generics , param_id : ast :: NodeId , ty : Ty < ' tcx > ) -> Vec < ty :: Predicate < ' tcx > > { let from_ty_params = ast_generics . params . iter ( ) . filter_map ( | param | match param . kind { GenericParamKind :: Type { .. } if param . id == param_id => Some ( & param . bounds ) , _ => None } ) . flat_map ( | bounds | bounds . iter ( ) ) . flat_map ( | b | predicates_from_bound ( self , ty , b ) ) ; let from_where_clauses = ast_generics . where_clause . predicates . iter ( ) . filter_map ( | wp | match * wp { hir :: WherePredicate :: BoundPredicate ( ref bp ) => Some ( bp ) , _ => None } ) . filter ( | bp | is_param ( self . tcx , & bp . bounded_ty , param_id ) ) . flat_map ( | bp | bp . bounds . iter ( ) ) . flat_map ( | b | predicates_from_bound ( self , ty , b ) ) ; from_ty_params . chain ( from_where_clauses ) . collect ( ) }
Find bounds from hir::Generics.
Find bounds from hir :: Generics .
&self
ast_generics
&hir::Generics
param_id
ast::NodeId
ty
Ty<'tcx>
&self
ast_generics
&hir::Generics
param_id
ast::NodeId
ty
Ty<'tcx>