@@ -686,7 +686,7 @@ impl<'a> LoweringContext<'a> {
686
686
f : F ,
687
687
) -> ( Vec < hir:: GenericParam > , T )
688
688
where
689
- F : FnOnce ( & mut LoweringContext ) -> ( Vec < hir:: GenericParam > , T ) ,
689
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> ( Vec < hir:: GenericParam > , T ) ,
690
690
{
691
691
assert ! ( !self . is_collecting_in_band_lifetimes) ;
692
692
assert ! ( self . lifetimes_to_define. is_empty( ) ) ;
@@ -788,7 +788,7 @@ impl<'a> LoweringContext<'a> {
788
788
// for them.
789
789
fn with_in_scope_lifetime_defs < T , F > ( & mut self , params : & [ GenericParam ] , f : F ) -> T
790
790
where
791
- F : FnOnce ( & mut LoweringContext ) -> T ,
791
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
792
792
{
793
793
let old_len = self . in_scope_lifetimes . len ( ) ;
794
794
let lt_def_names = params. iter ( ) . filter_map ( |param| match param. kind {
@@ -812,7 +812,7 @@ impl<'a> LoweringContext<'a> {
812
812
params : & HirVec < hir:: GenericParam > ,
813
813
f : F
814
814
) -> T where
815
- F : FnOnce ( & mut LoweringContext ) -> T ,
815
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
816
816
{
817
817
let old_len = self . in_scope_lifetimes . len ( ) ;
818
818
let lt_def_names = params. iter ( ) . filter_map ( |param| match param. kind {
@@ -841,7 +841,7 @@ impl<'a> LoweringContext<'a> {
841
841
f : F ,
842
842
) -> ( hir:: Generics , T )
843
843
where
844
- F : FnOnce ( & mut LoweringContext , & mut Vec < hir:: GenericParam > ) -> T ,
844
+ F : FnOnce ( & mut LoweringContext < ' _ > , & mut Vec < hir:: GenericParam > ) -> T ,
845
845
{
846
846
let ( in_band_defs, ( mut lowered_generics, res) ) = self . with_in_scope_lifetime_defs (
847
847
& generics. params ,
@@ -870,7 +870,7 @@ impl<'a> LoweringContext<'a> {
870
870
871
871
fn with_catch_scope < T , F > ( & mut self , catch_id : NodeId , f : F ) -> T
872
872
where
873
- F : FnOnce ( & mut LoweringContext ) -> T ,
873
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
874
874
{
875
875
let len = self . catch_scopes . len ( ) ;
876
876
self . catch_scopes . push ( catch_id) ;
@@ -892,7 +892,7 @@ impl<'a> LoweringContext<'a> {
892
892
capture_clause : CaptureBy ,
893
893
closure_node_id : NodeId ,
894
894
ret_ty : Option < & Ty > ,
895
- body : impl FnOnce ( & mut LoweringContext ) -> hir:: Expr ,
895
+ body : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: Expr ,
896
896
) -> hir:: ExprKind {
897
897
let prev_is_generator = mem:: replace ( & mut self . is_generator , true ) ;
898
898
let body_expr = body ( self ) ;
@@ -929,7 +929,7 @@ impl<'a> LoweringContext<'a> {
929
929
930
930
fn lower_body < F > ( & mut self , decl : Option < & FnDecl > , f : F ) -> hir:: BodyId
931
931
where
932
- F : FnOnce ( & mut LoweringContext ) -> hir:: Expr ,
932
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: Expr ,
933
933
{
934
934
let prev = mem:: replace ( & mut self . is_generator , false ) ;
935
935
let result = f ( self ) ;
@@ -940,7 +940,7 @@ impl<'a> LoweringContext<'a> {
940
940
941
941
fn with_loop_scope < T , F > ( & mut self , loop_id : NodeId , f : F ) -> T
942
942
where
943
- F : FnOnce ( & mut LoweringContext ) -> T ,
943
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
944
944
{
945
945
// We're no longer in the base loop's condition; we're in another loop.
946
946
let was_in_loop_condition = self . is_in_loop_condition ;
@@ -965,7 +965,7 @@ impl<'a> LoweringContext<'a> {
965
965
966
966
fn with_loop_condition_scope < T , F > ( & mut self , f : F ) -> T
967
967
where
968
- F : FnOnce ( & mut LoweringContext ) -> T ,
968
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
969
969
{
970
970
let was_in_loop_condition = self . is_in_loop_condition ;
971
971
self . is_in_loop_condition = true ;
@@ -979,7 +979,7 @@ impl<'a> LoweringContext<'a> {
979
979
980
980
fn with_new_scopes < T , F > ( & mut self , f : F ) -> T
981
981
where
982
- F : FnOnce ( & mut LoweringContext ) -> T ,
982
+ F : FnOnce ( & mut LoweringContext < ' _ > ) -> T ,
983
983
{
984
984
let was_in_loop_condition = self . is_in_loop_condition ;
985
985
self . is_in_loop_condition = false ;
@@ -1094,7 +1094,8 @@ impl<'a> LoweringContext<'a> {
1094
1094
}
1095
1095
}
1096
1096
1097
- fn lower_ty_binding ( & mut self , b : & TypeBinding , itctx : ImplTraitContext ) -> hir:: TypeBinding {
1097
+ fn lower_ty_binding ( & mut self , b : & TypeBinding ,
1098
+ itctx : ImplTraitContext < ' _ > ) -> hir:: TypeBinding {
1098
1099
hir:: TypeBinding {
1099
1100
id : self . lower_node_id ( b. id ) . node_id ,
1100
1101
ident : b. ident ,
@@ -1105,19 +1106,19 @@ impl<'a> LoweringContext<'a> {
1105
1106
1106
1107
fn lower_generic_arg ( & mut self ,
1107
1108
arg : & ast:: GenericArg ,
1108
- itctx : ImplTraitContext )
1109
+ itctx : ImplTraitContext < ' _ > )
1109
1110
-> hir:: GenericArg {
1110
1111
match arg {
1111
1112
ast:: GenericArg :: Lifetime ( lt) => GenericArg :: Lifetime ( self . lower_lifetime ( & lt) ) ,
1112
1113
ast:: GenericArg :: Type ( ty) => GenericArg :: Type ( self . lower_ty_direct ( & ty, itctx) ) ,
1113
1114
}
1114
1115
}
1115
1116
1116
- fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> P < hir:: Ty > {
1117
+ fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext < ' _ > ) -> P < hir:: Ty > {
1117
1118
P ( self . lower_ty_direct ( t, itctx) )
1118
1119
}
1119
1120
1120
- fn lower_ty_direct ( & mut self , t : & Ty , mut itctx : ImplTraitContext ) -> hir:: Ty {
1121
+ fn lower_ty_direct ( & mut self , t : & Ty , mut itctx : ImplTraitContext < ' _ > ) -> hir:: Ty {
1121
1122
let kind = match t. node {
1122
1123
TyKind :: Infer => hir:: TyKind :: Infer ,
1123
1124
TyKind :: Err => hir:: TyKind :: Err ,
@@ -1289,7 +1290,7 @@ impl<'a> LoweringContext<'a> {
1289
1290
span : Span ,
1290
1291
fn_def_id : Option < DefId > ,
1291
1292
exist_ty_node_id : NodeId ,
1292
- lower_bounds : impl FnOnce ( & mut LoweringContext ) -> hir:: GenericBounds ,
1293
+ lower_bounds : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: GenericBounds ,
1293
1294
) -> hir:: TyKind {
1294
1295
// Make sure we know that some funky desugaring has been going on here.
1295
1296
// This is a first: there is code in other places like for loop
@@ -1567,7 +1568,7 @@ impl<'a> LoweringContext<'a> {
1567
1568
qself : & Option < QSelf > ,
1568
1569
p : & Path ,
1569
1570
param_mode : ParamMode ,
1570
- mut itctx : ImplTraitContext ,
1571
+ mut itctx : ImplTraitContext < ' _ > ,
1571
1572
) -> hir:: QPath {
1572
1573
let qself_position = qself. as_ref ( ) . map ( |q| q. position ) ;
1573
1574
let qself = qself. as_ref ( ) . map ( |q| self . lower_ty ( & q. ty , itctx. reborrow ( ) ) ) ;
@@ -1762,7 +1763,7 @@ impl<'a> LoweringContext<'a> {
1762
1763
param_mode : ParamMode ,
1763
1764
expected_lifetimes : usize ,
1764
1765
parenthesized_generic_args : ParenthesizedGenericArgs ,
1765
- itctx : ImplTraitContext ,
1766
+ itctx : ImplTraitContext < ' _ > ,
1766
1767
) -> hir:: PathSegment {
1767
1768
let ( mut generic_args, infer_types) = if let Some ( ref generic_args) = segment. args {
1768
1769
let msg = "parenthesized parameters may only be used with a trait" ;
@@ -1844,7 +1845,7 @@ impl<'a> LoweringContext<'a> {
1844
1845
& mut self ,
1845
1846
data : & AngleBracketedArgs ,
1846
1847
param_mode : ParamMode ,
1847
- mut itctx : ImplTraitContext ,
1848
+ mut itctx : ImplTraitContext < ' _ > ,
1848
1849
) -> ( hir:: GenericArgs , bool ) {
1849
1850
let & AngleBracketedArgs { ref args, ref bindings, .. } = data;
1850
1851
let has_types = args. iter ( ) . any ( |arg| match arg {
@@ -1871,7 +1872,7 @@ impl<'a> LoweringContext<'a> {
1871
1872
self . with_anonymous_lifetime_mode (
1872
1873
AnonymousLifetimeMode :: PassThrough ,
1873
1874
|this| {
1874
- const DISALLOWED : ImplTraitContext = ImplTraitContext :: Disallowed ;
1875
+ const DISALLOWED : ImplTraitContext < ' _ > = ImplTraitContext :: Disallowed ;
1875
1876
let & ParenthesisedArgs { ref inputs, ref output, span } = data;
1876
1877
let inputs = inputs. iter ( ) . map ( |ty| this. lower_ty_direct ( ty, DISALLOWED ) ) . collect ( ) ;
1877
1878
let mk_tup = |this : & mut Self , tys, span| {
@@ -2250,7 +2251,7 @@ impl<'a> LoweringContext<'a> {
2250
2251
fn lower_param_bound (
2251
2252
& mut self ,
2252
2253
tpb : & GenericBound ,
2253
- itctx : ImplTraitContext ,
2254
+ itctx : ImplTraitContext < ' _ > ,
2254
2255
) -> hir:: GenericBound {
2255
2256
match * tpb {
2256
2257
GenericBound :: Trait ( ref ty, modifier) => hir:: GenericBound :: Trait (
@@ -2304,7 +2305,7 @@ impl<'a> LoweringContext<'a> {
2304
2305
& mut self ,
2305
2306
params : & [ GenericParam ] ,
2306
2307
add_bounds : & NodeMap < Vec < GenericBound > > ,
2307
- mut itctx : ImplTraitContext ,
2308
+ mut itctx : ImplTraitContext < ' _ > ,
2308
2309
) -> hir:: HirVec < hir:: GenericParam > {
2309
2310
params. iter ( ) . map ( |param| {
2310
2311
self . lower_generic_param ( param, add_bounds, itctx. reborrow ( ) )
@@ -2314,7 +2315,7 @@ impl<'a> LoweringContext<'a> {
2314
2315
fn lower_generic_param ( & mut self ,
2315
2316
param : & GenericParam ,
2316
2317
add_bounds : & NodeMap < Vec < GenericBound > > ,
2317
- mut itctx : ImplTraitContext )
2318
+ mut itctx : ImplTraitContext < ' _ > )
2318
2319
-> hir:: GenericParam {
2319
2320
let mut bounds = self . lower_param_bounds ( & param. bounds , itctx. reborrow ( ) ) ;
2320
2321
match param. kind {
@@ -2383,7 +2384,7 @@ impl<'a> LoweringContext<'a> {
2383
2384
fn lower_generics (
2384
2385
& mut self ,
2385
2386
generics : & Generics ,
2386
- itctx : ImplTraitContext )
2387
+ itctx : ImplTraitContext < ' _ > )
2387
2388
-> hir:: Generics
2388
2389
{
2389
2390
// Collect `?Trait` bounds in where clause and move them to parameter definitions.
@@ -2536,7 +2537,7 @@ impl<'a> LoweringContext<'a> {
2536
2537
}
2537
2538
}
2538
2539
2539
- fn lower_trait_ref ( & mut self , p : & TraitRef , itctx : ImplTraitContext ) -> hir:: TraitRef {
2540
+ fn lower_trait_ref ( & mut self , p : & TraitRef , itctx : ImplTraitContext < ' _ > ) -> hir:: TraitRef {
2540
2541
let path = match self . lower_qpath ( p. ref_id , & None , & p. path , ParamMode :: Explicit , itctx) {
2541
2542
hir:: QPath :: Resolved ( None , path) => path. and_then ( |path| path) ,
2542
2543
qpath => bug ! ( "lower_trait_ref: unexpected QPath `{:?}`" , qpath) ,
@@ -2552,7 +2553,7 @@ impl<'a> LoweringContext<'a> {
2552
2553
fn lower_poly_trait_ref (
2553
2554
& mut self ,
2554
2555
p : & PolyTraitRef ,
2555
- mut itctx : ImplTraitContext ,
2556
+ mut itctx : ImplTraitContext < ' _ > ,
2556
2557
) -> hir:: PolyTraitRef {
2557
2558
let bound_generic_params =
2558
2559
self . lower_generic_params ( & p. bound_generic_params , & NodeMap ( ) , itctx. reborrow ( ) ) ;
@@ -2593,14 +2594,14 @@ impl<'a> LoweringContext<'a> {
2593
2594
}
2594
2595
}
2595
2596
2596
- fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext ) -> hir:: MutTy {
2597
+ fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext < ' _ > ) -> hir:: MutTy {
2597
2598
hir:: MutTy {
2598
2599
ty : self . lower_ty ( & mt. ty , itctx) ,
2599
2600
mutbl : self . lower_mutability ( mt. mutbl ) ,
2600
2601
}
2601
2602
}
2602
2603
2603
- fn lower_param_bounds ( & mut self , bounds : & [ GenericBound ] , mut itctx : ImplTraitContext )
2604
+ fn lower_param_bounds ( & mut self , bounds : & [ GenericBound ] , mut itctx : ImplTraitContext < ' _ > )
2604
2605
-> hir:: GenericBounds {
2605
2606
bounds. iter ( ) . map ( |bound| self . lower_param_bound ( bound, itctx. reborrow ( ) ) ) . collect ( )
2606
2607
}
0 commit comments