"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],
*(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
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
.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(),
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.
pub(super) fn new(
elements: &Rc<RegionValueElements>,
num_region_variables: usize,
- track_causes: TrackCauses,
) -> Self {
assert!(
elements.num_universal_regions <= num_region_variables,
RegionVid::new(num_region_variables),
RegionElementIndex::new(elements.num_elements()),
),
- causes: if track_causes.0 {
- Some(CauseMap::default())
- } else {
- None
- },
+ causes: Some(CauseMap::default()),
}
}
...
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
| ------ 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
// 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 {
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({
| _____________-
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
...
LL | Xyz::A => println!("a"),
| ^^^^^^ use of borrowed `e`
+...
+LL | *g = Xyz::B;
+ | ----------- borrow later used here
error: aborting due to 2 previous errors
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
// 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 {
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
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: -Znll-dump-cause
-
#![feature(nll)]
#![allow(warnings)]
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
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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: -Znll-dump-cause
-
#![feature(nll)]
#![allow(warnings)]
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
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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 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.
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
// 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)]
//
// 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)]
// `'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)]
// 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)]
// 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 {
}
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
// 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)]
// 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)]
// 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)]
// 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)]
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