@@ -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 ,
@@ -1486,7 +1486,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1486
1486
let first_borrow_desc;
1487
1487
let mut err = match ( gen_borrow_kind, issued_borrow. kind ) {
1488
1488
(
1489
- BorrowKind :: Shared ,
1489
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1490
1490
BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1491
1491
) => {
1492
1492
first_borrow_desc = "mutable " ;
@@ -1504,7 +1504,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1504
1504
}
1505
1505
(
1506
1506
BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1507
- BorrowKind :: Shared ,
1507
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1508
1508
) => {
1509
1509
first_borrow_desc = "immutable " ;
1510
1510
let mut err = self . cannot_reborrow_already_borrowed (
@@ -1566,7 +1566,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1566
1566
self . cannot_uniquely_borrow_by_two_closures ( span, & desc_place, issued_span, None )
1567
1567
}
1568
1568
1569
- ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ) => {
1569
+ ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ) => {
1570
1570
if let Some ( immutable_section_description) =
1571
1571
self . classify_immutable_section ( issued_borrow. assigned_place )
1572
1572
{
@@ -1629,7 +1629,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1629
1629
)
1630
1630
}
1631
1631
1632
- ( BorrowKind :: Shared , BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ) => {
1632
+ (
1633
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1634
+ BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ,
1635
+ ) => {
1633
1636
first_borrow_desc = "first " ;
1634
1637
self . cannot_reborrow_already_uniquely_borrowed (
1635
1638
span,
@@ -1659,8 +1662,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1659
1662
)
1660
1663
}
1661
1664
1662
- ( BorrowKind :: Shared , BorrowKind :: Shared | BorrowKind :: Fake )
1663
- | ( BorrowKind :: Fake , BorrowKind :: Mut { .. } | BorrowKind :: Shared | BorrowKind :: Fake ) => {
1665
+ (
1666
+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1667
+ BorrowKind :: Shared | BorrowKind :: Fake ( _) ,
1668
+ )
1669
+ | (
1670
+ BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ,
1671
+ BorrowKind :: Mut { .. } | BorrowKind :: Shared | BorrowKind :: Fake ( _) ,
1672
+ ) => {
1664
1673
unreachable ! ( )
1665
1674
}
1666
1675
} ;
@@ -3572,7 +3581,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
3572
3581
let loan_span = loan_spans. args_or_use ( ) ;
3573
3582
3574
3583
let descr_place = self . describe_any_place ( place. as_ref ( ) ) ;
3575
- if loan . kind == BorrowKind :: Fake {
3584
+ if let BorrowKind :: Fake ( _ ) = loan . kind {
3576
3585
if let Some ( section) = self . classify_immutable_section ( loan. assigned_place ) {
3577
3586
let mut err = self . cannot_mutate_in_immutable_section (
3578
3587
span,
0 commit comments