From 2e5f0b3c49875e8cf1ee1bad2a74c2a81dcc7f78 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sun, 28 Apr 2019 21:13:33 +0200 Subject: [PATCH] Remove unused TyCtxt argument from allow_two_phase_borrow function --- src/librustc_mir/borrow_check/borrow_set.rs | 2 +- src/librustc_mir/borrow_check/mod.rs | 4 ++-- src/librustc_mir/borrow_check/nll/invalidation.rs | 4 ++-- src/librustc_mir/borrow_check/path_utils.rs | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 9581b6b52f7..90f23f78fec 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -315,7 +315,7 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { start_location, assigned_place, borrow_index, ); - if !allow_two_phase_borrow(self.tcx, kind) { + if !allow_two_phase_borrow(kind) { debug!(" -> {:?}", start_location); return; } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index aa6c152a37f..169d5652359 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1076,7 +1076,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { (Read(kind), BorrowKind::Unique) | (Read(kind), BorrowKind::Mut { .. }) => { // Reading from mere reservations of mutable-borrows is OK. if !is_active(&this.dominators, borrow, context.loc) { - assert!(allow_two_phase_borrow(tcx, borrow.kind)); + assert!(allow_two_phase_borrow(borrow.kind)); return Control::Continue; } @@ -1233,7 +1233,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))), BorrowKind::Unique | BorrowKind::Mut { .. } => { let wk = WriteKind::MutableBorrow(bk); - if allow_two_phase_borrow(self.infcx.tcx, bk) { + if allow_two_phase_borrow(bk) { (Deep, Reservation(wk)) } else { (Deep, Write(wk)) diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 5008627972a..3a368ea8c8d 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -321,7 +321,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))), BorrowKind::Unique | BorrowKind::Mut { .. } => { let wk = WriteKind::MutableBorrow(bk); - if allow_two_phase_borrow(self.tcx, bk) { + if allow_two_phase_borrow(bk) { (Deep, Reservation(wk)) } else { (Deep, Write(wk)) @@ -439,7 +439,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { // Reading from mere reservations of mutable-borrows is OK. if !is_active(&this.dominators, borrow, context.loc) { // If the borrow isn't active yet, reads don't invalidate it - assert!(allow_two_phase_borrow(this.tcx, borrow.kind)); + assert!(allow_two_phase_borrow(borrow.kind)); return Control::Continue; } diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index ec3c0bf68ad..86af2490408 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -11,10 +11,7 @@ use rustc_data_structures::graph::dominators::Dominators; /// Returns `true` if the borrow represented by `kind` is /// allowed to be split into separate Reservation and /// Activation phases. -pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>( - _tcx: TyCtxt<'a, 'gcx, 'tcx>, - kind: BorrowKind -) -> bool { +pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(kind: BorrowKind) -> bool { kind.allows_two_phase_borrow() }