@@ -848,8 +848,8 @@ 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 ( _) => MoveUseInCoroutine { var_span } ,
852
- None => MoveUseInClosure { var_span } ,
851
+ hir :: ClosureKind :: Coroutine ( _ , _) => MoveUseInCoroutine { var_span } ,
852
+ hir :: ClosureKind :: Closure => MoveUseInClosure { var_span } ,
853
853
}
854
854
} ) ;
855
855
@@ -893,10 +893,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
893
893
let place = & borrow. borrowed_place ;
894
894
let desc_place = self . describe_any_place ( place. as_ref ( ) ) ;
895
895
match kind {
896
- Some ( _) => {
896
+ hir :: ClosureKind :: Coroutine ( _ , _) => {
897
897
BorrowUsePlaceCoroutine { place : desc_place, var_span, is_single_var : true }
898
898
}
899
- None => BorrowUsePlaceClosure { place : desc_place, var_span, is_single_var : true } ,
899
+ hir:: ClosureKind :: Closure => {
900
+ BorrowUsePlaceClosure { place : desc_place, var_span, is_single_var : true }
901
+ }
900
902
}
901
903
} ) ;
902
904
@@ -1040,12 +1042,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1040
1042
|kind, var_span| {
1041
1043
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1042
1044
match kind {
1043
- Some ( _) => BorrowUsePlaceCoroutine {
1045
+ hir :: ClosureKind :: Coroutine ( _ , _) => BorrowUsePlaceCoroutine {
1044
1046
place : desc_place,
1045
1047
var_span,
1046
1048
is_single_var : true ,
1047
1049
} ,
1048
- None => BorrowUsePlaceClosure {
1050
+ hir :: ClosureKind :: Closure => BorrowUsePlaceClosure {
1049
1051
place : desc_place,
1050
1052
var_span,
1051
1053
is_single_var : true ,
@@ -1124,12 +1126,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1124
1126
borrow_spans. var_subdiag ( None , & mut err, Some ( gen_borrow_kind) , |kind, var_span| {
1125
1127
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1126
1128
match kind {
1127
- Some ( _) => BorrowUsePlaceCoroutine {
1129
+ hir :: ClosureKind :: Coroutine ( _ , _) => BorrowUsePlaceCoroutine {
1128
1130
place : desc_place,
1129
1131
var_span,
1130
1132
is_single_var : false ,
1131
1133
} ,
1132
- None => {
1134
+ hir :: ClosureKind :: Closure => {
1133
1135
BorrowUsePlaceClosure { place : desc_place, var_span, is_single_var : false }
1134
1136
}
1135
1137
}
@@ -1144,10 +1146,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1144
1146
let borrow_place = & issued_borrow. borrowed_place ;
1145
1147
let borrow_place_desc = self . describe_any_place ( borrow_place. as_ref ( ) ) ;
1146
1148
match kind {
1147
- Some ( _) => {
1149
+ hir :: ClosureKind :: Coroutine ( _ , _) => {
1148
1150
FirstBorrowUsePlaceCoroutine { place : borrow_place_desc, var_span }
1149
1151
}
1150
- None => FirstBorrowUsePlaceClosure { place : borrow_place_desc, var_span } ,
1152
+ hir:: ClosureKind :: Closure => {
1153
+ FirstBorrowUsePlaceClosure { place : borrow_place_desc, var_span }
1154
+ }
1151
1155
}
1152
1156
} ,
1153
1157
) ;
@@ -1159,8 +1163,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1159
1163
|kind, var_span| {
1160
1164
use crate :: session_diagnostics:: CaptureVarCause :: * ;
1161
1165
match kind {
1162
- Some ( _) => SecondBorrowUsePlaceCoroutine { place : desc_place, var_span } ,
1163
- None => SecondBorrowUsePlaceClosure { place : desc_place, var_span } ,
1166
+ hir:: ClosureKind :: Coroutine ( _, _) => {
1167
+ SecondBorrowUsePlaceCoroutine { place : desc_place, var_span }
1168
+ }
1169
+ hir:: ClosureKind :: Closure => {
1170
+ SecondBorrowUsePlaceClosure { place : desc_place, var_span }
1171
+ }
1164
1172
}
1165
1173
} ,
1166
1174
) ;
@@ -1338,7 +1346,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1338
1346
// mut iter => {
1339
1347
// [opt_ident]: loop {
1340
1348
// match Iterator::next(&mut iter) {
1341
- // None => break,
1349
+ // hir::ClosureKind::Closure => break,
1342
1350
// Some(<pat>) => <body>,
1343
1351
// };
1344
1352
// }
@@ -1651,7 +1659,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1651
1659
fn visit_expr ( & mut self , e : & ' hir hir:: Expr < ' hir > ) {
1652
1660
if e. span . contains ( self . capture_span ) {
1653
1661
if let hir:: ExprKind :: Closure ( & hir:: Closure {
1654
- movability : None ,
1662
+ kind : hir :: ClosureKind :: Closure ,
1655
1663
body,
1656
1664
fn_arg_span,
1657
1665
fn_decl : hir:: FnDecl { inputs, .. } ,
@@ -1686,7 +1694,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1686
1694
&& let Some ( init) = local. init
1687
1695
{
1688
1696
if let hir:: Expr {
1689
- kind : hir:: ExprKind :: Closure ( & hir:: Closure { movability : None , .. } ) ,
1697
+ kind :
1698
+ hir:: ExprKind :: Closure ( & hir:: Closure {
1699
+ kind : hir:: ClosureKind :: Closure ,
1700
+ ..
1701
+ } ) ,
1690
1702
..
1691
1703
} = init
1692
1704
&& init. span . contains ( self . capture_span )
@@ -2838,8 +2850,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2838
2850
loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
2839
2851
use crate :: session_diagnostics:: CaptureVarCause :: * ;
2840
2852
match kind {
2841
- Some ( _) => BorrowUseInCoroutine { var_span } ,
2842
- None => BorrowUseInClosure { var_span } ,
2853
+ hir :: ClosureKind :: Coroutine ( _ , _) => BorrowUseInCoroutine { var_span } ,
2854
+ hir :: ClosureKind :: Closure => BorrowUseInClosure { var_span } ,
2843
2855
}
2844
2856
} ) ;
2845
2857
@@ -2854,8 +2866,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2854
2866
loan_spans. var_subdiag ( None , & mut err, Some ( loan. kind ) , |kind, var_span| {
2855
2867
use crate :: session_diagnostics:: CaptureVarCause :: * ;
2856
2868
match kind {
2857
- Some ( _) => BorrowUseInCoroutine { var_span } ,
2858
- None => BorrowUseInClosure { var_span } ,
2869
+ hir :: ClosureKind :: Coroutine ( _ , _) => BorrowUseInCoroutine { var_span } ,
2870
+ hir :: ClosureKind :: Closure => BorrowUseInClosure { var_span } ,
2859
2871
}
2860
2872
} ) ;
2861
2873
0 commit comments