@@ -46,6 +46,7 @@ use crate::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS};
46
46
use crate :: middle:: cstore:: CrateStore ;
47
47
use crate :: session:: config:: nightly_options;
48
48
use crate :: session:: Session ;
49
+ use crate :: util:: captures:: Captures ;
49
50
use crate :: util:: common:: FN_OUTPUT_NAME ;
50
51
use crate :: util:: nodemap:: { DefIdMap , NodeMap } ;
51
52
use errors:: Applicability ;
@@ -897,7 +898,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
897
898
} ) ;
898
899
899
900
let mut lowered_params: Vec < _ > =
900
- lowered_generics. params . into_iter ( ) . chain ( in_band_defs. into_iter ( ) ) . collect ( ) ;
901
+ lowered_generics. params . into_iter ( ) . chain ( in_band_defs) . collect ( ) ;
901
902
902
903
// FIXME(const_generics): the compiler doesn't always cope with
903
904
// unsorted generic parameters at the moment, so we make sure
@@ -2489,9 +2490,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2489
2490
add_bounds : & NodeMap < Vec < GenericBound > > ,
2490
2491
mut itctx : ImplTraitContext < ' _ , ' hir > ,
2491
2492
) -> hir:: GenericParam < ' hir > {
2492
- let mut bounds = self
2493
+ let mut bounds: Vec < _ > = self
2493
2494
. with_anonymous_lifetime_mode ( AnonymousLifetimeMode :: ReportError , |this| {
2494
- this. lower_param_bounds_mut ( & param. bounds , itctx. reborrow ( ) )
2495
+ this. lower_param_bounds_mut ( & param. bounds , itctx. reborrow ( ) ) . collect ( )
2495
2496
} ) ;
2496
2497
2497
2498
let ( name, kind) = match param. kind {
@@ -2609,12 +2610,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2609
2610
self . arena . alloc_from_iter ( self . lower_param_bounds_mut ( bounds, itctx) )
2610
2611
}
2611
2612
2612
- fn lower_param_bounds_mut (
2613
- & mut self ,
2614
- bounds : & [ GenericBound ] ,
2615
- mut itctx : ImplTraitContext < ' _ , ' hir > ,
2616
- ) -> Vec < hir:: GenericBound < ' hir > > {
2617
- bounds. iter ( ) . map ( |bound| self . lower_param_bound ( bound, itctx. reborrow ( ) ) ) . collect ( )
2613
+ fn lower_param_bounds_mut < ' s > (
2614
+ & ' s mut self ,
2615
+ bounds : & ' s [ GenericBound ] ,
2616
+ mut itctx : ImplTraitContext < ' s , ' hir > ,
2617
+ ) -> impl Iterator < Item = hir:: GenericBound < ' hir > > + Captures < ' s > + Captures < ' a > {
2618
+ bounds. iter ( ) . map ( move |bound| self . lower_param_bound ( bound, itctx. reborrow ( ) ) )
2618
2619
}
2619
2620
2620
2621
fn lower_block ( & mut self , b : & Block , targeted_by_break : bool ) -> & ' hir hir:: Block < ' hir > {
0 commit comments