diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 60d5340613c2a..75814ba6aab3d 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1216,10 +1216,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "make unnamed regions display as '# (where # is some non-ident unique id)"), borrowck: Option<String> = (None, parse_opt_string, [UNTRACKED], "select which borrowck is used (`ast`, `mir`, `migrate`, or `compare`)"), - two_phase_borrows: bool = (false, parse_bool, [UNTRACKED], - "use two-phase reserved/active distinction for `&mut` borrows in MIR borrowck"), - two_phase_beyond_autoref: bool = (false, parse_bool, [UNTRACKED], - "when using two-phase-borrows, allow two phases even for non-autoref `&mut` borrows"), time_passes: bool = (false, parse_bool, [UNTRACKED], "measure time of each rustc pass"), time: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 918192395c3f4..c8d6ee9db6f9e 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -1,5 +1,6 @@ use crate::borrow_check::place_ext::PlaceExt; use crate::borrow_check::nll::ToRegionVid; +use crate::borrow_check::path_utils::allow_two_phase_borrow; use crate::dataflow::indexes::BorrowIndex; use crate::dataflow::move_paths::MoveData; use rustc::mir::traversal; @@ -299,13 +300,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { - /// Returns `true` if the borrow represented by `kind` is - /// allowed to be split into separate Reservation and - /// Activation phases. - fn allow_two_phase_borrow(&self, kind: mir::BorrowKind) -> bool { - kind.allows_two_phase_borrow() - || self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref - } /// If this is a two-phase borrow, then we will record it /// as "pending" until we find the activating use. @@ -321,7 +315,7 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { start_location, assigned_place, borrow_index, ); - if !self.allow_two_phase_borrow(kind) { + if !allow_two_phase_borrow(&self.tcx, kind) { debug!(" -> {:?}", start_location); return; } diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index c68dee29c5b1b..f6a22cf040797 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -12,11 +12,10 @@ use rustc_data_structures::graph::dominators::Dominators; /// 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>, + _tcx: &TyCtxt<'a, 'gcx, 'tcx>, kind: BorrowKind ) -> bool { kind.allows_two_phase_borrow() - || tcx.sess.opts.debugging_opts.two_phase_beyond_autoref } /// Control for the path borrow checking code