Skip to content

Commit 6c386d4

Browse files
P8L1frank-king
authored andcommitted
Inline pinned_borrows access
Remove the now-unnecessary helper method and access state.pinned_borrows directly.
1 parent 799bf49 commit 6c386d4

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
@@ -1270,13 +1270,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12701270
}
12711271
}
12721272

1273-
fn pinned_borrows<'s>(
1274-
&self,
1275-
state: &'s BorrowckDomain,
1276-
) -> Option<&'s MixedBitSet<BorrowIndex>> {
1277-
Some(&state.pinned_borrows)
1278-
}
1279-
12801273
#[instrument(level = "debug", skip(self, state))]
12811274
fn check_access_for_conflict(
12821275
&mut self,
@@ -1290,7 +1283,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12901283

12911284
let borrows_in_scope = self.borrows_in_scope(location, state);
12921285
debug!(?borrows_in_scope, ?location);
1293-
let pinned_borrows = self.pinned_borrows(state);
1286+
let pinned_borrows = &state.pinned_borrows;
12941287

12951288
each_borrow_involving_path(
12961289
self,
@@ -1299,8 +1292,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
12991292
(sd, place_span.0),
13001293
self.borrow_set,
13011294
|borrow_index| {
1302-
borrows_in_scope.contains(borrow_index)
1303-
|| pinned_borrows.is_some_and(|p| p.contains(borrow_index))
1295+
borrows_in_scope.contains(borrow_index) || pinned_borrows.contains(borrow_index)
13041296
},
13051297
|this, borrow_index, borrow| match (rw, borrow.kind) {
13061298
// Obviously an activation is compatible with its own
@@ -1383,7 +1375,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
13831375
if !borrows_in_scope.contains(borrow_index) =>
13841376
{
13851377
debug_assert!(
1386-
pinned_borrows.is_none_or(|p| p.contains(borrow_index)),
1378+
pinned_borrows.contains(borrow_index),
13871379
"unexpected expired but non-pinned borrow {borrow_index:?}: {borrow:?}",
13881380
);
13891381
match kind {

0 commit comments

Comments
 (0)