@@ -1932,48 +1932,26 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19321932 }
19331933 }
19341934
1935- Reservation ( wk @ WriteKind :: Move )
1936- | Write ( wk @ WriteKind :: Move )
1937- | Reservation ( wk @ WriteKind :: StorageDeadOrDrop )
1938- | Reservation ( wk @ WriteKind :: MutableBorrow ( BorrowKind :: Shared ) )
1939- | Reservation ( wk @ WriteKind :: MutableBorrow ( BorrowKind :: Shallow ) )
1940- | Write ( wk @ WriteKind :: StorageDeadOrDrop )
1941- | Write ( wk @ WriteKind :: MutableBorrow ( BorrowKind :: Shared ) )
1942- | Write ( wk @ WriteKind :: MutableBorrow ( BorrowKind :: Shallow ) ) => {
1943- if let ( Err ( place_err ) , true ) = (
1935+ Reservation ( WriteKind :: Move )
1936+ | Write ( WriteKind :: Move )
1937+ | Reservation ( WriteKind :: StorageDeadOrDrop )
1938+ | Reservation ( WriteKind :: MutableBorrow ( BorrowKind :: Shared ) )
1939+ | Reservation ( WriteKind :: MutableBorrow ( BorrowKind :: Shallow ) )
1940+ | Write ( WriteKind :: StorageDeadOrDrop )
1941+ | Write ( WriteKind :: MutableBorrow ( BorrowKind :: Shared ) )
1942+ | Write ( WriteKind :: MutableBorrow ( BorrowKind :: Shallow ) ) => {
1943+ if let ( Err ( _ ) , true ) = (
19441944 self . is_mutable ( place. as_ref ( ) , is_local_mutation_allowed) ,
19451945 self . errors_buffer . is_empty ( )
19461946 ) {
1947- if self . infcx . tcx . migrate_borrowck ( ) {
1948- // rust-lang/rust#46908: In pure NLL mode this
1949- // code path should be unreachable (and thus
1950- // we signal an ICE in the else branch
1951- // here). But we can legitimately get here
1952- // under borrowck=migrate mode, so instead of
1953- // ICE'ing we instead report a legitimate
1954- // error (which will then be downgraded to a
1955- // warning by the migrate machinery).
1956- error_access = match wk {
1957- WriteKind :: MutableBorrow ( _) => AccessKind :: MutableBorrow ,
1958- WriteKind :: Move => AccessKind :: Move ,
1959- WriteKind :: StorageDeadOrDrop |
1960- WriteKind :: Mutate => AccessKind :: Mutate ,
1961- } ;
1962- self . report_mutability_error (
1963- place,
1964- span,
1965- place_err,
1966- error_access,
1967- location,
1968- ) ;
1969- } else {
1970- span_bug ! (
1971- span,
1972- "Accessing `{:?}` with the kind `{:?}` shouldn't be possible" ,
1973- place,
1974- kind,
1975- ) ;
1976- }
1947+ // rust-lang/rust#46908: In pure NLL mode this code path should
1948+ // be unreachable (and thus we signal an ICE in the else branch here).
1949+ span_bug ! (
1950+ span,
1951+ "Accessing `{:?}` with the kind `{:?}` shouldn't be possible" ,
1952+ place,
1953+ kind,
1954+ ) ;
19771955 }
19781956 return false ;
19791957 }
0 commit comments