@@ -17,9 +17,9 @@ use rustc_middle::hir::nested_filter::OnlyBodies;
17
17
use rustc_middle:: mir:: tcx:: PlaceTy ;
18
18
use rustc_middle:: mir:: {
19
19
self , AggregateKind , BindingForm , BorrowKind , CallSource , ClearCrossCrate , ConstraintCategory ,
20
- FakeReadCause , LocalDecl , LocalInfo , LocalKind , Location , MutBorrowKind , Operand , Place ,
21
- PlaceRef , ProjectionElem , Rvalue , Statement , StatementKind , Terminator , TerminatorKind ,
22
- VarBindingForm ,
20
+ FakeBorrowKind , FakeReadCause , LocalDecl , LocalInfo , LocalKind , Location , MutBorrowKind ,
21
+ Operand , Place , PlaceRef , ProjectionElem , Rvalue , Statement , StatementKind , Terminator ,
22
+ TerminatorKind , VarBindingForm ,
23
23
} ;
24
24
use rustc_middle:: ty:: {
25
25
self , suggest_constraining_type_params, PredicateKind , ToPredicate , Ty , TyCtxt ,
@@ -1202,7 +1202,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1202
1202
let first_borrow_desc;
1203
1203
let mut err = match ( gen_borrow_kind, issued_borrow. kind ) {
1204
1204
(
1205
- BorrowKind :: Shared ,
1205
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1206
1206
BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1207
1207
) => {
1208
1208
first_borrow_desc = "mutable " ;
@@ -1220,7 +1220,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1220
1220
}
1221
1221
(
1222
1222
BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1223
- BorrowKind :: Shared ,
1223
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1224
1224
) => {
1225
1225
first_borrow_desc = "immutable " ;
1226
1226
let mut err = self . cannot_reborrow_already_borrowed (
@@ -1282,7 +1282,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1282
1282
self . cannot_uniquely_borrow_by_two_closures ( span, & desc_place, issued_span, None )
1283
1283
}
1284
1284
1285
- ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ) => {
1285
+ ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ) => {
1286
1286
if let Some ( immutable_section_description) =
1287
1287
self . classify_immutable_section ( issued_borrow. assigned_place )
1288
1288
{
@@ -1345,7 +1345,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1345
1345
)
1346
1346
}
1347
1347
1348
- ( BorrowKind :: Shared , BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ) => {
1348
+ (
1349
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1350
+ BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ,
1351
+ ) => {
1349
1352
first_borrow_desc = "first " ;
1350
1353
self . cannot_reborrow_already_uniquely_borrowed (
1351
1354
span,
@@ -1375,8 +1378,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1375
1378
)
1376
1379
}
1377
1380
1378
- ( BorrowKind :: Shared , BorrowKind :: Shared | BorrowKind :: Fake )
1379
- | ( BorrowKind :: Fake , BorrowKind :: Mut { .. } | BorrowKind :: Shared | BorrowKind :: Fake ) => {
1381
+ (
1382
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1383
+ BorrowKind :: Shared | BorrowKind :: Fake ( _) ,
1384
+ )
1385
+ | (
1386
+ BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ,
1387
+ BorrowKind :: Mut { .. } | BorrowKind :: Shared | BorrowKind :: Fake ( _) ,
1388
+ ) => {
1380
1389
unreachable ! ( )
1381
1390
}
1382
1391
} ;
@@ -3266,7 +3275,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
3266
3275
let loan_span = loan_spans. args_or_use ( ) ;
3267
3276
3268
3277
let descr_place = self . describe_any_place ( place. as_ref ( ) ) ;
3269
- if loan . kind == BorrowKind :: Fake {
3278
+ if let BorrowKind :: Fake ( _ ) = loan . kind {
3270
3279
if let Some ( section) = self . classify_immutable_section ( loan. assigned_place ) {
3271
3280
let mut err = self . cannot_mutate_in_immutable_section (
3272
3281
span,
0 commit comments