@@ -206,19 +206,25 @@ impl<'hir> LoweringContext<'_, 'hir> {
206
206
// `impl Future<Output = T>` here because lower_body
207
207
// only cares about the input argument patterns in the function
208
208
// declaration (decl), not the return types.
209
- let coro_kind = header. coro_kind ;
209
+ let coroutine_kind = header. coroutine_kind ;
210
210
let body_id = this. lower_maybe_coroutine_body (
211
211
span,
212
212
hir_id,
213
213
decl,
214
- coro_kind ,
214
+ coroutine_kind ,
215
215
body. as_deref ( ) ,
216
216
) ;
217
217
218
218
let itctx = ImplTraitContext :: Universal ;
219
219
let ( generics, decl) =
220
220
this. lower_generics ( generics, header. constness , id, & itctx, |this| {
221
- this. lower_fn_decl ( decl, id, * fn_sig_span, FnDeclKind :: Fn , coro_kind)
221
+ this. lower_fn_decl (
222
+ decl,
223
+ id,
224
+ * fn_sig_span,
225
+ FnDeclKind :: Fn ,
226
+ coroutine_kind,
227
+ )
222
228
} ) ;
223
229
let sig = hir:: FnSig {
224
230
decl,
@@ -734,7 +740,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
734
740
sig,
735
741
i. id ,
736
742
FnDeclKind :: Trait ,
737
- sig. header . coro_kind ,
743
+ sig. header . coroutine_kind ,
738
744
) ;
739
745
( generics, hir:: TraitItemKind :: Fn ( sig, hir:: TraitFn :: Required ( names) ) , false )
740
746
}
@@ -743,15 +749,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
743
749
i. span ,
744
750
hir_id,
745
751
& sig. decl ,
746
- sig. header . coro_kind ,
752
+ sig. header . coroutine_kind ,
747
753
Some ( body) ,
748
754
) ;
749
755
let ( generics, sig) = self . lower_method_sig (
750
756
generics,
751
757
sig,
752
758
i. id ,
753
759
FnDeclKind :: Trait ,
754
- sig. header . coro_kind ,
760
+ sig. header . coroutine_kind ,
755
761
) ;
756
762
( generics, hir:: TraitItemKind :: Fn ( sig, hir:: TraitFn :: Provided ( body_id) ) , true )
757
763
}
@@ -844,15 +850,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
844
850
i. span ,
845
851
hir_id,
846
852
& sig. decl ,
847
- sig. header . coro_kind ,
853
+ sig. header . coroutine_kind ,
848
854
body. as_deref ( ) ,
849
855
) ;
850
856
let ( generics, sig) = self . lower_method_sig (
851
857
generics,
852
858
sig,
853
859
i. id ,
854
860
if self . is_in_trait_impl { FnDeclKind :: Impl } else { FnDeclKind :: Inherent } ,
855
- sig. header . coro_kind ,
861
+ sig. header . coroutine_kind ,
856
862
) ;
857
863
858
864
( generics, hir:: ImplItemKind :: Fn ( sig, body_id) )
@@ -1023,13 +1029,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
1023
1029
span : Span ,
1024
1030
fn_id : hir:: HirId ,
1025
1031
decl : & FnDecl ,
1026
- coro_kind : Option < CoroutineKind > ,
1032
+ coroutine_kind : Option < CoroutineKind > ,
1027
1033
body : Option < & Block > ,
1028
1034
) -> hir:: BodyId {
1029
- let ( Some ( coro_kind ) , Some ( body) ) = ( coro_kind , body) else {
1035
+ let ( Some ( coroutine_kind ) , Some ( body) ) = ( coroutine_kind , body) else {
1030
1036
return self . lower_fn_body_block ( span, decl, body) ;
1031
1037
} ;
1032
- let closure_id = match coro_kind {
1038
+ let closure_id = match coroutine_kind {
1033
1039
CoroutineKind :: Async { closure_id, .. } | CoroutineKind :: Gen { closure_id, .. } => {
1034
1040
closure_id
1035
1041
}
@@ -1200,7 +1206,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1200
1206
1201
1207
this. expr_block ( body)
1202
1208
} ;
1203
- let coroutine_expr = match coro_kind {
1209
+ // FIXME(gen_blocks): Consider unifying the `make_*_expr` functions.
1210
+ let coroutine_expr = match coroutine_kind {
1204
1211
CoroutineKind :: Async { .. } => this. make_async_expr (
1205
1212
CaptureBy :: Value { move_kw : rustc_span:: DUMMY_SP } ,
1206
1213
closure_id,
@@ -1233,19 +1240,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
1233
1240
sig : & FnSig ,
1234
1241
id : NodeId ,
1235
1242
kind : FnDeclKind ,
1236
- coro_kind : Option < CoroutineKind > ,
1243
+ coroutine_kind : Option < CoroutineKind > ,
1237
1244
) -> ( & ' hir hir:: Generics < ' hir > , hir:: FnSig < ' hir > ) {
1238
1245
let header = self . lower_fn_header ( sig. header ) ;
1239
1246
let itctx = ImplTraitContext :: Universal ;
1240
1247
let ( generics, decl) =
1241
1248
self . lower_generics ( generics, sig. header . constness , id, & itctx, |this| {
1242
- this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coro_kind )
1249
+ this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coroutine_kind )
1243
1250
} ) ;
1244
1251
( generics, hir:: FnSig { header, decl, span : self . lower_span ( sig. span ) } )
1245
1252
}
1246
1253
1247
1254
fn lower_fn_header ( & mut self , h : FnHeader ) -> hir:: FnHeader {
1248
- let asyncness = if let Some ( CoroutineKind :: Async { span, .. } ) = h. coro_kind {
1255
+ let asyncness = if let Some ( CoroutineKind :: Async { span, .. } ) = h. coroutine_kind {
1249
1256
hir:: IsAsync :: Async ( span)
1250
1257
} else {
1251
1258
hir:: IsAsync :: NotAsync
0 commit comments