Skip to content

Commit

Permalink
Update ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Sep 19, 2018
1 parent 994dc4b commit bd0895d
Show file tree
Hide file tree
Showing 51 changed files with 205 additions and 174 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:53:12
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let a = bar(foo, y);
| ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
...
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`

error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-contravariant.rs:54:12
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let a = bar(foo, y);
LL | let b = bar(foo, x);
| ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
...
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| |
| lifetime `'a` defined here
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ 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 2 previous errors

Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:63:12
--> $DIR/project-fn-ret-invariant.rs:65:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
| ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
...
LL | (a, b) //[krisskross]~ ERROR E0623
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`

error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:64:12
--> $DIR/project-fn-ret-invariant.rs:65:4
|
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
LL | let b = bar(foo, x);
| ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
...
LL | (a, b) //[krisskross]~ ERROR E0623
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: unsatisfied lifetime constraints
--> $DIR/project-fn-ret-invariant.rs:58:13
--> $DIR/project-fn-ret-invariant.rs:58:4
|
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | bar(foo, x) //[transmute]~ ERROR E0495
| ^ 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 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ LL | move |_| println!("{}", y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`

error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:34:5
--> $DIR/must_outlive_least_region_or_bound.rs:32:51
|
LL | x
| ^
LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| - let's call the lifetime of this reference `'1`
LL | self.x.iter().map(|a| a.0)
| ^^^^^^ cast requires that `'1` must outlive `'static`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
Expand All @@ -16,7 +16,7 @@ error: unsatisfied lifetime constraints
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -- lifetime `'a` defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^ cast requires that `'a` must outlive `'static`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/impl-trait/type_parameters_captured.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:19:5
--> $DIR/type_parameters_captured.rs:17:20
|
LL | x
| ^
LL | fn foo<T>(x: T) -> impl Any + 'static {
| ^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...

Expand Down
13 changes: 8 additions & 5 deletions src/test/ui/issues/issue-10291.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-10291.rs:12:5
--> $DIR/issue-10291.rs:12:65
|
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'x` must outlive `'static`
LL | fn test<'x>(x: &'x isize) {
| -- lifetime `'x` defined here
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
| _________________________________________________________________^
LL | | x //~ ERROR E0312
LL | | }));
| |_____^ closure body requires that `'x` must outlive `'static`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
| |
| let's call the lifetime of this reference `'2`
LL | *v = x; //~ ERROR lifetime mismatch
| ^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: Ref) {
| |
| has type `Ref<'_, '2>`
LL | x.b = y.b; //~ ERROR lifetime mismatch
| ^^^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | fn foo(mut x: Ref) {
| has type `Ref<'_, '1>`
| has type `Ref<'2, '_>`
LL | x.a = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | fn foo(mut x: Ref) {
| has type `Ref<'_, '1>`
| has type `Ref<'2, '_>`
LL | x.a = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: &u32) {
| |
| has type `Ref<'_, '1>`
LL | y = x.b; //~ ERROR lifetime mismatch
| ^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^ assignment requires that `'1` must outlive `'2`

error[E0384]: cannot assign to immutable argument `y`
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(mut y: Ref, x: &u32) {
| |
| has type `Ref<'_, '2>`
LL | y.b = x; //~ ERROR lifetime mismatch
| ^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(mut y: Ref, x: &u32) {
| |
| has type `Ref<'_, '2>`
LL | y.b = x; //~ ERROR lifetime mismatch
| ^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: &u32) {
| |
| has type `Ref<'_, '2>`
LL | x.b = y; //~ ERROR lifetime mismatch
| ^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ error: unsatisfied lifetime constraints
--> $DIR/escape-argument-callee.rs:36:45
|
LL | let mut closure = expect_sig(|p, y| *p = y);
| - - ^^^^^^ requires that `'1` must outlive `'2`
| - - ^^^^^^ assignment requires that `'1` must outlive `'2`
| | |
| | has type `&'1 i32`
| has type `&mut &'2 i32`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ LL | | }
= note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs []

error: unsatisfied lifetime constraints
--> $DIR/propagate-approximated-ref.rs:53:5
--> $DIR/propagate-approximated-ref.rs:53:47
|
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| _______________________________________________^
LL | | //~^ ERROR unsatisfied lifetime constraints
LL | |
LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | });
| |______^ argument requires that `'a` must outlive `'b`
| |_____^ closure body requires that `'a` must outlive `'b`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ LL | | });
| |______^ `cell_a` escapes the function body here

error: unsatisfied lifetime constraints
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:29
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47
|
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| ^^^^^^^ requires that `'a` must outlive `'b`
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| _______________________________________________^
LL | | //~^ ERROR borrowed data escapes outside of function
LL | | //~| ERROR unsatisfied lifetime constraints
LL | |
LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | });
| |_____^ closure body requires that `'a` must outlive `'b`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ LL | | });
| |______^ `cell_a` escapes the function body here

error: unsatisfied lifetime constraints
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:29
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47
|
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| ^^^^^^^ requires that `'a` must outlive `'b`
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| _______________________________________________^
LL | | //~^ ERROR borrowed data escapes outside of function
LL | | //~| ERROR unsatisfied lifetime constraints
LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | });
| |_____^ closure body requires that `'a` must outlive `'b`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ LL | | }
= note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs []

error: unsatisfied lifetime constraints
--> $DIR/propagate-approximated-val.rs:46:5
--> $DIR/propagate-approximated-val.rs:46:45
|
LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | / establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
| _____________________________________________^
LL | | //~^ ERROR unsatisfied lifetime constraints
LL | |
LL | | // Only works if 'x: 'y:
LL | | demand_y(outlives1, outlives2, x.get())
LL | | });
| |______^ argument requires that `'a` must outlive `'b`
| |_____^ closure body requires that `'a` must outlive `'b`

error: aborting due to previous error

6 changes: 3 additions & 3 deletions src/test/ui/nll/issue-50716.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: borrowed data escapes outside of function
error: unsatisfied lifetime constraints
--> $DIR/issue-50716.rs:25:14
|
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| - `s` is a reference that is only valid in the function body
| -- lifetime `'a` defined here
...
LL | let _x = *s; //~ ERROR
| ^^ `s` escapes the function body here
| ^^ proving this value is `Sized` requires that `'a` must outlive `'static`

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/nll/issue-52113.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazi
}

fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
let x = move || { //~ ERROR unsatisfied lifetime constraints
let x = move || {
let value: &'a u32 = value;
data.push(value);
};
x
x //~ ERROR unsatisfied lifetime constraints
}

fn main() { }
7 changes: 4 additions & 3 deletions src/test/ui/nll/issue-52113.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
error: unsatisfied lifetime constraints
--> $DIR/issue-52113.rs:43:9
--> $DIR/issue-52113.rs:47:5
|
LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let x = move || { //~ ERROR unsatisfied lifetime constraints
| ^ requires that `'a` must outlive `'b`
...
LL | x //~ ERROR unsatisfied lifetime constraints
| ^ returning this value requires that `'a` must outlive `'b`

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-52742.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn take_bar(&mut self, b: Bar<'_>) {
| |
| has type `&mut Foo<'_, '2>`
LL | self.y = b.z
| ^^^^^^^^^^^^ requires that `'1` must outlive `'2`
| ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`

error: aborting due to previous error

Loading

0 comments on commit bd0895d

Please sign in to comment.