Skip to content

Commit 881a7cd

Browse files
committed
Auto merge of #49836 - nikomatsakis:nll-facts-prep, r=pnkfelix
prep work for using timely dataflow with NLL Two major changes: **Two-phase borrows are overhauled.** We no longer have two bits per borrow. Instead, we track -- for each borrow -- an (optional) "activation point". Then, for each point P where the borrow is in scope, we check where P falls relative to the activation point. If P is between the reservation point and the activation point, then this is the "reservation" phase of the borrow, else the borrow is considered active. This is simpler and means that the dataflow doesn't have to care about 2-phase at all, at last not yet. **We no longer support using the MIR borrow checker without NLL.** It is going to be increasingly untenable to support lexical mode as we go forward, I think, and also of increasingly little value. This also exposed a few bugs in NLL mode due to increased testing. r? @pnkfelix cc @bobtwinkles
2 parents d703622 + 96dba93 commit 881a7cd

File tree

145 files changed

+1141
-1128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1141
-1128
lines changed

src/librustc/infer/error_reporting/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -303,28 +303,28 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
303303
) {
304304
debug!("report_region_errors(): {} errors to start", errors.len());
305305

306-
if will_later_be_reported_by_nll && self.tcx.nll() {
306+
if will_later_be_reported_by_nll && self.tcx.use_mir_borrowck() {
307307
// With `#![feature(nll)]`, we want to present a nice user
308308
// experience, so don't even mention the errors from the
309309
// AST checker.
310310
if self.tcx.features().nll {
311311
return;
312312
}
313313

314-
// But with -Znll, it's nice to have some note for later.
314+
// But with nll, it's nice to have some note for later.
315315
for error in errors {
316316
match *error {
317317
RegionResolutionError::ConcreteFailure(ref origin, ..)
318318
| RegionResolutionError::GenericBoundFailure(ref origin, ..) => {
319319
self.tcx
320320
.sess
321-
.span_warn(origin.span(), "not reporting region error due to -Znll");
321+
.span_warn(origin.span(), "not reporting region error due to nll");
322322
}
323323

324324
RegionResolutionError::SubSupConflict(ref rvo, ..) => {
325325
self.tcx
326326
.sess
327-
.span_warn(rvo.span(), "not reporting region error due to -Znll");
327+
.span_warn(rvo.span(), "not reporting region error due to nll");
328328
}
329329
}
330330
}

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ impl Location {
19911991
Location { block: self.block, statement_index: self.statement_index + 1 }
19921992
}
19931993

1994-
pub fn dominates(&self, other: &Location, dominators: &Dominators<BasicBlock>) -> bool {
1994+
pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
19951995
if self.block == other.block {
19961996
self.statement_index <= other.statement_index
19971997
} else {

src/librustc/session/config.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12591259
useful for profiling / PGO."),
12601260
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
12611261
"choose which RELRO level to use"),
1262-
nll: bool = (false, parse_bool, [UNTRACKED],
1263-
"run the non-lexical lifetimes MIR pass"),
12641262
disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED],
12651263
"disable user provided type assertion in NLL"),
12661264
trans_time_graph: bool = (false, parse_bool, [UNTRACKED],

src/librustc/ty/context.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1459,15 +1459,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
14591459
self.on_disk_query_result_cache.serialize(self.global_tcx(), encoder)
14601460
}
14611461

1462-
/// If true, we should use NLL-style region checking instead of
1463-
/// lexical style.
1464-
pub fn nll(self) -> bool {
1465-
self.features().nll || self.sess.opts.debugging_opts.nll
1466-
}
1467-
14681462
/// If true, we should use the MIR-based borrowck (we may *also* use
14691463
/// the AST-based borrowck).
1470-
pub fn use_mir(self) -> bool {
1464+
pub fn use_mir_borrowck(self) -> bool {
14711465
self.borrowck_mode().use_mir()
14721466
}
14731467

@@ -1486,7 +1480,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
14861480
mode @ BorrowckMode::Compare => mode,
14871481

14881482
mode @ BorrowckMode::Ast => {
1489-
if self.nll() {
1483+
if self.features().nll {
14901484
BorrowckMode::Mir
14911485
} else {
14921486
mode
@@ -1500,11 +1494,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
15001494
/// MIR borrowck, but not when NLL is used. They are also consumed
15011495
/// by the validation stuff.
15021496
pub fn emit_end_regions(self) -> bool {
1503-
// FIXME(#46875) -- we should not emit end regions when NLL is enabled,
1504-
// but for now we can't stop doing so because it causes false positives
15051497
self.sess.opts.debugging_opts.emit_end_regions ||
15061498
self.sess.opts.debugging_opts.mir_emit_validate > 0 ||
1507-
self.use_mir()
1499+
self.use_mir_borrowck()
15081500
}
15091501

15101502
#[inline]

0 commit comments

Comments
 (0)