Update tests

This commit is contained in:
Matthew Jasper 2018-08-07 21:48:50 +01:00
parent 372e4aee1d
commit 371c23fe34
33 changed files with 63 additions and 65 deletions

View File

@ -5,10 +5,10 @@ LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
| ^^^^^^
error: unsatisfied lifetime constraints
--> $DIR/E0621-does-not-trigger-for-closures.rs:25:26
--> $DIR/E0621-does-not-trigger-for-closures.rs:25:45
|
LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
| -- ^^^^^ requires that `'1` must outlive `'2`
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is &'2 i32
| has type `&'1 i32`

View File

@ -22,7 +22,7 @@ error: unsatisfied lifetime constraints
--> $DIR/mismatched.rs:16:46
|
LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
| -- -- ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
| -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
| | |
| | lifetime `'b` defined here
| lifetime `'a` defined here

View File

@ -5,12 +5,12 @@ LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of
| ^
error[E0621]: explicit lifetime required in the type of `a`
--> $DIR/issue-14285.rs:22:7
--> $DIR/issue-14285.rs:22:5
|
LL | fn foo<'a>(a: &Foo) -> B<'a> {
| ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)`
LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
| ^ lifetime `'a` required
| ^^^^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,12 +5,12 @@ LL | Parser { lexer: lexer }
| ^^^^^^
error[E0621]: explicit lifetime required in the type of `lexer`
--> $DIR/issue-15034.rs:27:25
--> $DIR/issue-15034.rs:27:9
|
LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
| ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
LL | Parser { lexer: lexer }
| ^^^^^ lifetime `'a` required
| ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error

View File

@ -11,12 +11,12 @@ LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the
| ^^^^^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/issue-3154.rs:16:15
--> $DIR/issue-3154.rs:16:5
|
LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
| -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q`
LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
| ^ lifetime `'a` required
| ^^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to previous error

View File

@ -7,7 +7,7 @@ LL | || {
| |return type of closure is &'2 mut std::boxed::Box<()>
| lifetime `'1` represents this closure's body
LL | &mut x
| ^^^^^^ return requires that `'1` must outlive `'2`
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
|
= note: closure implements `FnMut`, so references to captured variables can't escape the closure

View File

@ -9,7 +9,7 @@ LL | || {
LL | / || {
LL | | x.push(())
LL | | }
| |_________^ requires that `'1` must outlive `'2`
| |_________^ returning this value requires that `'1` must outlive `'2`
|
= note: closure implements `FnMut`, so references to captured variables can't escape the closure

View File

@ -9,7 +9,7 @@ LL | || {
LL | / || {
LL | | let _y = &mut x;
LL | | }
| |_________^ requires that `'1` must outlive `'2`
| |_________^ returning this value requires that `'1` must outlive `'2`
|
= note: closure implements `FnMut`, so references to captured variables can't escape the closure

View File

@ -5,7 +5,7 @@ LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
| ^^^^^
error: unsatisfied lifetime constraints
--> $DIR/issue-52213.rs:13:11
--> $DIR/issue-52213.rs:13:20
|
LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| -- -- lifetime `'b` defined here
@ -13,7 +13,7 @@ LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
| lifetime `'a` defined here
LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
LL | ((u,),) => u,
| ^ requires that `'a` must outlive `'b`
| ^ returning this value requires that `'a` must outlive `'b`
error: aborting due to previous error

View File

@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
--> $DIR/issue-52533-1.rs:19:18
|
LL | gimme(|x, y| y)
| - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&Foo<'_, '1, u32>`
| has type `&Foo<'_, '2, u32>`

View File

@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
--> $DIR/issue-52533.rs:15:16
|
LL | foo(|a, b| b)
| - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 u32`
| has type `&'2 u32`

View File

@ -5,17 +5,13 @@ LL | &*x //~ ERROR explicit lifetime
| ^^^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/42701_one_named_and_one_anonymous.rs:16:5
--> $DIR/42701_one_named_and_one_anonymous.rs:20:9
|
LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
LL | / if true {
LL | | let p: &i32 = &a.field;
LL | | &*p
LL | | } else {
LL | | &*x //~ ERROR explicit lifetime
LL | | }
| |_____^ lifetime `'a` required
LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
...
LL | &*x //~ ERROR explicit lifetime
| ^^^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,12 +5,13 @@ LL | other //~ ERROR explicit lifetime
| ^^^^^
error[E0621]: explicit lifetime required in the type of `other`
--> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:18:15
--> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21
|
LL | fn bar(&self, other: Foo) -> Foo<'a> {
| --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>`
LL | match *self {
| ^^^^^ lifetime `'a` required
...
LL | other //~ ERROR explicit lifetime
| ^^^^^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,12 +5,12 @@ LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:8
--> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^^^^^ lifetime `'a` required
| ^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,12 +5,12 @@ LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^
error[E0621]: explicit lifetime required in parameter type
--> $DIR/ex1-return-one-existing-name-if-else-3.rs:11:16
--> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27
|
LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 {
| ^ --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)`
| |
| lifetime `'a` required
| --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)`
LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,12 +5,12 @@ LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:7
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^^^^^ lifetime `'a` required
| ^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,13 +5,13 @@ LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
| ^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:5
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36
|
LL | fn foo<'a>(&'a self, x: &i32) -> &i32 {
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
LL |
LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
| ^ lifetime `'a` required
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
| ^
error: unsatisfied lifetime constraints
--> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:12
--> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20
|
LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| -- - let's call the lifetime of this reference `'1`
@ -13,7 +13,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| lifetime `'a` defined here
LL |
LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
| ^^^^^ requires that `'1` must outlive `'a`
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -5,12 +5,12 @@ LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/ex1-return-one-existing-name-if-else.rs:12:8
--> $DIR/ex1-return-one-existing-name-if-else.rs:12:27
|
LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
| ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32`
LL | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^^^^^ lifetime `'a` required
| ^ lifetime `'a` required
error: aborting due to previous error

View File

@ -13,7 +13,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
| lifetime `'a` defined here
LL |
LL | x //~ ERROR lifetime mismatch
| ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
| ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | if true { x } else { self } //~ ERROR lifetime mismatch
| ^^^^
error: unsatisfied lifetime constraints
--> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:9
--> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
|
LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
| -- - let's call the lifetime of this reference `'1`
@ -13,7 +13,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
| lifetime `'a` defined here
LL |
LL | if true { x } else { self } //~ ERROR lifetime mismatch
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'a`
| ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -12,7 +12,7 @@ LL | fn foo<'a>(&self, x: &i32) -> &i32 {
| |
| let's call the lifetime of this reference `'2`
LL | x //~ ERROR lifetime mismatch
| ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -5,14 +5,14 @@ LL | if true { x } else { self } //~ ERROR lifetime mismatch
| ^
error: unsatisfied lifetime constraints
--> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:9
--> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19
|
LL | fn foo<'a>(&self, x: &Foo) -> &Foo {
| - - let's call the lifetime of this reference `'1`
| |
| let's call the lifetime of this reference `'2`
LL | if true { x } else { self } //~ ERROR lifetime mismatch
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'2`
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: aborting due to previous error

View File

@ -10,7 +10,7 @@ error: unsatisfied lifetime constraints
LL | fn foo<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | &*x
| ^^^ requires that `'a` must outlive `'static`
| ^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View File

@ -12,7 +12,7 @@ LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
| |
| lifetime `'a` defined here
LL | &*x
| ^^^ requires that `'a` must outlive `'b`
| ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to previous error

View File

@ -19,7 +19,7 @@ error: unsatisfied lifetime constraints
--> $DIR/return-wrong-bound-region.rs:21:23
|
LL | expect_sig(|a, b| b); // ought to return `a`
| - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
| - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 i32`
| has type `&'2 i32`

View File

@ -2,7 +2,7 @@ error: unsatisfied lifetime constraints
--> $DIR/issue-48238.rs:21:13
|
LL | move || use_val(&orig); //~ ERROR
| ------- ^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
| ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure is &'2 u8
| lifetime `'1` represents this closure's body

View File

@ -14,9 +14,9 @@
fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
let g: fn(_, _) -> _ = |_x, y| y;
//~^ ERROR unsatisfied lifetime constraints
g
//~^ WARNING not reporting region error due to nll
//~^^ ERROR unsatisfied lifetime constraints
}
fn main() {}

View File

@ -1,18 +1,19 @@
warning: not reporting region error due to nll
--> $DIR/mir_check_cast_closure.rs:18:5
--> $DIR/mir_check_cast_closure.rs:17:5
|
LL | g
| ^
error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_closure.rs:16:28
--> $DIR/mir_check_cast_closure.rs:17:5
|
LL | fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let g: fn(_, _) -> _ = |_x, y| y;
| ^^^^^^^^^ cast requires that `'b` must outlive `'a`
LL | g
| ^ returning this value requires that `'b` must outlive `'a`
error: aborting due to previous error

View File

@ -4,14 +4,14 @@ warning: not reporting region error due to nll
LL | let f: fn(_) -> _ = foo;
| ^^^
error: borrowed data escapes outside of function
error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_reify.rs:48:5
|
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
| - `x` is a reference that is only valid in the function body
| -- lifetime `'a` defined here
...
LL | f(x)
| ^^^^ `x` escapes the function body here
| ^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View File

@ -4,14 +4,14 @@ warning: not reporting region error due to nll
LL | let g: unsafe fn(_) -> _ = f;
| ^
error: borrowed data escapes outside of function
error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_unsafe_fn.rs:20:14
|
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
| ----- `input` is a reference that is only valid in the function body
| -- lifetime `'a` defined here
...
LL | unsafe { g(input) }
| ^^^^^^^^ `input` escapes the function body here
| ^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View File

@ -15,7 +15,7 @@ LL | | //~^ ERROR unsatisfied lifetime constraints
LL | | x
LL | | //~^ WARNING not reporting region error due to nll
LL | | }
| |_^ return requires that `'a` must outlive `'static`
| |_^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error

View File

@ -32,7 +32,7 @@ LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
LL | | }
| |_^ return requires that `'1` must outlive `'static`
| |_^ returning this value requires that `'1` must outlive `'static`
error: aborting due to previous error