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 {

0 commit comments

Comments
 (0)