diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2018-09-15 18:30:29 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2018-09-19 20:50:09 +0100 |
| commit | bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73 (patch) | |
| tree | 146b8e71049cc840d5a99f42d9f96da9882f53da /src/test/ui/regions | |
| parent | 994dc4bd1ef01b45408750679d9ec46bc1c2ff33 (diff) | |
| download | rust-bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73.tar.gz rust-bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73.zip | |
Update ui tests
Diffstat (limited to 'src/test/ui/regions')
8 files changed, 44 insertions, 34 deletions
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index e8c1d7e74a0..53d3b2d5323 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:18:33 + --> $DIR/region-object-lifetime-in-coercion.rs:18:9 | LL | fn a(v: &[u8]) -> Box<Foo + 'static> { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | let x: Box<Foo + 'static> = Box::new(v); - | ^^^^^^^^^^^ lifetime `'static` required + | ^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:24:5 diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr index a85822e48fa..0e38abef668 100644 --- a/src/test/ui/regions/regions-addr-of-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr @@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints LL | pub fn chase_cat(&mut self) { | - let's call the lifetime of this reference `'1` LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer - | ^ requires that `'1` must outlive `'static` + | ^ type annotation requires that `'1` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr index 9d6301af0fb..6e4bf26047e 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr @@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints LL | let _f = || { | -- lifetime `'1` represents this closure's body LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - | ^ requires that `'1` must outlive `'static` + | ^ type annotation requires that `'1` must outlive `'static` | = note: closure implements `FnMut`, so references to captured variables can't escape the closure @@ -16,17 +16,21 @@ LL | pub fn chase_cat(&mut self) { LL | let _f = || { | -- lifetime `'1` represents this closure's body LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer - | ^ requires that `'1` must outlive `'2` + | ^ type annotation requires that `'1` must outlive `'2` | = note: closure implements `FnMut`, so references to captured variables can't escape the closure error: unsatisfied lifetime constraints - --> $DIR/regions-addr-of-upvar-self.rs:19:13 + --> $DIR/regions-addr-of-upvar-self.rs:19:18 | -LL | pub fn chase_cat(&mut self) { - | - let's call the lifetime of this reference `'1` -LL | let _f = || { - | ^^ requires that `'1` must outlive `'static` +LL | pub fn chase_cat(&mut self) { + | - let's call the lifetime of this reference `'1` +LL | let _f = || { + | __________________^ +LL | | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | | *p = 3; +LL | | }; + | |_________^ closure body requires that `'1` must outlive `'static` error[E0597]: `self` does not live long enough --> $DIR/regions-addr-of-upvar-self.rs:20:46 diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index e619431ddbb..c073e3728e7 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,10 +1,10 @@ error: unsatisfied lifetime constraints - --> $DIR/regions-close-object-into-object-2.rs:20:11 + --> $DIR/regions-close-object-into-object-2.rs:20:5 | LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> { | -- lifetime `'a` defined here LL | box B(&*v) as Box<X> //~ ERROR cannot infer - | ^^^ cast requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-2.rs:20:11 diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 1de1cdc9807..4b47b951d77 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -6,6 +6,14 @@ LL | box B(&*v) as Box<X> //~ ERROR cannot infer | = help: consider adding an explicit lifetime bound `U: 'static`... +error: unsatisfied lifetime constraints + --> $DIR/regions-close-object-into-object-4.rs:20:5 + | +LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> { + | -- lifetime `'a` defined here +LL | box B(&*v) as Box<X> //~ ERROR cannot infer + | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + error[E0310]: the parameter type `U` may not live long enough --> $DIR/regions-close-object-into-object-4.rs:20:9 | @@ -14,14 +22,6 @@ LL | box B(&*v) as Box<X> //~ ERROR cannot infer | = help: consider adding an explicit lifetime bound `U: 'static`... -error: unsatisfied lifetime constraints - --> $DIR/regions-close-object-into-object-4.rs:20:11 - | -LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> { - | -- lifetime `'a` defined here -LL | box B(&*v) as Box<X> //~ ERROR cannot infer - | ^^^ cast requires that `'a` must outlive `'static` - error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-4.rs:20:11 | diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr index 98a4dc29ae7..d0606295713 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr @@ -18,7 +18,7 @@ LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | lifetime `'a` defined here LL | // Do not infer an ordering from the return value. LL | let z: &'b usize = &*x; - | ^^^ requires that `'a` must outlive `'b` + | ^^^ assignment requires that `'a` must outlive `'b` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index 9e6c57f6733..4bb602d572f 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -1,22 +1,14 @@ -error: unsatisfied lifetime constraints +error: borrowed data escapes outside of closure --> $DIR/regions-nested-fns.rs:20:9 | LL | let mut ay = &y; //~ ERROR E0495 - | ------ lifetime `'2` appears in the type of `ay` + | ------ `ay` is declared here, outside of the closure body LL | LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| { - | - has type `&'1 isize` + | - `z` is a reference that is only valid in the closure body ... LL | ay = z; - | ^^^^^^ requires that `'1` must outlive `'2` - -error: unsatisfied lifetime constraints - --> $DIR/regions-nested-fns.rs:14:9 - | -LL | fn nested<'x>(x: &'x isize) { - | -- lifetime `'x` defined here -LL | let y = 3; - | ^ requires that `'x` must outlive `'static` + | ^^^^^^ `z` escapes the closure body here error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:15:18 @@ -43,6 +35,20 @@ LL | } | = note: borrowed value must be valid for the static lifetime... +error: unsatisfied lifetime constraints + --> $DIR/regions-nested-fns.rs:23:68 + | +LL | fn nested<'x>(x: &'x isize) { + | -- lifetime `'x` defined here +... +LL | ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ____________________________________________________________________^ +LL | | if false { return x; } //~ ERROR E0312 +LL | | if false { return ay; } +LL | | return z; +LL | | })); + | |_____^ closure body requires that `'x` must outlive `'static` + error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index d4140242c01..0a9bcee1ce2 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -7,7 +7,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { | lifetime `'a` defined here LL | // Without knowing 'a:'b, we can't coerce LL | x //~ ERROR lifetime bound not satisfied - | ^ returning this value requires that `'a` must outlive `'b` + | ^ cast requires that `'a` must outlive `'b` error: unsatisfied lifetime constraints --> $DIR/regions-trait-object-subtyping.rs:32:5 |
