Skip to content

Commit ec76190

Browse files
committed
Remove nll-dump-cause flag and always track causes
1 parent 6f2100b commit ec76190

28 files changed

+46
-55
lines changed

src/librustc/session/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,8 +1312,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13121312
"choose which RELRO level to use"),
13131313
nll: bool = (false, parse_bool, [UNTRACKED],
13141314
"run the non-lexical lifetimes MIR pass"),
1315-
nll_dump_cause: bool = (false, parse_bool, [UNTRACKED],
1316-
"dump cause information when reporting errors from NLL"),
13171315
trans_time_graph: bool = (false, parse_bool, [UNTRACKED],
13181316
"generate a graphical HTML report of time spent in trans and LLVM"),
13191317
thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],

src/librustc/session/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,6 @@ impl Session {
476476
*(self.features.borrow_mut()) = Some(features);
477477
}
478478

479-
/// If true, we should gather causal information during NLL
480-
/// checking. This will eventually be the normal thing, but right
481-
/// now it is too unoptimized.
482-
pub fn nll_dump_cause(&self) -> bool {
483-
self.opts.debugging_opts.nll_dump_cause
484-
}
485-
486479
/// Calculates the flavor of LTO to use for this compilation.
487480
pub fn lto(&self) -> config::Lto {
488481
// If our target has codegen requirements ignore the command line

src/librustc_mir/borrow_check/nll/region_infer/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ pub struct RegionInferenceContext<'tcx> {
7272
universal_regions: UniversalRegions<'tcx>,
7373
}
7474

75-
struct TrackCauses(bool);
76-
7775
struct RegionDefinition<'tcx> {
7876
/// Why we created this variable. Mostly these will be
7977
/// `RegionVariableOrigin::NLL`, but some variables get created
@@ -250,15 +248,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
250248
.map(|origin| RegionDefinition::new(origin))
251249
.collect();
252250

253-
let nll_dump_cause = ty::tls::with(|tcx| tcx.sess.nll_dump_cause());
254-
255251
let mut result = Self {
256252
definitions,
257253
elements: elements.clone(),
258254
liveness_constraints: RegionValues::new(
259255
elements,
260256
num_region_variables,
261-
TrackCauses(nll_dump_cause),
262257
),
263258
inferred_values: None,
264259
constraints: Vec::new(),

src/librustc_mir/borrow_check/nll/region_infer/values.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc::mir::{BasicBlock, Location, Mir};
1717
use rustc::ty::RegionVid;
1818
use syntax::codemap::Span;
1919

20-
use super::{Cause, CauseExt, TrackCauses};
20+
use super::{Cause, CauseExt};
2121

2222
/// Maps between the various kinds of elements of a region value to
2323
/// the internal indices that w use.
@@ -202,7 +202,6 @@ impl RegionValues {
202202
pub(super) fn new(
203203
elements: &Rc<RegionValueElements>,
204204
num_region_variables: usize,
205-
track_causes: TrackCauses,
206205
) -> Self {
207206
assert!(
208207
elements.num_universal_regions <= num_region_variables,
@@ -215,11 +214,7 @@ impl RegionValues {
215214
RegionVid::new(num_region_variables),
216215
RegionElementIndex::new(elements.num_elements()),
217216
),
218-
causes: if track_causes.0 {
219-
Some(CauseMap::default())
220-
} else {
221-
None
222-
},
217+
causes: Some(CauseMap::default()),
223218
}
224219
}
225220

src/test/ui/issue-45157.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ LL | let mref = &mut u.s.a;
66
...
77
LL | let nref = &u.z.c;
88
| ^^^^^^ immutable borrow occurs here
9+
LL | //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
10+
LL | println!("{} {}", mref, nref)
11+
| ---- borrow later used here
912

1013
error[E0502]: cannot borrow `u.s.a` as mutable because it is also borrowed as immutable
1114
--> $DIR/issue-45157.rs:39:27
@@ -14,7 +17,9 @@ LL | let nref = &u.z.c;
1417
| ------ immutable borrow occurs here
1518
LL | //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
1619
LL | println!("{} {}", mref, nref)
17-
| ^^^^ mutable borrow occurs here
20+
| ^^^^ ---- borrow later used here
21+
| |
22+
| mutable borrow occurs here
1823

1924
error: aborting due to 2 previous errors
2025

src/test/ui/nll/borrowed-local-error.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Znll-dump-cause
12-
1311
#![feature(nll)]
1412

1513
fn gimme(x: &(u32,)) -> &u32 {

src/test/ui/nll/borrowed-local-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `v` does not live long enough
2-
--> $DIR/borrowed-local-error.rs:22:9
2+
--> $DIR/borrowed-local-error.rs:20:9
33
|
44
LL | let x = gimme({
55
| _____________-

src/test/ui/nll/borrowed-match-issue-45045.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ LL | | //~^ cannot use `e` because it was mutably borrowed [E0503]
1010
LL | | Xyz::B => println!("b"),
1111
LL | | };
1212
| |_____^ use of borrowed `e`
13+
LL | *g = Xyz::B;
14+
| ----------- borrow later used here
1315

1416
error[E0503]: cannot use `e` because it was mutably borrowed
1517
--> $DIR/borrowed-match-issue-45045.rs:25:9
@@ -19,6 +21,9 @@ LL | let f = &mut e;
1921
...
2022
LL | Xyz::A => println!("a"),
2123
| ^^^^^^ use of borrowed `e`
24+
...
25+
LL | *g = Xyz::B;
26+
| ----------- borrow later used here
2227

2328
error: aborting due to 2 previous errors
2429

src/test/ui/nll/borrowed-referent-issue-38899.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ LL | let x = &mut block;
66
LL | println!("{}", x.current);
77
LL | let p: &'a u8 = &*block.current;
88
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
9+
LL | //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
10+
LL | drop(x);
11+
| - borrow later used here
912

1013
error: aborting due to previous error
1114

src/test/ui/nll/borrowed-temporary-error.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Znll-dump-cause
12-
1311
#![feature(nll)]
1412

1513
fn gimme(x: &(u32,)) -> &u32 {

src/test/ui/nll/borrowed-temporary-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: borrowed value does not live long enough
2-
--> $DIR/borrowed-temporary-error.rs:22:10
2+
--> $DIR/borrowed-temporary-error.rs:20:10
33
|
44
LL | &(v,)
55
| ^^^^ temporary value does not live long enough

src/test/ui/nll/borrowed-universal-error-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Znll-dump-cause
12-
1311
#![feature(nll)]
1412
#![allow(warnings)]
1513

src/test/ui/nll/borrowed-universal-error-2.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0597]: `v` does not live long enough
2-
--> $DIR/borrowed-universal-error-2.rs:18:5
2+
--> $DIR/borrowed-universal-error-2.rs:16:5
33
|
44
LL | &v
55
| ^^ borrowed value does not live long enough
66
LL | //~^ ERROR `v` does not live long enough [E0597]
77
LL | }
88
| - borrowed value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:1...
11-
--> $DIR/borrowed-universal-error-2.rs:16:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
11+
--> $DIR/borrowed-universal-error-2.rs:14:1
1212
|
1313
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/nll/borrowed-universal-error.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Znll-dump-cause
12-
1311
#![feature(nll)]
1412
#![allow(warnings)]
1513

src/test/ui/nll/borrowed-universal-error.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0597]: borrowed value does not live long enough
2-
--> $DIR/borrowed-universal-error.rs:22:12
2+
--> $DIR/borrowed-universal-error.rs:20:12
33
|
44
LL | gimme(&(v,))
55
| ^^^^ temporary value does not live long enough
66
LL | //~^ ERROR borrowed value does not live long enough [E0597]
77
LL | }
88
| - temporary value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:1...
11-
--> $DIR/borrowed-universal-error.rs:20:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:1...
11+
--> $DIR/borrowed-universal-error.rs:18:1
1212
|
1313
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/nll/capture-ref-in-struct.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags:-Znll-dump-cause
12-
1311
// Test that a structure which tries to store a pointer to `y` into
1412
// `p` (indirectly) fails to compile.
1513

src/test/ui/nll/capture-ref-in-struct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `y` does not live long enough
2-
--> $DIR/capture-ref-in-struct.rs:33:16
2+
--> $DIR/capture-ref-in-struct.rs:31:16
33
|
44
LL | y: &y,
55
| ^^ borrowed value does not live long enough

src/test/ui/nll/closure-requirements/escape-argument.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// basically checking that the MIR type checker correctly enforces the
2323
// closure signature.
2424

25-
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
25+
// compile-flags:-Znll -Zborrowck=mir -Zverbose
2626

2727
#![feature(rustc_attrs)]
2828

src/test/ui/nll/closure-requirements/escape-upvar-nested.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//
1616
// except that the closure does so via a second closure.
1717

18-
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
18+
// compile-flags:-Znll -Zborrowck=mir -Zverbose
1919

2020
#![feature(rustc_attrs)]
2121

src/test/ui/nll/closure-requirements/escape-upvar-ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// `'b`. This relationship is propagated to the closure creator,
2020
// which reports an error.
2121

22-
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
22+
// compile-flags:-Znll -Zborrowck=mir -Zverbose
2323

2424
#![feature(rustc_attrs)]
2525

src/test/ui/nll/drop-no-may-dangle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// because of destructor. (Note that the stderr also identifies this
1414
// destructor in the error message.)
1515

16-
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause
16+
// compile-flags:-Znll -Zborrowck=mir
1717

1818
#![allow(warnings)]
1919
#![feature(dropck_eyepatch)]

src/test/ui/nll/get_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// a variety of errors from the older, AST-based machinery (notably
1414
// borrowck), and then we get the NLL error at the end.
1515

16-
// compile-flags:-Znll -Zborrowck=compare -Znll-dump-cause
16+
// compile-flags:-Znll -Zborrowck=compare
1717

1818
struct Map {
1919
}

src/test/ui/nll/guarantor-issue-46974.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | let t = &mut *s; // this borrow should last for the entire function
66
LL | let x = &t.0;
77
LL | *s = (2,); //~ ERROR cannot assign to `*s`
88
| ^^^^^^^^^ assignment to borrowed `*s` occurs here
9+
LL | *x
10+
| -- borrow later used here
911

1012
error[E0621]: explicit lifetime required in the type of `s`
1113
--> $DIR/guarantor-issue-46974.rs:25:5

src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll -Znll-dump-cause
11+
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
1212

1313

1414
#![allow(warnings)]

src/test/ui/nll/maybe-initialized-drop-with-fragment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
11+
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
1212

1313
#![allow(warnings)]
1414

src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
11+
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
1212

1313
#![allow(warnings)]
1414

src/test/ui/nll/maybe-initialized-drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
11+
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
1212

1313
#![allow(warnings)]
1414

src/test/ui/nll/return-ref-mut-issue-46557.stderr

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
error[E0597]: borrowed value does not live long enough
22
--> $DIR/return-ref-mut-issue-46557.rs:17:21
33
|
4-
LL | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
5-
| ^^^^^^^ temporary value does not live long enough
6-
LL | x
7-
LL | }
8-
| - temporary value only lives until here
4+
LL | fn gimme_static_mut() -> &'static mut u32 {
5+
| ___________________________________________-
6+
LL | | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
7+
| | ^^^^^^^ temporary value does not live long enough
8+
LL | | x
9+
LL | | }
10+
| | -
11+
| | |
12+
| |_temporary value only lives until here
13+
| borrow later used here
914

1015
error: aborting due to previous error
1116

0 commit comments

Comments
 (0)