feature nll implies two-phase-borrows
This commit is contained in:
parent
0b2db1e616
commit
2019d69f61
@ -443,6 +443,9 @@ impl Session {
|
||||
pub fn nll_dump_cause(&self) -> bool {
|
||||
self.opts.debugging_opts.nll_dump_cause
|
||||
}
|
||||
pub fn two_phase_borrows(&self) -> bool {
|
||||
self.features.borrow().nll || self.opts.debugging_opts.two_phase_borrows
|
||||
}
|
||||
pub fn emit_end_regions(&self) -> bool {
|
||||
self.opts.debugging_opts.emit_end_regions ||
|
||||
(self.opts.debugging_opts.mir_emit_validate > 0) ||
|
||||
|
@ -774,7 +774,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 this.tcx.sess.opts.debugging_opts.two_phase_borrows && index.is_reservation()
|
||||
if this.tcx.sess.two_phase_borrows() && index.is_reservation()
|
||||
{
|
||||
return Control::Continue;
|
||||
}
|
||||
@ -922,7 +922,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 self.tcx.sess.opts.debugging_opts.two_phase_borrows {
|
||||
if self.tcx.sess.two_phase_borrows() {
|
||||
(Deep, Reservation(wk))
|
||||
} else {
|
||||
(Deep, Write(wk))
|
||||
@ -1112,7 +1112,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
span: Span,
|
||||
flow_state: &Flows<'cx, 'gcx, 'tcx>,
|
||||
) {
|
||||
if !self.tcx.sess.opts.debugging_opts.two_phase_borrows {
|
||||
if !self.tcx.sess.two_phase_borrows() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
// revisions: lxl nll
|
||||
//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||
//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
fn main() {
|
||||
let mut a = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user