diff options
Diffstat (limited to 'src/test/ui/dropck')
| -rw-r--r-- | src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr | 18 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr) | 2 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch-extern-crate.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch-reorder.stderr) | 2 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch-reorder.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch.stderr) | 2 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck-eyepatch.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr | 29 |
8 files changed, 83 insertions, 75 deletions
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr index 4f792a9c9d2..6200ec3722c 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr @@ -1,18 +1,12 @@ -error[E0597]: `raw_lines` does not live long enough +error[E0515]: cannot return value referencing local variable `raw_lines` --> $DIR/drop-with-active-borrows-2.rs:13:5 | LL | raw_lines.iter().map(|l| l.trim()).collect() - | ^^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `raw_lines` does not live long enough -LL | } - | - `raw_lines` dropped here while still borrowed - | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24... - --> $DIR/drop-with-active-borrows-2.rs:11:24 - | -LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> { - | ^^ + | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `raw_lines` is borrowed here error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr index 35db46f4fae..31adb2f3f14 100644 --- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr @@ -32,7 +32,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c_shortest` does not live long enough - --> $DIR/dropck-eyepatch-extern-crate.rs:49:20 + --> $DIR/dropck-eyepatch-extern-crate.rs:50:20 | LL | dr = Dr("dr", &c_shortest); | ^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs index 3e531d9fd60..68065639398 100644 --- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs +++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs @@ -1,12 +1,12 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// The behavior of AST-borrowck and NLL explcitly differ here due to +// NLL's increased precision; so we use revisions and do not worry +// about the --compare-mode=nll on this test. + +// revisions: ast nll +//[ast]compile-flags: -Z borrowck=ast +//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows + +// ignore-compare-mode-nll // aux-build:dropck_eyepatch_extern_crate.rs @@ -39,29 +39,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855 // Error: destructor order imprecisely modelled dt = Dt("dt", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough dr = Dr("dr", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough // Error: `c_shortest` dies too soon for the references in dtors to be valid. dt = Dt("dt", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough + //[nll]~^^ ERROR `c_shortest` does not live long enough dr = Dr("dr", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough - + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c_shortest, &c_long); pr = Pr("pr", &c_shortest, &c_long); // Error: Drop impl's assertion does not apply to `B` nor `&'b _` pt = Pt("pt", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough pr = Pr("pr", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c_shortest); sr = Sr("sr", &c_shortest); println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1); } + +fn use_imm<T>(_: &T) { } diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr index 9984a7b9409..ddd47e97434 100644 --- a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr @@ -32,7 +32,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c_shortest` does not live long enough - --> $DIR/dropck-eyepatch-reorder.rs:66:20 + --> $DIR/dropck-eyepatch-reorder.rs:67:20 | LL | dr = Dr("dr", &c_shortest); | ^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.rs b/src/test/ui/dropck/dropck-eyepatch-reorder.rs index 1806dc71424..16aaa261257 100644 --- a/src/test/ui/dropck/dropck-eyepatch-reorder.rs +++ b/src/test/ui/dropck/dropck-eyepatch-reorder.rs @@ -1,12 +1,12 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// The behavior of AST-borrowck and NLL explcitly differ here due to +// NLL's increased precision; so we use revisions and do not worry +// about the --compare-mode=nll on this test. + +// revisions: ast nll +//[ast]compile-flags: -Z borrowck=ast +//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows + +// ignore-compare-mode-nll #![feature(dropck_eyepatch, rustc_attrs)] @@ -56,29 +56,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855 // Error: destructor order imprecisely modelled dt = Dt("dt", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough dr = Dr("dr", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough // Error: `c_shortest` dies too soon for the references in dtors to be valid. dt = Dt("dt", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough + //[nll]~^^ ERROR `c_shortest` does not live long enough dr = Dr("dr", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough - + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c_shortest, &c_long); pr = Pr("pr", &c_shortest, &c_long); // Error: Drop impl's assertion does not apply to `B` nor `&'b _` pt = Pt("pt", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough pr = Pr("pr", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c_shortest); sr = Sr("sr", &c_shortest); println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1); } + +fn use_imm<T>(_: &T) { } diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.ast.stderr index 7cdf645941d..0952ed0d6b7 100644 --- a/src/test/ui/dropck/dropck-eyepatch.stderr +++ b/src/test/ui/dropck/dropck-eyepatch.ast.stderr @@ -32,7 +32,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c_shortest` does not live long enough - --> $DIR/dropck-eyepatch.rs:89:20 + --> $DIR/dropck-eyepatch.rs:90:20 | LL | dr = Dr("dr", &c_shortest); | ^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/dropck/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs index 40d3ff050e2..d7a671fd33c 100644 --- a/src/test/ui/dropck/dropck-eyepatch.rs +++ b/src/test/ui/dropck/dropck-eyepatch.rs @@ -1,12 +1,12 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// The behavior of AST-borrowck and NLL explcitly differ here due to +// NLL's increased precision; so we use revisions and do not worry +// about the --compare-mode=nll on this test. + +// revisions: ast nll +//[ast]compile-flags: -Z borrowck=ast +//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows + +// ignore-compare-mode-nll #![feature(dropck_eyepatch, rustc_attrs)] @@ -79,16 +79,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855 // Error: destructor order imprecisely modelled dt = Dt("dt", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough dr = Dr("dr", &c); - //~^ ERROR `c` does not live long enough + //[ast]~^ ERROR `c` does not live long enough // Error: `c_shortest` dies too soon for the references in dtors to be valid. dt = Dt("dt", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough + //[nll]~^^ ERROR `c_shortest` does not live long enough dr = Dr("dr", &c_shortest); - //~^ ERROR `c_shortest` does not live long enough - + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c_shortest, &c_long); @@ -96,13 +96,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855 // Error: Drop impl's assertion does not apply to `B` nor `&'b _` pt = Pt("pt", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough pr = Pr("pr", &c_long, &c_shortest); - //~^ ERROR `c_shortest` does not live long enough + //[ast]~^ ERROR `c_shortest` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c_shortest); sr = Sr("sr", &c_shortest); println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1); } + +fn use_imm<T>(_: &T) { } diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr index a47229cdca0..d4b74841b0d 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr @@ -1,67 +1,72 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:121:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough | ^^^ borrowed value does not live long enough ... LL | } | - `o2` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:122:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` +LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough | ^^^ borrowed value does not live long enough ... LL | } | - `o3` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:123:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` +... LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough | ^^^ borrowed value does not live long enough ... LL | } | - `o2` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:124:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` +... LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough | ^^^ borrowed value does not live long enough ... LL | } | - `o3` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:125:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o1` is borrowed for `'static` +... LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough | ^^^ borrowed value does not live long enough LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough LL | } | - `o1` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:126:13 | +LL | let (o1, o2, o3): (Box<Obj>, Box<Obj>, Box<Obj>) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` +... LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough | ^^^ borrowed value does not live long enough LL | } | - `o2` dropped here while still borrowed - | - = note: borrowed value must be valid for the static lifetime... error: aborting due to 6 previous errors |
