@@ -66,7 +66,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
66
66
seg,
67
67
ParamMode :: Optional ,
68
68
ParenthesizedGenericArgs :: Err ,
69
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
69
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
70
70
) ) ;
71
71
let receiver = self . lower_expr ( receiver) ;
72
72
let args =
@@ -89,14 +89,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
89
89
}
90
90
ExprKind :: Cast ( ref expr, ref ty) => {
91
91
let expr = self . lower_expr ( expr) ;
92
- let ty = self
93
- . lower_ty ( ty, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
92
+ let ty =
93
+ self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
94
94
hir:: ExprKind :: Cast ( expr, ty)
95
95
}
96
96
ExprKind :: Type ( ref expr, ref ty) => {
97
97
let expr = self . lower_expr ( expr) ;
98
- let ty = self
99
- . lower_ty ( ty, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
98
+ let ty =
99
+ self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
100
100
hir:: ExprKind :: Type ( expr, ty)
101
101
}
102
102
ExprKind :: AddrOf ( k, m, ref ohs) => {
@@ -225,7 +225,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
225
225
qself,
226
226
path,
227
227
ParamMode :: Optional ,
228
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
228
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
229
229
) ;
230
230
hir:: ExprKind :: Path ( qpath)
231
231
}
@@ -259,7 +259,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
259
259
& se. qself ,
260
260
& se. path ,
261
261
ParamMode :: Optional ,
262
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
262
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
263
263
) ) ,
264
264
self . arena
265
265
. alloc_from_iter ( se. fields . iter ( ) . map ( |x| self . lower_expr_field ( x) ) ) ,
@@ -556,14 +556,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
556
556
async_gen_kind : hir:: AsyncGeneratorKind ,
557
557
body : impl FnOnce ( & mut Self ) -> hir:: Expr < ' hir > ,
558
558
) -> hir:: ExprKind < ' hir > {
559
- let output =
560
- match ret_ty {
561
- Some ( ty) => hir:: FnRetTy :: Return ( self . lower_ty (
562
- & ty,
563
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: AsyncBlock ) ,
564
- ) ) ,
565
- None => hir:: FnRetTy :: DefaultReturn ( self . lower_span ( span) ) ,
566
- } ;
559
+ let output = match ret_ty {
560
+ Some ( ty) => hir:: FnRetTy :: Return (
561
+ self . lower_ty ( & ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: AsyncBlock ) ) ,
562
+ ) ,
563
+ None => hir:: FnRetTy :: DefaultReturn ( self . lower_span ( span) ) ,
564
+ } ;
567
565
568
566
// Resume argument type. We let the compiler infer this to simplify the lowering. It is
569
567
// fully constrained by `future::from_generator`.
@@ -855,22 +853,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
855
853
( body_id, generator_option)
856
854
} ) ;
857
855
858
- self . lower_lifetime_binder ( closure_id, generic_params, |lctx , bound_generic_params| {
859
- // Lower outside new scope to preserve `is_in_loop_condition`.
860
- let fn_decl = lctx . lower_fn_decl ( decl, None , fn_decl_span, FnDeclKind :: Closure , None ) ;
861
-
862
- let c = lctx . arena . alloc ( hir:: Closure {
863
- binder : binder_clause,
864
- capture_clause,
865
- bound_generic_params,
866
- fn_decl,
867
- body : body_id,
868
- fn_decl_span : lctx . lower_span ( fn_decl_span) ,
869
- movability : generator_option,
870
- } ) ;
856
+ let bound_generic_params = self . lower_lifetime_binder ( closure_id, generic_params) ;
857
+ // Lower outside new scope to preserve `is_in_loop_condition`.
858
+ let fn_decl = self . lower_fn_decl ( decl, None , fn_decl_span, FnDeclKind :: Closure , None ) ;
859
+
860
+ let c = self . arena . alloc ( hir:: Closure {
861
+ binder : binder_clause,
862
+ capture_clause,
863
+ bound_generic_params,
864
+ fn_decl,
865
+ body : body_id,
866
+ fn_decl_span : self . lower_span ( fn_decl_span) ,
867
+ movability : generator_option,
868
+ } ) ;
871
869
872
- hir:: ExprKind :: Closure ( c)
873
- } )
870
+ hir:: ExprKind :: Closure ( c)
874
871
}
875
872
876
873
fn generator_movability_for_fn (
@@ -957,24 +954,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
957
954
body_id
958
955
} ) ;
959
956
960
- self . lower_lifetime_binder ( closure_id, generic_params, |lctx, bound_generic_params| {
961
- // We need to lower the declaration outside the new scope, because we
962
- // have to conserve the state of being inside a loop condition for the
963
- // closure argument types.
964
- let fn_decl =
965
- lctx. lower_fn_decl ( & outer_decl, None , fn_decl_span, FnDeclKind :: Closure , None ) ;
966
-
967
- let c = lctx. arena . alloc ( hir:: Closure {
968
- binder : binder_clause,
969
- capture_clause,
970
- bound_generic_params,
971
- fn_decl,
972
- body,
973
- fn_decl_span : lctx. lower_span ( fn_decl_span) ,
974
- movability : None ,
975
- } ) ;
976
- hir:: ExprKind :: Closure ( c)
977
- } )
957
+ let bound_generic_params = self . lower_lifetime_binder ( closure_id, generic_params) ;
958
+ // We need to lower the declaration outside the new scope, because we
959
+ // have to conserve the state of being inside a loop condition for the
960
+ // closure argument types.
961
+ let fn_decl =
962
+ self . lower_fn_decl ( & outer_decl, None , fn_decl_span, FnDeclKind :: Closure , None ) ;
963
+
964
+ let c = self . arena . alloc ( hir:: Closure {
965
+ binder : binder_clause,
966
+ capture_clause,
967
+ bound_generic_params,
968
+ fn_decl,
969
+ body,
970
+ fn_decl_span : self . lower_span ( fn_decl_span) ,
971
+ movability : None ,
972
+ } ) ;
973
+ hir:: ExprKind :: Closure ( c)
978
974
}
979
975
980
976
/// Destructure the LHS of complex assignments.
@@ -1133,7 +1129,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1133
1129
qself,
1134
1130
path,
1135
1131
ParamMode :: Optional ,
1136
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1132
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1137
1133
) ;
1138
1134
// Destructure like a tuple struct.
1139
1135
let tuple_struct_pat = hir:: PatKind :: TupleStruct (
@@ -1152,7 +1148,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1152
1148
qself,
1153
1149
path,
1154
1150
ParamMode :: Optional ,
1155
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1151
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1156
1152
) ;
1157
1153
// Destructure like a unit struct.
1158
1154
let unit_struct_pat = hir:: PatKind :: Path ( qpath) ;
@@ -1176,7 +1172,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1176
1172
& se. qself ,
1177
1173
& se. path ,
1178
1174
ParamMode :: Optional ,
1179
- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1175
+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
1180
1176
) ;
1181
1177
let fields_omitted = match & se. rest {
1182
1178
StructRest :: Base ( e) => {
0 commit comments