mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Remove nll-dump-cause flag and always track causes
This commit is contained in:
parent
6f2100b92c
commit
ec761903ec
@ -1312,8 +1312,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||
"choose which RELRO level to use"),
|
||||
nll: bool = (false, parse_bool, [UNTRACKED],
|
||||
"run the non-lexical lifetimes MIR pass"),
|
||||
nll_dump_cause: bool = (false, parse_bool, [UNTRACKED],
|
||||
"dump cause information when reporting errors from NLL"),
|
||||
trans_time_graph: bool = (false, parse_bool, [UNTRACKED],
|
||||
"generate a graphical HTML report of time spent in trans and LLVM"),
|
||||
thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
|
@ -476,13 +476,6 @@ impl Session {
|
||||
*(self.features.borrow_mut()) = Some(features);
|
||||
}
|
||||
|
||||
/// If true, we should gather causal information during NLL
|
||||
/// checking. This will eventually be the normal thing, but right
|
||||
/// now it is too unoptimized.
|
||||
pub fn nll_dump_cause(&self) -> bool {
|
||||
self.opts.debugging_opts.nll_dump_cause
|
||||
}
|
||||
|
||||
/// Calculates the flavor of LTO to use for this compilation.
|
||||
pub fn lto(&self) -> config::Lto {
|
||||
// If our target has codegen requirements ignore the command line
|
||||
|
@ -72,8 +72,6 @@ pub struct RegionInferenceContext<'tcx> {
|
||||
universal_regions: UniversalRegions<'tcx>,
|
||||
}
|
||||
|
||||
struct TrackCauses(bool);
|
||||
|
||||
struct RegionDefinition<'tcx> {
|
||||
/// Why we created this variable. Mostly these will be
|
||||
/// `RegionVariableOrigin::NLL`, but some variables get created
|
||||
@ -250,15 +248,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
.map(|origin| RegionDefinition::new(origin))
|
||||
.collect();
|
||||
|
||||
let nll_dump_cause = ty::tls::with(|tcx| tcx.sess.nll_dump_cause());
|
||||
|
||||
let mut result = Self {
|
||||
definitions,
|
||||
elements: elements.clone(),
|
||||
liveness_constraints: RegionValues::new(
|
||||
elements,
|
||||
num_region_variables,
|
||||
TrackCauses(nll_dump_cause),
|
||||
),
|
||||
inferred_values: None,
|
||||
constraints: Vec::new(),
|
||||
|
@ -17,7 +17,7 @@ use rustc::mir::{BasicBlock, Location, Mir};
|
||||
use rustc::ty::RegionVid;
|
||||
use syntax::codemap::Span;
|
||||
|
||||
use super::{Cause, CauseExt, TrackCauses};
|
||||
use super::{Cause, CauseExt};
|
||||
|
||||
/// Maps between the various kinds of elements of a region value to
|
||||
/// the internal indices that w use.
|
||||
@ -202,7 +202,6 @@ impl RegionValues {
|
||||
pub(super) fn new(
|
||||
elements: &Rc<RegionValueElements>,
|
||||
num_region_variables: usize,
|
||||
track_causes: TrackCauses,
|
||||
) -> Self {
|
||||
assert!(
|
||||
elements.num_universal_regions <= num_region_variables,
|
||||
@ -215,11 +214,7 @@ impl RegionValues {
|
||||
RegionVid::new(num_region_variables),
|
||||
RegionElementIndex::new(elements.num_elements()),
|
||||
),
|
||||
causes: if track_causes.0 {
|
||||
Some(CauseMap::default())
|
||||
} else {
|
||||
None
|
||||
},
|
||||
causes: Some(CauseMap::default()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,9 @@ LL | let mref = &mut u.s.a;
|
||||
...
|
||||
LL | let nref = &u.z.c;
|
||||
| ^^^^^^ immutable borrow occurs here
|
||||
LL | //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
|
||||
LL | println!("{} {}", mref, nref)
|
||||
| ---- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `u.s.a` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/issue-45157.rs:39:27
|
||||
@ -14,7 +17,9 @@ LL | let nref = &u.z.c;
|
||||
| ------ immutable borrow occurs here
|
||||
LL | //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
|
||||
LL | println!("{} {}", mref, nref)
|
||||
| ^^^^ mutable borrow occurs here
|
||||
| ^^^^ ---- borrow later used here
|
||||
| |
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Znll-dump-cause
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
fn gimme(x: &(u32,)) -> &u32 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0597]: `v` does not live long enough
|
||||
--> $DIR/borrowed-local-error.rs:22:9
|
||||
--> $DIR/borrowed-local-error.rs:20:9
|
||||
|
|
||||
LL | let x = gimme({
|
||||
| _____________-
|
||||
|
@ -10,6 +10,8 @@ LL | | //~^ cannot use `e` because it was mutably borrowed [E0503]
|
||||
LL | | Xyz::B => println!("b"),
|
||||
LL | | };
|
||||
| |_____^ use of borrowed `e`
|
||||
LL | *g = Xyz::B;
|
||||
| ----------- borrow later used here
|
||||
|
||||
error[E0503]: cannot use `e` because it was mutably borrowed
|
||||
--> $DIR/borrowed-match-issue-45045.rs:25:9
|
||||
@ -19,6 +21,9 @@ LL | let f = &mut e;
|
||||
...
|
||||
LL | Xyz::A => println!("a"),
|
||||
| ^^^^^^ use of borrowed `e`
|
||||
...
|
||||
LL | *g = Xyz::B;
|
||||
| ----------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -6,6 +6,9 @@ LL | let x = &mut block;
|
||||
LL | println!("{}", x.current);
|
||||
LL | let p: &'a u8 = &*block.current;
|
||||
| ^^^^^^^^^^^^^^^ immutable borrow occurs here
|
||||
LL | //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
|
||||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Znll-dump-cause
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
fn gimme(x: &(u32,)) -> &u32 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowed-temporary-error.rs:22:10
|
||||
--> $DIR/borrowed-temporary-error.rs:20:10
|
||||
|
|
||||
LL | &(v,)
|
||||
| ^^^^ temporary value does not live long enough
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Znll-dump-cause
|
||||
|
||||
#![feature(nll)]
|
||||
#![allow(warnings)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0597]: `v` does not live long enough
|
||||
--> $DIR/borrowed-universal-error-2.rs:18:5
|
||||
--> $DIR/borrowed-universal-error-2.rs:16:5
|
||||
|
|
||||
LL | &v
|
||||
| ^^ borrowed value does not live long enough
|
||||
@ -7,8 +7,8 @@ LL | //~^ ERROR `v` does not live long enough [E0597]
|
||||
LL | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:1...
|
||||
--> $DIR/borrowed-universal-error-2.rs:16:1
|
||||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
|
||||
--> $DIR/borrowed-universal-error-2.rs:14:1
|
||||
|
|
||||
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Znll-dump-cause
|
||||
|
||||
#![feature(nll)]
|
||||
#![allow(warnings)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowed-universal-error.rs:22:12
|
||||
--> $DIR/borrowed-universal-error.rs:20:12
|
||||
|
|
||||
LL | gimme(&(v,))
|
||||
| ^^^^ temporary value does not live long enough
|
||||
@ -7,8 +7,8 @@ LL | //~^ ERROR borrowed value does not live long enough [E0597]
|
||||
LL | }
|
||||
| - temporary value only lives until here
|
||||
|
|
||||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:1...
|
||||
--> $DIR/borrowed-universal-error.rs:20:1
|
||||
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:1...
|
||||
--> $DIR/borrowed-universal-error.rs:18:1
|
||||
|
|
||||
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll-dump-cause
|
||||
|
||||
// Test that a structure which tries to store a pointer to `y` into
|
||||
// `p` (indirectly) fails to compile.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/capture-ref-in-struct.rs:33:16
|
||||
--> $DIR/capture-ref-in-struct.rs:31:16
|
||||
|
|
||||
LL | y: &y,
|
||||
| ^^ borrowed value does not live long enough
|
||||
|
@ -22,7 +22,7 @@
|
||||
// basically checking that the MIR type checker correctly enforces the
|
||||
// closure signature.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
//
|
||||
// except that the closure does so via a second closure.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
// `'b`. This relationship is propagated to the closure creator,
|
||||
// which reports an error.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
// because of destructor. (Note that the stderr also identifies this
|
||||
// destructor in the error message.)
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause
|
||||
// compile-flags:-Znll -Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
|
@ -13,7 +13,7 @@
|
||||
// a variety of errors from the older, AST-based machinery (notably
|
||||
// borrowck), and then we get the NLL error at the end.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=compare -Znll-dump-cause
|
||||
// compile-flags:-Znll -Zborrowck=compare
|
||||
|
||||
struct Map {
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ LL | let t = &mut *s; // this borrow should last for the entire function
|
||||
LL | let x = &t.0;
|
||||
LL | *s = (2,); //~ ERROR cannot assign to `*s`
|
||||
| ^^^^^^^^^ assignment to borrowed `*s` occurs here
|
||||
LL | *x
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `s`
|
||||
--> $DIR/guarantor-issue-46974.rs:25:5
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll -Znll-dump-cause
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
|
||||
|
||||
|
||||
#![allow(warnings)]
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
@ -1,11 +1,16 @@
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/return-ref-mut-issue-46557.rs:17:21
|
||||
|
|
||||
LL | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
|
||||
| ^^^^^^^ temporary value does not live long enough
|
||||
LL | x
|
||||
LL | }
|
||||
| - temporary value only lives until here
|
||||
LL | fn gimme_static_mut() -> &'static mut u32 {
|
||||
| ___________________________________________-
|
||||
LL | | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
|
||||
| | ^^^^^^^ temporary value does not live long enough
|
||||
LL | | x
|
||||
LL | | }
|
||||
| | -
|
||||
| | |
|
||||
| |_temporary value only lives until here
|
||||
| borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user