@@ -1328,16 +1328,20 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
13281328
13291329 (
13301330 Read ( _) ,
1331- BorrowKind :: Shared | BorrowKind :: Fake ( _) | BorrowKind :: Pinned ( Mutability :: Not ) ,
1331+ BorrowKind :: Shared
1332+ | BorrowKind :: Fake ( _)
1333+ | BorrowKind :: Pinned ( Mutability :: Not , _) ,
13321334 )
13331335 | (
13341336 Read ( ReadKind :: Borrow ( BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) ) ) ,
1335- BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut ) ,
1337+ BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut , _ ) ,
13361338 ) => ControlFlow :: Continue ( ( ) ) ,
13371339
13381340 (
13391341 Reservation ( _) ,
1340- BorrowKind :: Fake ( _) | BorrowKind :: Shared | BorrowKind :: Pinned ( Mutability :: Not ) ,
1342+ BorrowKind :: Fake ( _)
1343+ | BorrowKind :: Shared
1344+ | BorrowKind :: Pinned ( Mutability :: Not , _) ,
13411345 ) => {
13421346 // This used to be a future compatibility warning (to be
13431347 // disallowed on NLL). See rust-lang/rust#56254
@@ -1350,13 +1354,13 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
13501354 }
13511355
13521356 // Ignore the expired borrow (pinnedness never conflicts with a read)
1353- ( Read ( _) , BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut ) )
1357+ ( Read ( _) , BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut , _ ) )
13541358 if !borrows_in_scope. contains ( borrow_index) =>
13551359 {
13561360 ControlFlow :: Continue ( ( ) )
13571361 }
13581362
1359- ( Read ( kind) , BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut ) ) => {
1363+ ( Read ( kind) , BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut , _ ) ) => {
13601364 // Reading from mere reservations of mutable-borrows is OK.
13611365 if !is_active ( this. dominators ( ) , borrow, location) {
13621366 assert ! ( borrow. kind. is_two_phase_borrow( ) ) ;
@@ -1393,7 +1397,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
13931397 ControlFlow :: Continue ( ( ) )
13941398 }
13951399 // Mutable (pinned) borrow doesn't conflict with an expired borrow
1396- WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Mut ) ) => {
1400+ WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Mut , _ ) ) => {
13971401 ControlFlow :: Continue ( ( ) )
13981402 }
13991403 // Mutable (but non-pinned) borrow conflicts with an earlier pinned borrow
@@ -1550,12 +1554,16 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
15501554 BorrowKind :: Fake ( FakeBorrowKind :: Shallow ) => {
15511555 ( Shallow ( Some ( ArtificialField :: FakeBorrow ) ) , Read ( ReadKind :: Borrow ( bk) ) )
15521556 }
1553- BorrowKind :: Pinned ( Mutability :: Not ) => {
1554- ( Shallow ( None ) , Read ( ReadKind :: Borrow ( BorrowKind :: Pinned ( Mutability :: Not ) ) ) )
1555- }
1556- BorrowKind :: Pinned ( Mutability :: Mut ) => (
1557+ BorrowKind :: Pinned ( Mutability :: Not , pin_kind) => (
1558+ Shallow ( None ) ,
1559+ Read ( ReadKind :: Borrow ( BorrowKind :: Pinned ( Mutability :: Not , pin_kind) ) ) ,
1560+ ) ,
1561+ BorrowKind :: Pinned ( Mutability :: Mut , pin_kind) => (
15571562 Shallow ( None ) ,
1558- Write ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Mut ) ) ) ,
1563+ Write ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned (
1564+ Mutability :: Mut ,
1565+ pin_kind,
1566+ ) ) ) ,
15591567 ) ,
15601568 BorrowKind :: Shared | BorrowKind :: Fake ( FakeBorrowKind :: Deep ) => {
15611569 ( Deep , Read ( ReadKind :: Borrow ( bk) ) )
@@ -1922,9 +1930,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
19221930
19231931 // only mutable borrows should be 2-phase
19241932 assert ! ( match borrow. kind {
1925- BorrowKind :: Shared | BorrowKind :: Fake ( _) | BorrowKind :: Pinned ( Mutability :: Not ) =>
1926- false ,
1927- BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut ) => true ,
1933+ BorrowKind :: Shared
1934+ | BorrowKind :: Fake ( _)
1935+ | BorrowKind :: Pinned ( Mutability :: Not , _) => false ,
1936+ BorrowKind :: Mut { .. } | BorrowKind :: Pinned ( Mutability :: Mut , _) => true ,
19281937 } ) ;
19291938
19301939 self . access_place (
@@ -2501,7 +2510,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
25012510 | WriteKind :: StorageDeadOrDrop
25022511 | WriteKind :: MutableBorrow ( BorrowKind :: Shared )
25032512 | WriteKind :: MutableBorrow ( BorrowKind :: Fake ( _) )
2504- | WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Mut ) ) ,
2513+ | WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Mut , _ ) ) ,
25052514 ) => {
25062515 if self . is_mutable ( place. as_ref ( ) , is_local_mutation_allowed) . is_err ( )
25072516 && !self . has_buffered_diags ( )
@@ -2529,18 +2538,18 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
25292538 BorrowKind :: Mut { .. }
25302539 | BorrowKind :: Shared
25312540 | BorrowKind :: Fake ( _)
2532- | BorrowKind :: Pinned ( Mutability :: Not ) ,
2541+ | BorrowKind :: Pinned ( Mutability :: Not , _ ) ,
25332542 )
25342543 | ReadKind :: Copy ,
25352544 ) => {
25362545 // Access authorized
25372546 return false ;
25382547 }
2539- Reservation ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( _ ) ) ) => {
2548+ Reservation ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( .. ) ) ) => {
25402549 span_bug ! ( span, "invalid reservation with a pinned borrow kind: {:?}" , kind) ;
25412550 }
2542- Write ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Not ) ) )
2543- | Read ( ReadKind :: Borrow ( BorrowKind :: Pinned ( Mutability :: Mut ) ) ) => {
2551+ Write ( WriteKind :: MutableBorrow ( BorrowKind :: Pinned ( Mutability :: Not , _ ) ) )
2552+ | Read ( ReadKind :: Borrow ( BorrowKind :: Pinned ( Mutability :: Mut , _ ) ) ) => {
25442553 span_bug ! (
25452554 span,
25462555 "invalid read with a pinned mutable borrow kind or write with an immutable pinned borrow kind: {:?}" ,
0 commit comments