@@ -583,7 +583,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
583583 }
584584 }
585585
586- /// Lower an `async` construct to a generator that implements `Future`.
586+ /// Lower an `async` construct to a coroutine that implements `Future`.
587587 ///
588588 /// This results in:
589589 ///
@@ -613,7 +613,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
613613 span : unstable_span,
614614 } ;
615615
616- // The closure/generator `FnDecl` takes a single (resume) argument of type `input_ty`.
616+ // The closure/coroutine `FnDecl` takes a single (resume) argument of type `input_ty`.
617617 let fn_decl = self . arena . alloc ( hir:: FnDecl {
618618 inputs : arena_vec ! [ self ; input_ty] ,
619619 output,
@@ -637,7 +637,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
637637 let params = arena_vec ! [ self ; param] ;
638638
639639 let body = self . lower_body ( move |this| {
640- this. generator_kind = Some ( hir:: CoroutineKind :: Async ( async_gen_kind) ) ;
640+ this. coroutine_kind = Some ( hir:: CoroutineKind :: Async ( async_gen_kind) ) ;
641641
642642 let old_ctx = this. task_context ;
643643 this. task_context = Some ( task_context_hid) ;
@@ -710,7 +710,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
710710 /// ```
711711 fn lower_expr_await ( & mut self , await_kw_span : Span , expr : & Expr ) -> hir:: ExprKind < ' hir > {
712712 let full_span = expr. span . to ( await_kw_span) ;
713- match self . generator_kind {
713+ match self . coroutine_kind {
714714 Some ( hir:: CoroutineKind :: Async ( _) ) => { }
715715 Some ( hir:: CoroutineKind :: Gen ) | None => {
716716 self . tcx . sess . emit_err ( AwaitOnlyInAsyncFnAndBlocks {
@@ -887,19 +887,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
887887 ) -> hir:: ExprKind < ' hir > {
888888 let ( binder_clause, generic_params) = self . lower_closure_binder ( binder) ;
889889
890- let ( body_id, generator_option ) = self . with_new_scopes ( move |this| {
890+ let ( body_id, coroutine_option ) = self . with_new_scopes ( move |this| {
891891 let prev = this. current_item ;
892892 this. current_item = Some ( fn_decl_span) ;
893- let mut generator_kind = None ;
893+ let mut coroutine_kind = None ;
894894 let body_id = this. lower_fn_body ( decl, |this| {
895895 let e = this. lower_expr_mut ( body) ;
896- generator_kind = this. generator_kind ;
896+ coroutine_kind = this. coroutine_kind ;
897897 e
898898 } ) ;
899- let generator_option =
900- this. generator_movability_for_fn ( & decl, fn_decl_span, generator_kind , movability) ;
899+ let coroutine_option =
900+ this. coroutine_movability_for_fn ( & decl, fn_decl_span, coroutine_kind , movability) ;
901901 this. current_item = prev;
902- ( body_id, generator_option )
902+ ( body_id, coroutine_option )
903903 } ) ;
904904
905905 let bound_generic_params = self . lower_lifetime_binder ( closure_id, generic_params) ;
@@ -915,21 +915,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
915915 body : body_id,
916916 fn_decl_span : self . lower_span ( fn_decl_span) ,
917917 fn_arg_span : Some ( self . lower_span ( fn_arg_span) ) ,
918- movability : generator_option ,
918+ movability : coroutine_option ,
919919 constness : self . lower_constness ( constness) ,
920920 } ) ;
921921
922922 hir:: ExprKind :: Closure ( c)
923923 }
924924
925- fn generator_movability_for_fn (
925+ fn coroutine_movability_for_fn (
926926 & mut self ,
927927 decl : & FnDecl ,
928928 fn_decl_span : Span ,
929- generator_kind : Option < hir:: CoroutineKind > ,
929+ coroutine_kind : Option < hir:: CoroutineKind > ,
930930 movability : Movability ,
931931 ) -> Option < hir:: Movability > {
932- match generator_kind {
932+ match coroutine_kind {
933933 Some ( hir:: CoroutineKind :: Gen ) => {
934934 if decl. inputs . len ( ) > 1 {
935935 self . tcx . sess . emit_err ( CoroutineTooManyParameters { fn_decl_span } ) ;
@@ -1444,12 +1444,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
14441444 }
14451445
14461446 fn lower_expr_yield ( & mut self , span : Span , opt_expr : Option < & Expr > ) -> hir:: ExprKind < ' hir > {
1447- match self . generator_kind {
1447+ match self . coroutine_kind {
14481448 Some ( hir:: CoroutineKind :: Gen ) => { }
14491449 Some ( hir:: CoroutineKind :: Async ( _) ) => {
14501450 self . tcx . sess . emit_err ( AsyncCoroutinesNotSupported { span } ) ;
14511451 }
1452- None => self . generator_kind = Some ( hir:: CoroutineKind :: Gen ) ,
1452+ None => self . coroutine_kind = Some ( hir:: CoroutineKind :: Gen ) ,
14531453 }
14541454
14551455 let expr =
0 commit comments