@@ -8,7 +8,7 @@ use rustc_errors::{
8
8
use rustc_hir as hir;
9
9
use rustc_hir:: def:: { DefKind , Res } ;
10
10
use rustc_hir:: intravisit:: { walk_block, walk_expr, Visitor } ;
11
- use rustc_hir:: { AsyncGeneratorKind , GeneratorKind , LangItem } ;
11
+ use rustc_hir:: { AsyncCoroutineKind , CoroutineKind , LangItem } ;
12
12
use rustc_infer:: traits:: ObligationCause ;
13
13
use rustc_middle:: hir:: nested_filter:: OnlyBodies ;
14
14
use rustc_middle:: mir:: tcx:: PlaceTy ;
@@ -848,7 +848,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
848
848
move_spans. var_subdiag ( None , & mut err, None , |kind, var_span| {
849
849
use crate :: session_diagnostics:: CaptureVarCause :: * ;
850
850
match kind {
851
- Some ( _) => MoveUseInGenerator { var_span } ,
851
+ Some ( _) => MoveUseInCoroutine { var_span } ,
852
852
None => MoveUseInClosure { var_span } ,
853
853
}
854
854
} ) ;
@@ -894,7 +894,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
894
894
let desc_place = self . describe_any_place ( place. as_ref ( ) ) ;
895
895
match kind {
896
896
Some ( _) => {
897
- BorrowUsePlaceGenerator { place : desc_place, var_span, is_single_var : true }
897
+ BorrowUsePlaceCoroutine { place : desc_place, var_span, is_single_var : true }
898
898
}
899
899
None => BorrowUsePlaceClosure { place : desc_place, var_span, is_single_var : true } ,
900
900
}
@@ -1040,7 +1040,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1040
1040
|kind, var_span| {
1041
1041
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1042
1042
match kind {
1043
- Some ( _) => BorrowUsePlaceGenerator {
1043
+ Some ( _) => BorrowUsePlaceCoroutine {
1044
1044
place : desc_place,
1045
1045
var_span,
1046
1046
is_single_var : true ,
@@ -1125,7 +1125,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1125
1125
borrow_spans. var_subdiag ( None , & mut err, Some ( gen_borrow_kind) , |kind, var_span| {
1126
1126
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1127
1127
match kind {
1128
- Some ( _) => BorrowUsePlaceGenerator {
1128
+ Some ( _) => BorrowUsePlaceCoroutine {
1129
1129
place : desc_place,
1130
1130
var_span,
1131
1131
is_single_var : false ,
@@ -1146,7 +1146,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1146
1146
let borrow_place_desc = self . describe_any_place ( borrow_place. as_ref ( ) ) ;
1147
1147
match kind {
1148
1148
Some ( _) => {
1149
- FirstBorrowUsePlaceGenerator { place : borrow_place_desc, var_span }
1149
+ FirstBorrowUsePlaceCoroutine { place : borrow_place_desc, var_span }
1150
1150
}
1151
1151
None => FirstBorrowUsePlaceClosure { place : borrow_place_desc, var_span } ,
1152
1152
}
@@ -1160,7 +1160,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1160
1160
|kind, var_span| {
1161
1161
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1162
1162
match kind {
1163
- Some ( _) => SecondBorrowUsePlaceGenerator { place : desc_place, var_span } ,
1163
+ Some ( _) => SecondBorrowUsePlaceCoroutine { place : desc_place, var_span } ,
1164
1164
None => SecondBorrowUsePlaceClosure { place : desc_place, var_span } ,
1165
1165
}
1166
1166
} ,
@@ -2077,7 +2077,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2077
2077
. unwrap_or_else( || {
2078
2078
match & self . infcx. tcx. def_kind( self . mir_def_id( ) ) {
2079
2079
DefKind :: Closure => "enclosing closure" ,
2080
- DefKind :: Generator => "enclosing generator" ,
2080
+ DefKind :: Coroutine => "enclosing generator" ,
2081
2081
kind => bug!( "expected closure or generator, found {:?}" , kind) ,
2082
2082
}
2083
2083
. to_string( )
@@ -2483,12 +2483,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2483
2483
} ;
2484
2484
let kind = match use_span. generator_kind ( ) {
2485
2485
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" ,
2489
2489
_ => bug ! ( "async block/closure expected, but async function found." ) ,
2490
2490
} ,
2491
- GeneratorKind :: Gen => "generator" ,
2491
+ CoroutineKind :: Gen => "generator" ,
2492
2492
} ,
2493
2493
None => "closure" ,
2494
2494
} ;
@@ -2517,7 +2517,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2517
2517
}
2518
2518
ConstraintCategory :: CallArgument ( _) => {
2519
2519
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 ( _) ) ) {
2521
2521
err. note (
2522
2522
"async blocks are not executed immediately and must either take a \
2523
2523
reference or ownership of outside variables they use",
@@ -2785,7 +2785,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2785
2785
loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
2786
2786
use crate :: session_diagnostics:: CaptureVarCause :: * ;
2787
2787
match kind {
2788
- Some ( _) => BorrowUseInGenerator { var_span } ,
2788
+ Some ( _) => BorrowUseInCoroutine { var_span } ,
2789
2789
None => BorrowUseInClosure { var_span } ,
2790
2790
}
2791
2791
} ) ;
@@ -2801,7 +2801,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2801
2801
loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
2802
2802
use crate :: session_diagnostics:: CaptureVarCause :: * ;
2803
2803
match kind {
2804
- Some ( _) => BorrowUseInGenerator { var_span } ,
2804
+ Some ( _) => BorrowUseInCoroutine { var_span } ,
2805
2805
None => BorrowUseInClosure { var_span } ,
2806
2806
}
2807
2807
} ) ;
0 commit comments