Skip to content

Commit 2e5f0b3

Browse files
committed
Remove unused TyCtxt argument from allow_two_phase_borrow function
1 parent 86ed311 commit 2e5f0b3

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/librustc_mir/borrow_check/borrow_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> {
315315
start_location, assigned_place, borrow_index,
316316
);
317317

318-
if !allow_two_phase_borrow(self.tcx, kind) {
318+
if !allow_two_phase_borrow(kind) {
319319
debug!(" -> {:?}", start_location);
320320
return;
321321
}

src/librustc_mir/borrow_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10761076
(Read(kind), BorrowKind::Unique) | (Read(kind), BorrowKind::Mut { .. }) => {
10771077
// Reading from mere reservations of mutable-borrows is OK.
10781078
if !is_active(&this.dominators, borrow, context.loc) {
1079-
assert!(allow_two_phase_borrow(tcx, borrow.kind));
1079+
assert!(allow_two_phase_borrow(borrow.kind));
10801080
return Control::Continue;
10811081
}
10821082

@@ -1233,7 +1233,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
12331233
BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))),
12341234
BorrowKind::Unique | BorrowKind::Mut { .. } => {
12351235
let wk = WriteKind::MutableBorrow(bk);
1236-
if allow_two_phase_borrow(self.infcx.tcx, bk) {
1236+
if allow_two_phase_borrow(bk) {
12371237
(Deep, Reservation(wk))
12381238
} else {
12391239
(Deep, Write(wk))

src/librustc_mir/borrow_check/nll/invalidation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
321321
BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))),
322322
BorrowKind::Unique | BorrowKind::Mut { .. } => {
323323
let wk = WriteKind::MutableBorrow(bk);
324-
if allow_two_phase_borrow(self.tcx, bk) {
324+
if allow_two_phase_borrow(bk) {
325325
(Deep, Reservation(wk))
326326
} else {
327327
(Deep, Write(wk))
@@ -439,7 +439,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> {
439439
// Reading from mere reservations of mutable-borrows is OK.
440440
if !is_active(&this.dominators, borrow, context.loc) {
441441
// If the borrow isn't active yet, reads don't invalidate it
442-
assert!(allow_two_phase_borrow(this.tcx, borrow.kind));
442+
assert!(allow_two_phase_borrow(borrow.kind));
443443
return Control::Continue;
444444
}
445445

src/librustc_mir/borrow_check/path_utils.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use rustc_data_structures::graph::dominators::Dominators;
1111
/// Returns `true` if the borrow represented by `kind` is
1212
/// allowed to be split into separate Reservation and
1313
/// Activation phases.
14-
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(
15-
_tcx: TyCtxt<'a, 'gcx, 'tcx>,
16-
kind: BorrowKind
17-
) -> bool {
14+
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(kind: BorrowKind) -> bool {
1815
kind.allows_two_phase_borrow()
1916
}
2017

0 commit comments

Comments
 (0)