@@ -583,27 +583,27 @@ impl ItemCtxt<'tcx> {
583583 param_id : hir:: HirId ,
584584 ty : Ty < ' tcx > ,
585585 only_self_bounds : OnlySelfBounds ,
586- ) -> Vec < ( ty:: Predicate < ' tcx > , Span ) > {
586+ ) -> impl Iterator < Item = ( ty:: Predicate < ' tcx > , Span ) > + ' _ {
587587 let constness = self . default_constness_for_trait_bounds ( ) ;
588588 let from_ty_params = ast_generics
589589 . params
590590 . iter ( )
591- . filter_map ( |param| match param. kind {
591+ . filter_map ( move |param| match param. kind {
592592 GenericParamKind :: Type { .. } if param. hir_id == param_id => Some ( & param. bounds ) ,
593593 _ => None ,
594594 } )
595- . flat_map ( |bounds| bounds. iter ( ) )
596- . flat_map ( |b| predicates_from_bound ( self , ty, b, constness) ) ;
595+ . flat_map ( move |bounds| bounds. iter ( ) )
596+ . flat_map ( move |b| predicates_from_bound ( self , ty, b, constness) ) ;
597597
598598 let from_where_clauses = ast_generics
599599 . where_clause
600600 . predicates
601601 . iter ( )
602- . filter_map ( |wp| match * wp {
602+ . filter_map ( move |wp| match * wp {
603603 hir:: WherePredicate :: BoundPredicate ( ref bp) => Some ( bp) ,
604604 _ => None ,
605605 } )
606- . flat_map ( |bp| {
606+ . flat_map ( move |bp| {
607607 let bt = if is_param ( self . tcx , & bp. bounded_ty , param_id) {
608608 Some ( ty)
609609 } else if !only_self_bounds. 0 {
@@ -613,9 +613,9 @@ impl ItemCtxt<'tcx> {
613613 } ;
614614 bp. bounds . iter ( ) . filter_map ( move |b| bt. map ( |bt| ( bt, b) ) )
615615 } )
616- . flat_map ( |( bt, b) | predicates_from_bound ( self , bt, b, constness) ) ;
616+ . flat_map ( move |( bt, b) | predicates_from_bound ( self , bt, b, constness) ) ;
617617
618- from_ty_params. chain ( from_where_clauses) . collect ( )
618+ from_ty_params. chain ( from_where_clauses)
619619 }
620620}
621621
0 commit comments