@@ -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 ,
@@ -1202,7 +1202,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12021202 let first_borrow_desc;
12031203 let mut err = match ( gen_borrow_kind, issued_borrow. kind ) {
12041204 (
1205- BorrowKind :: Shared ,
1205+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
12061206 BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
12071207 ) => {
12081208 first_borrow_desc = "mutable " ;
@@ -1220,7 +1220,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12201220 }
12211221 (
12221222 BorrowKind :: Mut { kind : MutBorrowKind :: Default | MutBorrowKind :: TwoPhaseBorrow } ,
1223- BorrowKind :: Shared ,
1223+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
12241224 ) => {
12251225 first_borrow_desc = "immutable " ;
12261226 let mut err = self . cannot_reborrow_already_borrowed (
@@ -1282,7 +1282,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12821282 self . cannot_uniquely_borrow_by_two_closures ( span, & desc_place, issued_span, None )
12831283 }
12841284
1285- ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ) => {
1285+ ( BorrowKind :: Mut { .. } , BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ) => {
12861286 if let Some ( immutable_section_description) =
12871287 self . classify_immutable_section ( issued_borrow. assigned_place )
12881288 {
@@ -1345,7 +1345,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13451345 )
13461346 }
13471347
1348- ( BorrowKind :: Shared , BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ) => {
1348+ (
1349+ BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) ,
1350+ BorrowKind :: Mut { kind : MutBorrowKind :: ClosureCapture } ,
1351+ ) => {
13491352 first_borrow_desc = "first " ;
13501353 self . cannot_reborrow_already_uniquely_borrowed (
13511354 span,
@@ -1375,8 +1378,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13751378 )
13761379 }
13771380
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+ ) => {
13801389 unreachable ! ( )
13811390 }
13821391 } ;
@@ -3266,7 +3275,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
32663275 let loan_span = loan_spans. args_or_use ( ) ;
32673276
32683277 let descr_place = self . describe_any_place ( place. as_ref ( ) ) ;
3269- if loan . kind == BorrowKind :: Fake {
3278+ if let BorrowKind :: Fake ( _ ) = loan . kind {
32703279 if let Some ( section) = self . classify_immutable_section ( loan. assigned_place ) {
32713280 let mut err = self . cannot_mutate_in_immutable_section (
32723281 span,
0 commit comments