Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Oct 27, 2019
1 parent 0026e3e commit cba0761
Show file tree
Hide file tree
Showing 134 changed files with 409 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
...
LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
| ^^^^^ type annotation requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime may not live long enough
--> $DIR/implied-region-constraints.rs:40:64
Expand All @@ -19,6 +21,8 @@ LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
...
LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x;
| ^^^^^ type annotation requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime may not live long enough
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
Expand All @@ -19,6 +21,10 @@ LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
...
LL | let z: I::A = if cond { x } else { y };
| ^ assignment requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

help: `'a` and `'b` must be the same: replace one with the other

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
...
LL | let a: <T as Trait<'a>>::Type = make_any();
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: lifetime may not live long enough
--> $DIR/associated-types-subtyping-1.rs:35:13
Expand All @@ -19,6 +21,8 @@ LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
...
LL | let _c: <T as Trait<'a>>::Type = b;
| ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-contravariant.rs:45:4
Expand All @@ -19,6 +21,10 @@ LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
= help: consider adding the following bound: `'b: 'a`

help: `'a` and `'b` must be the same: replace one with the other

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:55:4
Expand All @@ -19,6 +21,10 @@ LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
...
LL | (a, b)
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
= help: consider adding the following bound: `'b: 'a`

help: `'a` and `'b` must be the same: replace one with the other

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
LL | let a = bar(f, x);
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant.rs:39:12
Expand All @@ -19,6 +21,10 @@ LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
...
LL | let b = bar(f, y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

help: `'a` and `'b` must be the same: replace one with the other

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
...
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ LL | |
LL | | (a, b)
LL | | }
| |_^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
| lifetime `'a` defined here
LL | S { pointer: &mut *p.pointer }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
= help: consider adding the following bound: `'a: 'b`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ LL | fn expect_bound_supply_named<'x>() {
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`

error: aborting due to 4 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ LL | gimme::<$t2>(None::<$t1>);
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`

error: lifetime may not live long enough
--> $DIR/hr-subtype.rs:39:13
Expand All @@ -25,6 +27,8 @@ LL | gimme::<$t1>(None::<$t2>);
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
LL | | fn(Inv<'y>)) }
| |__________________________________________________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`

error: aborting due to 2 previous errors

2 changes: 2 additions & 0 deletions src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ LL | gimme::<$t1>(None::<$t2>);
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
LL | | fn(&'y u32)) }
| |__________________________________________- in this macro invocation
|
= help: consider adding the following bound: `'x: 'y`

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
...
LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
|
= help: consider replacing `'b` with `'static`

warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:49:1
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| - `x` is a reference that is only valid in the function body
LL | static_val(x);
| ^^^^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ error: lifetime may not live long enough
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
| -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | type E<'a, 'b> = impl Sized; + 'a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| |
| lifetime `'a` defined here
|
= help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
Expand All @@ -31,6 +32,7 @@ LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`
= help: consider replacing `'a` with `'static`

error: lifetime may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:17:61
Expand All @@ -39,6 +41,8 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
| -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
| |
| lifetime `'a` defined here
|
= help: consider adding the following bound: `'b: 'a`

error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:22:51
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| |
| lifetime `'a` defined here
|
= help: consider replacing `'a` with `'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
2 changes: 2 additions & 0 deletions src/test/ui/in-band-lifetimes/mismatched.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
| | |
| | lifetime `'b` defined here
| lifetime `'a` defined here
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to 2 previous errors

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-10291.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | fn test<'x>(x: &'x isize) {
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
LL | x
| ^ returning this value requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-26217.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LL | fn bar<'a>() {
| -- lifetime `'a` defined here
LL | foo::<&'a i32>();
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-28848.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
| lifetime `'a` defined here
LL | Foo::<'a, 'b>::xmute(u)
| ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-52213.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
LL | match (&t,) {
LL | ((u,),) => u,
| ^ returning this value requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-54943.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | fn boo<'a>() {
...
LL | let x = foo::<&'a u32>();
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: aborting due to previous error

4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-55796.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | pub trait Graph<'a> {
...
LL | Box::new(self.out_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: lifetime may not live long enough
--> $DIR/issue-55796.rs:21:9
Expand All @@ -15,6 +17,8 @@ LL | pub trait Graph<'a> {
...
LL | Box::new(self.in_edges(u).map(|e| e.target()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= help: consider replacing `'a` with `'static`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LL | fn test2<'a>(x: &'a Box<dyn Fn() + 'a>) {
LL | // but ref_obj will not, so warn.
LL | ref_obj(x)
| ^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`

error[E0521]: borrowed data escapes outside of function
--> $DIR/lifetime-bound-will-change-warning.rs:39:5
Expand All @@ -15,6 +17,8 @@ LL | fn test2cc<'a>(x: &'a Box<dyn Fn() + 'a>) {
LL | // same as test2, but cross crate
LL | lib::ref_obj(x)
| ^^^^^^^^^^^^^^^ `x` escapes the function body here
|
= help: consider replacing `'a` with `'static`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
LL | let z = Ref { data: y.data };
LL | x.push(z);
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
|
= help: consider adding the following bound: `'c: 'b`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
...
LL | a.push(b);
| ^^^^^^^^^ argument requires that `'c` must outlive `'b`
|
= help: consider adding the following bound: `'c: 'b`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
...
LL | Vec::push(a, b);
| ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b`
|
= help: consider adding the following bound: `'c: 'b`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
...
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
| lifetime `'a` defined here
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
| lifetime `'a` defined here
LL | x.push(y);
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`

error: aborting due to previous error

Loading

0 comments on commit cba0761

Please sign in to comment.