@@ -8,7 +8,7 @@ use rustc_errors::{
88use rustc_hir as hir;
99use rustc_hir:: def:: { DefKind , Res } ;
1010use rustc_hir:: intravisit:: { walk_block, walk_expr, Visitor } ;
11- use rustc_hir:: { AsyncGeneratorKind , GeneratorKind , LangItem } ;
11+ use rustc_hir:: { AsyncCoroutineKind , CoroutineKind , LangItem } ;
1212use rustc_infer:: traits:: ObligationCause ;
1313use rustc_middle:: hir:: nested_filter:: OnlyBodies ;
1414use rustc_middle:: mir:: tcx:: PlaceTy ;
@@ -848,7 +848,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
848848 move_spans. var_subdiag ( None , & mut err, None , |kind, var_span| {
849849 use crate :: session_diagnostics:: CaptureVarCause :: * ;
850850 match kind {
851- Some ( _) => MoveUseInGenerator { var_span } ,
851+ Some ( _) => MoveUseInCoroutine { var_span } ,
852852 None => MoveUseInClosure { var_span } ,
853853 }
854854 } ) ;
@@ -894,7 +894,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
894894 let desc_place = self . describe_any_place ( place. as_ref ( ) ) ;
895895 match kind {
896896 Some ( _) => {
897- BorrowUsePlaceGenerator { place : desc_place, var_span, is_single_var : true }
897+ BorrowUsePlaceCoroutine { place : desc_place, var_span, is_single_var : true }
898898 }
899899 None => BorrowUsePlaceClosure { place : desc_place, var_span, is_single_var : true } ,
900900 }
@@ -1040,7 +1040,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10401040 |kind, var_span| {
10411041 use crate :: session_diagnostics:: CaptureVarCause :: * ;
10421042 match kind {
1043- Some ( _) => BorrowUsePlaceGenerator {
1043+ Some ( _) => BorrowUsePlaceCoroutine {
10441044 place : desc_place,
10451045 var_span,
10461046 is_single_var : true ,
@@ -1125,7 +1125,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11251125 borrow_spans. var_subdiag ( None , & mut err, Some ( gen_borrow_kind) , |kind, var_span| {
11261126 use crate :: session_diagnostics:: CaptureVarCause :: * ;
11271127 match kind {
1128- Some ( _) => BorrowUsePlaceGenerator {
1128+ Some ( _) => BorrowUsePlaceCoroutine {
11291129 place : desc_place,
11301130 var_span,
11311131 is_single_var : false ,
@@ -1146,7 +1146,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11461146 let borrow_place_desc = self . describe_any_place ( borrow_place. as_ref ( ) ) ;
11471147 match kind {
11481148 Some ( _) => {
1149- FirstBorrowUsePlaceGenerator { place : borrow_place_desc, var_span }
1149+ FirstBorrowUsePlaceCoroutine { place : borrow_place_desc, var_span }
11501150 }
11511151 None => FirstBorrowUsePlaceClosure { place : borrow_place_desc, var_span } ,
11521152 }
@@ -1160,7 +1160,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11601160 |kind, var_span| {
11611161 use crate :: session_diagnostics:: CaptureVarCause :: * ;
11621162 match kind {
1163- Some ( _) => SecondBorrowUsePlaceGenerator { place : desc_place, var_span } ,
1163+ Some ( _) => SecondBorrowUsePlaceCoroutine { place : desc_place, var_span } ,
11641164 None => SecondBorrowUsePlaceClosure { place : desc_place, var_span } ,
11651165 }
11661166 } ,
@@ -2077,7 +2077,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20772077 . unwrap_or_else( || {
20782078 match & self . infcx. tcx. def_kind( self . mir_def_id( ) ) {
20792079 DefKind :: Closure => "enclosing closure" ,
2080- DefKind :: Generator => "enclosing generator" ,
2080+ DefKind :: Coroutine => "enclosing generator" ,
20812081 kind => bug!( "expected closure or generator, found {:?}" , kind) ,
20822082 }
20832083 . to_string( )
@@ -2483,12 +2483,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24832483 } ;
24842484 let kind = match use_span. generator_kind ( ) {
24852485 Some ( generator_kind) => match generator_kind {
2486- GeneratorKind :: Async ( async_kind) => match async_kind {
2487- AsyncGeneratorKind :: Block => "async block" ,
2488- AsyncGeneratorKind :: Closure => "async closure" ,
2486+ CoroutineKind :: Async ( async_kind) => match async_kind {
2487+ AsyncCoroutineKind :: Block => "async block" ,
2488+ AsyncCoroutineKind :: Closure => "async closure" ,
24892489 _ => bug ! ( "async block/closure expected, but async function found." ) ,
24902490 } ,
2491- GeneratorKind :: Gen => "generator" ,
2491+ CoroutineKind :: Gen => "generator" ,
24922492 } ,
24932493 None => "closure" ,
24942494 } ;
@@ -2517,7 +2517,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
25172517 }
25182518 ConstraintCategory :: CallArgument ( _) => {
25192519 fr_name. highlight_region_name ( & mut err) ;
2520- if matches ! ( use_span. generator_kind( ) , Some ( GeneratorKind :: Async ( _) ) ) {
2520+ if matches ! ( use_span. generator_kind( ) , Some ( CoroutineKind :: Async ( _) ) ) {
25212521 err. note (
25222522 "async blocks are not executed immediately and must either take a \
25232523 reference or ownership of outside variables they use",
@@ -2785,7 +2785,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27852785 loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
27862786 use crate :: session_diagnostics:: CaptureVarCause :: * ;
27872787 match kind {
2788- Some ( _) => BorrowUseInGenerator { var_span } ,
2788+ Some ( _) => BorrowUseInCoroutine { var_span } ,
27892789 None => BorrowUseInClosure { var_span } ,
27902790 }
27912791 } ) ;
@@ -2801,7 +2801,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
28012801 loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
28022802 use crate :: session_diagnostics:: CaptureVarCause :: * ;
28032803 match kind {
2804- Some ( _) => BorrowUseInGenerator { var_span } ,
2804+ Some ( _) => BorrowUseInCoroutine { var_span } ,
28052805 None => BorrowUseInClosure { var_span } ,
28062806 }
28072807 } ) ;
0 commit comments