feature nll implies borrowck=mir
This commit is contained in:
parent
2019d69f61
commit
e980fb8bef
5 changed files with 23 additions and 6 deletions
|
@ -18,7 +18,7 @@ use lint;
|
||||||
use middle::allocator::AllocatorKind;
|
use middle::allocator::AllocatorKind;
|
||||||
use middle::dependency_format;
|
use middle::dependency_format;
|
||||||
use session::search_paths::PathKind;
|
use session::search_paths::PathKind;
|
||||||
use session::config::DebugInfoLevel;
|
use session::config::{BorrowckMode, DebugInfoLevel};
|
||||||
use ty::tls;
|
use ty::tls;
|
||||||
use util::nodemap::{FxHashMap, FxHashSet};
|
use util::nodemap::{FxHashMap, FxHashSet};
|
||||||
use util::common::{duration_to_secs_str, ErrorReported};
|
use util::common::{duration_to_secs_str, ErrorReported};
|
||||||
|
@ -440,16 +440,34 @@ impl Session {
|
||||||
pub fn nll(&self) -> bool {
|
pub fn nll(&self) -> bool {
|
||||||
self.features.borrow().nll || self.opts.debugging_opts.nll
|
self.features.borrow().nll || self.opts.debugging_opts.nll
|
||||||
}
|
}
|
||||||
|
pub fn use_mir(&self) -> bool {
|
||||||
|
self.features.borrow().nll || self.opts.borrowck_mode.use_mir()
|
||||||
|
}
|
||||||
pub fn nll_dump_cause(&self) -> bool {
|
pub fn nll_dump_cause(&self) -> bool {
|
||||||
self.opts.debugging_opts.nll_dump_cause
|
self.opts.debugging_opts.nll_dump_cause
|
||||||
}
|
}
|
||||||
pub fn two_phase_borrows(&self) -> bool {
|
pub fn two_phase_borrows(&self) -> bool {
|
||||||
self.features.borrow().nll || self.opts.debugging_opts.two_phase_borrows
|
self.features.borrow().nll || self.opts.debugging_opts.two_phase_borrows
|
||||||
}
|
}
|
||||||
|
pub fn borrowck_mode(&self) -> BorrowckMode {
|
||||||
|
match self.opts.borrowck_mode {
|
||||||
|
mode @ BorrowckMode::Mir |
|
||||||
|
mode @ BorrowckMode::Compare => mode,
|
||||||
|
|
||||||
|
mode @ BorrowckMode::Ast => {
|
||||||
|
if self.features.borrow().nll {
|
||||||
|
BorrowckMode::Mir
|
||||||
|
} else {
|
||||||
|
mode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn emit_end_regions(&self) -> bool {
|
pub fn emit_end_regions(&self) -> bool {
|
||||||
self.opts.debugging_opts.emit_end_regions ||
|
self.opts.debugging_opts.emit_end_regions ||
|
||||||
(self.opts.debugging_opts.mir_emit_validate > 0) ||
|
(self.opts.debugging_opts.mir_emit_validate > 0) ||
|
||||||
self.opts.borrowck_mode.use_mir()
|
self.use_mir()
|
||||||
}
|
}
|
||||||
pub fn lto(&self) -> bool {
|
pub fn lto(&self) -> bool {
|
||||||
self.opts.cg.lto || self.target.target.options.requires_lto
|
self.opts.cg.lto || self.target.target.options.requires_lto
|
||||||
|
|
|
@ -275,7 +275,7 @@ impl<'b, 'tcx: 'b> BorrowckErrors for BorrowckCtxt<'b, 'tcx> {
|
||||||
o: Origin)
|
o: Origin)
|
||||||
-> DiagnosticBuilder<'a>
|
-> DiagnosticBuilder<'a>
|
||||||
{
|
{
|
||||||
if !o.should_emit_errors(self.tcx.sess.opts.borrowck_mode) {
|
if !o.should_emit_errors(self.tcx.sess.borrowck_mode()) {
|
||||||
self.tcx.sess.diagnostic().cancel(&mut diag);
|
self.tcx.sess.diagnostic().cancel(&mut diag);
|
||||||
}
|
}
|
||||||
diag
|
diag
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn mir_borrowck<'a, 'tcx>(
|
||||||
debug!("run query mir_borrowck: {}", tcx.item_path_str(def_id));
|
debug!("run query mir_borrowck: {}", tcx.item_path_str(def_id));
|
||||||
|
|
||||||
if {
|
if {
|
||||||
!tcx.has_attr(def_id, "rustc_mir_borrowck") && !tcx.sess.opts.borrowck_mode.use_mir()
|
!tcx.has_attr(def_id, "rustc_mir_borrowck") && !tcx.sess.use_mir()
|
||||||
&& !tcx.sess.nll()
|
&& !tcx.sess.nll()
|
||||||
} {
|
} {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -509,7 +509,7 @@ impl<'b, 'gcx, 'tcx> BorrowckErrors for TyCtxt<'b, 'gcx, 'tcx> {
|
||||||
o: Origin)
|
o: Origin)
|
||||||
-> DiagnosticBuilder<'a>
|
-> DiagnosticBuilder<'a>
|
||||||
{
|
{
|
||||||
if !o.should_emit_errors(self.sess.opts.borrowck_mode) {
|
if !o.should_emit_errors(self.sess.borrowck_mode()) {
|
||||||
self.sess.diagnostic().cancel(&mut diag);
|
self.sess.diagnostic().cancel(&mut diag);
|
||||||
}
|
}
|
||||||
diag
|
diag
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// revisions: lxl nll
|
// revisions: lxl nll
|
||||||
//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||||
//[nll]compile-flags: -Z borrowck=mir
|
|
||||||
|
|
||||||
#![cfg_attr(nll, feature(nll))]
|
#![cfg_attr(nll, feature(nll))]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue