Remove unused TyCtxt argument from allow_two_phase_borrow function

This commit is contained in:
flip1995 2019-04-28 21:13:33 +02:00
parent 86ed3116ba
commit 2e5f0b3c49
No known key found for this signature in database
GPG Key ID: 693086869D506637
4 changed files with 6 additions and 9 deletions

View File

@ -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;
}

View File

@ -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))

View File

@ -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;
}

View File

@ -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()
}