Skip to content

Commit 3d4d351

Browse files
P8L1frank-king
authored andcommitted
Inline pinned_borrows access
Remove the now-unnecessary helper method and access state.pinned_borrows directly.
1 parent 2b7e6bb commit 3d4d351

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

  • compiler/rustc_borrowck/src

compiler/rustc_borrowck/src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,13 +1265,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12651265
}
12661266
}
12671267

1268-
fn pinned_borrows<'s>(
1269-
&self,
1270-
state: &'s BorrowckDomain,
1271-
) -> Option<&'s MixedBitSet<BorrowIndex>> {
1272-
Some(&state.pinned_borrows)
1273-
}
1274-
12751268
#[instrument(level = "debug", skip(self, state))]
12761269
fn check_access_for_conflict(
12771270
&mut self,
@@ -1284,7 +1277,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12841277
let mut error_reported = false;
12851278

12861279
let borrows_in_scope = self.borrows_in_scope(location, state);
1287-
let pinned_borrows = self.pinned_borrows(state);
1280+
let pinned_borrows = &state.pinned_borrows;
12881281

12891282
each_borrow_involving_path(
12901283
self,
@@ -1293,8 +1286,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12931286
(sd, place_span.0),
12941287
self.borrow_set,
12951288
|borrow_index| {
1296-
borrows_in_scope.contains(borrow_index)
1297-
|| pinned_borrows.is_some_and(|p| p.contains(borrow_index))
1289+
borrows_in_scope.contains(borrow_index) || pinned_borrows.contains(borrow_index)
12981290
},
12991291
|this, borrow_index, borrow| match (rw, borrow.kind) {
13001292
// Obviously an activation is compatible with its own
@@ -1377,7 +1369,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
13771369
if !borrows_in_scope.contains(borrow_index) =>
13781370
{
13791371
debug_assert!(
1380-
pinned_borrows.is_none_or(|p| p.contains(borrow_index)),
1372+
pinned_borrows.contains(borrow_index),
13811373
"unexpected expired but non-pinned borrow {borrow_index:?}: {borrow:?}",
13821374
);
13831375
match kind {

0 commit comments

Comments
 (0)