]> git.lizzy.rs Git - rust.git/commitdiff
Remove unused TyCtxt argument from allow_two_phase_borrow function
authorflip1995 <hello@philkrones.com>
Sun, 28 Apr 2019 19:13:33 +0000 (21:13 +0200)
committerflip1995 <hello@philkrones.com>
Sun, 28 Apr 2019 20:17:15 +0000 (22:17 +0200)
src/librustc_mir/borrow_check/borrow_set.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/nll/invalidation.rs
src/librustc_mir/borrow_check/path_utils.rs

index 9581b6b52f7ab2fa4b06846c8ddb4ea43d933cdf..90f23f78fec23ff4924eaa8b9de29260400f693c 100644 (file)
@@ -315,7 +315,7 @@ fn insert_as_pending_if_two_phase(
             start_location, assigned_place, borrow_index,
         );
 
-        if !allow_two_phase_borrow(self.tcx, kind) {
+        if !allow_two_phase_borrow(kind) {
             debug!("  -> {:?}", start_location);
             return;
         }
index aa6c152a37ffbb2d625f516470321239fa7e4137..169d56523591d3e44a854405429e1d4b228d75d2 100644 (file)
@@ -1076,7 +1076,7 @@ fn check_access_for_conflict(
                 (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 @@ fn consume_rvalue(
                     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))
index 5008627972aa649e291c6cb732ad2726ea27f943..3a368ea8c8d59acc703ce7b70d0799d93dc0bd07 100644 (file)
@@ -321,7 +321,7 @@ fn consume_rvalue(
                     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 @@ fn check_access_for_conflict(
                         // 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;
                         }
 
index ec3c0bf68ad87409c1854b40ddc41cab0ec4b228..86af2490408aac755bd02c3e41216a042f3c92b7 100644 (file)
 /// 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()
 }