@@ -17,9 +17,9 @@ use rustc_middle::hir::nested_filter::OnlyBodies;
1717use rustc_middle:: mir:: tcx:: PlaceTy ;
1818use rustc_middle:: mir:: {
1919 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 ,
2323} ;
2424use rustc_middle:: ty:: {
2525 self , suggest_constraining_type_params, PredicateKind , ToPredicate , Ty , TyCtxt ,
@@ -1486,7 +1486,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14861486 let first_borrow_desc;
14871487 let mut err = match ( gen_borrow_kind, issued_borrow. kind ) {
14881488 (
1489- BorrowKind :: Shared ,
1489+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
14901490 BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
14911491 ) => {
14921492 first_borrow_desc = "mutable " ;
@@ -1504,7 +1504,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15041504 }
15051505 (
15061506 BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1507- BorrowKind :: Shared ,
1507+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
15081508 ) => {
15091509 first_borrow_desc = "immutable " ;
15101510 let mut err = self . cannot_reborrow_already_borrowed (
@@ -1566,7 +1566,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15661566 self . cannot_uniquely_borrow_by_two_closures ( span, & desc_place, issued_span, None )
15671567 }
15681568
1569- ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ) => {
1569+ ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ) => {
15701570 if let Some ( immutable_section_description) =
15711571 self . classify_immutable_section ( issued_borrow. assigned_place )
15721572 {
@@ -1629,7 +1629,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16291629 )
16301630 }
16311631
1632- ( BorrowKind :: Shared , BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ) => {
1632+ (
1633+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1634+ BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ,
1635+ ) => {
16331636 first_borrow_desc = "first " ;
16341637 self . cannot_reborrow_already_uniquely_borrowed (
16351638 span,
@@ -1659,8 +1662,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16591662 )
16601663 }
16611664
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+ ) => {
16641673 unreachable ! ( )
16651674 }
16661675 } ;
@@ -3572,7 +3581,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
35723581 let loan_span = loan_spans. args_or_use ( ) ;
35733582
35743583 let descr_place = self . describe_any_place ( place. as_ref ( ) ) ;
3575- if loan . kind == BorrowKind :: Fake {
3584+ if let BorrowKind :: Fake ( _ ) = loan . kind {
35763585 if let Some ( section) = self . classify_immutable_section ( loan. assigned_place ) {
35773586 let mut err = self . cannot_mutate_in_immutable_section (
35783587 span,
0 commit comments