diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2019-10-27 09:39:14 -0500 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2019-10-27 09:39:14 -0500 |
| commit | cba0761e5f3677b90390fe7aee1eeda684296658 (patch) | |
| tree | 4e6b766a90713c6b02d2c744088fdb87724e6661 /src/test/ui | |
| parent | 0026e3ec3f7945aa99b5c1ba7c1bed1a5d6bacf3 (diff) | |
| download | rust-cba0761e5f3677b90390fe7aee1eeda684296658.tar.gz rust-cba0761e5f3677b90390fe7aee1eeda684296658.zip | |
update tests
Diffstat (limited to 'src/test/ui')
134 files changed, 409 insertions, 207 deletions
diff --git a/src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr b/src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr index 32d099fce75..b8c54b13d8b 100644 --- a/src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr +++ b/src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr index ca99304f9b4..e12d42e5ed0 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr index d8506b9c8c8..11d3cfe5b46 100644 --- a/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr +++ b/src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr index 779e6dac92e..a5b6d640391 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr index f532c96ed2c..558f394ef86 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr index c45082fb053..71a533a36f4 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr index 2c11e7ffe93..c39030fbed1 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr index 8be0ad6e88f..f74d4ba73bf 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr @@ -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 diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr index b4d5d3ec051..53b0dd691b8 100644 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr +++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr @@ -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 diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr index e6d0f88e3ea..f28c42ce2d5 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr @@ -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 diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr index bbf75302d56..f816f27a892 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr @@ -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 diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr index 070fe12a284..9b0c987c054 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr index e140eaadd48..48558fad005 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr @@ -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 diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr index 6d1ef24b2dc..f1647d3d2e4 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr @@ -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 diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr index da30997a231..8e660d6814c 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr @@ -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 diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr index 82e280b9fb2..45c5142d93f 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr @@ -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 diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr index 097f003575e..bb5a85aba97 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr @@ -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 } @@ -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 @@ -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 diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr index 423cfcc4989..22f081b79f1 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr @@ -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 { diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr index f5aee2d2d7e..db028e63a82 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr index a7b827d27a8..1ebb0c6cf1e 100644 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr index c7601caacdc..83f10c67d43 100644 --- a/src/test/ui/issues/issue-26217.nll.stderr +++ b/src/test/ui/issues/issue-26217.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-28848.nll.stderr b/src/test/ui/issues/issue-28848.nll.stderr index 5cf9856e4dc..a29dac4c9c8 100644 --- a/src/test/ui/issues/issue-28848.nll.stderr +++ b/src/test/ui/issues/issue-28848.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr index eba875de215..359f91309d4 100644 --- a/src/test/ui/issues/issue-52213.nll.stderr +++ b/src/test/ui/issues/issue-52213.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-54943.nll.stderr b/src/test/ui/issues/issue-54943.nll.stderr index 59be0f983b9..5bf6d3382d2 100644 --- a/src/test/ui/issues/issue-54943.nll.stderr +++ b/src/test/ui/issues/issue-54943.nll.stderr @@ -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 diff --git a/src/test/ui/issues/issue-55796.nll.stderr b/src/test/ui/issues/issue-55796.nll.stderr index 5809a56cd4b..baa0e6c29bf 100644 --- a/src/test/ui/issues/issue-55796.nll.stderr +++ b/src/test/ui/issues/issue-55796.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr index f2cf19abdac..60420973e1e 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -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 @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr index fbefa1f5667..99fab4631a2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr index d889eb4afdb..52c5752f6ea 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr index 39eb4079352..e90c81ee3e1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr index a39bb165806..b3d0bc2b882 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr index 48ce5301ade..fbe98a4263e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr index 09960683980..1e24032fc1c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -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 diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr index 832688f5162..1ef479fcd4b 100644 --- a/src/test/ui/lub-if.nll.stderr +++ b/src/test/ui/lub-if.nll.stderr @@ -6,6 +6,8 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/lub-if.rs:35:9 @@ -15,6 +17,8 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr index 3a344a77d2c..ed551da54f5 100644 --- a/src/test/ui/lub-match.nll.stderr +++ b/src/test/ui/lub-match.nll.stderr @@ -6,6 +6,8 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/lub-match.rs:39:13 @@ -15,6 +17,8 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr index 505b8db6a33..1658efa28bf 100644 --- a/src/test/ui/match/match-ref-mut-invariance.nll.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.nll.stderr @@ -7,6 +7,8 @@ LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | -- lifetime `'a` defined here LL | match self.0 { ref mut x => x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr index ab5f43d0222..dc227a36566 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr @@ -8,6 +8,8 @@ LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { LL | let ref mut x = self.0; LL | x | ^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 61f20d1dc9a..d383dcca9c1 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -42,10 +42,8 @@ LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { ... LL | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index e34884e9f9a..20b9144341c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -45,10 +45,8 @@ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) LL | | }); | |______^ `cell_a` escapes the function body here - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 40917135c59..7fe00271fc4 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -45,10 +45,8 @@ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) LL | | }); | |______^ `cell_a` escapes the function body here - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index f227e9eb413..7678f24381e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -42,10 +42,8 @@ LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { ... LL | demand_y(outlives1, outlives2, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr index 5e8d9fa7882..1fa3d01017a 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr @@ -5,10 +5,8 @@ LL | fn foo<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | &*x | ^^^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr index d3edbfdae88..d0ba5392532 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr @@ -7,10 +7,8 @@ LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { | lifetime `'a` defined here LL | &*x | ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-50716.nll.stderr b/src/test/ui/nll/issue-50716.nll.stderr index 38dd1b5f6fe..7b83e4beaf3 100644 --- a/src/test/ui/nll/issue-50716.nll.stderr +++ b/src/test/ui/nll/issue-50716.nll.stderr @@ -6,6 +6,8 @@ LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) ... LL | let _x = *s; | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index 109c7e95659..dcf03386734 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -8,10 +8,8 @@ LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> i ... LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.nll.stderr b/src/test/ui/nll/issue-55401.nll.stderr index 4f797f26a1a..df320aa0844 100644 --- a/src/test/ui/nll/issue-55401.nll.stderr +++ b/src/test/ui/nll/issue-55401.nll.stderr @@ -6,6 +6,8 @@ LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); LL | *y | ^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr index 906a7bff00d..5be4e56171c 100644 --- a/src/test/ui/nll/issue-58299.stderr +++ b/src/test/ui/nll/issue-58299.stderr @@ -6,10 +6,8 @@ LL | fn foo<'a>(x: i32) { ... LL | A::<'a>::X..=A::<'static>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-58299.rs:24:27 @@ -19,10 +17,8 @@ LL | fn bar<'a>(x: i32) { ... LL | A::<'static>::X..=A::<'a>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/mir_check_cast_closure.stderr b/src/test/ui/nll/mir_check_cast_closure.stderr index 40ce9e850ea..113e220e513 100644 --- a/src/test/ui/nll/mir_check_cast_closure.stderr +++ b/src/test/ui/nll/mir_check_cast_closure.stderr @@ -8,10 +8,8 @@ LL | fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 { LL | let g: fn(_, _) -> _ = |_x, y| y; LL | g | ^ returning this value requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr index f091161b224..1722da8f343 100644 --- a/src/test/ui/nll/mir_check_cast_reify.stderr +++ b/src/test/ui/nll/mir_check_cast_reify.stderr @@ -6,10 +6,8 @@ LL | fn bar<'a>(x: &'a u32) -> &'static u32 { ... LL | f(x) | ^^^^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr index 2f76758f259..c87425ecfc0 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr @@ -6,10 +6,8 @@ LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { ... LL | unsafe { g(input) } | ^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/mir_check_cast_unsize.stderr b/src/test/ui/nll/mir_check_cast_unsize.stderr index 4a76fa8158e..cb7328d1179 100644 --- a/src/test/ui/nll/mir_check_cast_unsize.stderr +++ b/src/test/ui/nll/mir_check_cast_unsize.stderr @@ -5,10 +5,8 @@ LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug { | -- lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/outlives-suggestion-simple.stderr b/src/test/ui/nll/outlives-suggestion-simple.stderr index 90c6bf2f5b8..f7603e29d48 100644 --- a/src/test/ui/nll/outlives-suggestion-simple.stderr +++ b/src/test/ui/nll/outlives-suggestion-simple.stderr @@ -7,10 +7,8 @@ LL | fn foo1<'a, 'b>(x: &'a usize) -> &'b usize { | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:10:5 @@ -19,10 +17,8 @@ LL | fn foo2<'a>(x: &'a usize) -> &'static usize { | -- lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:14:5 @@ -33,6 +29,8 @@ LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) { | lifetime `'a` defined here LL | (x, y) | ^^^^^^ 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/outlives-suggestion-simple.rs:14:5 @@ -43,10 +41,10 @@ LL | fn foo3<'a, 'b>(x: &'a usize, y: &'b usize) -> (&'b usize, &'a usize) { | lifetime `'a` defined here LL | (x, y) | ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` - -help: the following changes may resolve your lifetime errors | - = help: `'a` and `'b` must be the same; replace one with the other + = help: consider adding the following bound: `'b: 'a` + +help: `'a` and `'b` must be the same: replace one with the other error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:22:5 @@ -58,10 +56,8 @@ LL | fn foo4<'a, 'b, 'c>(x: &'a usize) -> (&'b usize, &'c usize) { ... LL | (x, x) | ^^^^^^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:31:9 @@ -70,10 +66,8 @@ LL | pub fn foo<'a>(x: &'a usize) -> Self { | -- lifetime `'a` defined here LL | Foo { x } | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:41:9 @@ -84,10 +78,8 @@ LL | pub fn get<'b>(&self) -> &'b usize { | -- lifetime `'b` defined here LL | self.x | ^^^^^^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:52:9 @@ -98,10 +90,8 @@ LL | fn get<'b>(&'b self) -> &'a i32 { | -- lifetime `'b` defined here LL | self.x | ^^^^^^ returning this value requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error[E0521]: borrowed data escapes outside of function --> $DIR/outlives-suggestion-simple.rs:73:9 diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index be45c23ed83..7c5a6eecea1 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -50,10 +50,8 @@ LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) ... LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` note: External requirements --> $DIR/projection-one-region-closure.rs:56:29 @@ -108,10 +106,8 @@ LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) ... LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` note: External requirements --> $DIR/projection-one-region-closure.rs:70:29 diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 39f9e78f889..a2ba2e36edf 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -41,10 +41,8 @@ LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) ... LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` note: External requirements --> $DIR/projection-one-region-trait-bound-closure.rs:47:29 @@ -90,10 +88,8 @@ LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) ... LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` note: External requirements --> $DIR/projection-one-region-trait-bound-closure.rs:60:29 diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 15e921bdec1..109edfec43c 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -236,10 +236,8 @@ LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) ... LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr index e4fa647e6cb..f15c2ffd0d7 100644 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr @@ -6,10 +6,8 @@ LL | fn uninit<'a>() { LL | return; LL | let x: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:13:12 @@ -19,10 +17,8 @@ LL | fn var_type<'a>() { LL | return; LL | let x: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:17:12 @@ -31,10 +27,8 @@ LL | fn uninit_infer<'a>() { | -- lifetime `'a` defined here LL | let x: &'static &'a _; | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:23:12 @@ -44,10 +38,8 @@ LL | fn infer<'a>() { LL | return; LL | let x: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:28:12 @@ -57,10 +49,8 @@ LL | fn uninit_no_var<'a>() { LL | return; LL | let _: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:33:12 @@ -70,10 +60,8 @@ LL | fn no_var<'a>() { LL | return; LL | let _: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:38:12 @@ -83,10 +71,8 @@ LL | fn infer_no_var<'a>() { LL | return; LL | let _: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:51:12 @@ -96,10 +82,8 @@ LL | fn required_substs<'a>() { LL | return; LL | let _: C<'static, 'a, _> = C((), &(), &()); | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/type-check-pointer-coercions.stderr b/src/test/ui/nll/type-check-pointer-coercions.stderr index 9c7601c3a60..39fd98f7151 100644 --- a/src/test/ui/nll/type-check-pointer-coercions.stderr +++ b/src/test/ui/nll/type-check-pointer-coercions.stderr @@ -7,10 +7,8 @@ LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:8:5 @@ -21,10 +19,8 @@ LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:13:5 @@ -36,6 +32,8 @@ LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { LL | // Two errors because *mut is invariant LL | x | ^ 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: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:13:5 @@ -47,10 +45,10 @@ LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { LL | // Two errors because *mut is invariant LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: `'b` and `'a` must be the same; replace one with the other + = help: consider adding the following bound: `'a: 'b` + +help: `'b` and `'a` must be the same: replace one with the other error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:18:5 @@ -61,10 +59,8 @@ LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { | lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:24:5 @@ -76,10 +72,8 @@ LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:30:5 @@ -91,10 +85,8 @@ LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { ... LL | y | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-coercions.rs:36:5 @@ -106,10 +98,8 @@ LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { ... LL | y | ^ returning this value requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/type-check-pointer-comparisons.stderr b/src/test/ui/nll/type-check-pointer-comparisons.stderr index 5293f48116e..f350b861eb6 100644 --- a/src/test/ui/nll/type-check-pointer-comparisons.stderr +++ b/src/test/ui/nll/type-check-pointer-comparisons.stderr @@ -7,6 +7,8 @@ LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { | lifetime `'a` defined here LL | x == y; | ^ requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-comparisons.rs:6:10 @@ -17,10 +19,10 @@ LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { | lifetime `'a` defined here LL | x == y; | ^ requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: `'b` and `'a` must be the same; replace one with the other + = help: consider adding the following bound: `'b: 'a` + +help: `'a` and `'b` must be the same: replace one with the other error: lifetime may not live long enough --> $DIR/type-check-pointer-comparisons.rs:12:5 @@ -31,6 +33,8 @@ LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { | lifetime `'a` defined here LL | x == y; | ^ requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-comparisons.rs:12:10 @@ -41,10 +45,10 @@ LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { | lifetime `'a` defined here LL | x == y; | ^ requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: `'a` and `'b` must be the same; replace one with the other + = help: consider adding the following bound: `'b: 'a` + +help: `'a` and `'b` must be the same: replace one with the other error: lifetime may not live long enough --> $DIR/type-check-pointer-comparisons.rs:18:5 @@ -55,6 +59,8 @@ LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32 | lifetime `'a` defined here LL | f == g; | ^ requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/type-check-pointer-comparisons.rs:18:10 @@ -65,10 +71,10 @@ LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32 | lifetime `'a` defined here LL | f == g; | ^ requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: `'a` and `'b` must be the same; replace one with the other + = 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 6 previous errors diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr index ff0cda9114a..e3e294106d1 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.stderr @@ -6,10 +6,8 @@ LL | fn foo<'a>() { ... LL | return x; | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/closure-substs.rs:15:16 @@ -27,10 +25,8 @@ LL | fn bar<'a>() { ... LL | b(x); | ^^^^ argument requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of closure --> $DIR/closure-substs.rs:29:9 diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr index c39301588ac..e9a0b8173ce 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr @@ -5,6 +5,8 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | <Foo<'a>>::C | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr index 541a2cfaf29..52ec36ef542 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr @@ -5,6 +5,8 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr index ea0fcb6d634..5f3212eb9aa 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr @@ -5,6 +5,8 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr index ff549f1d88b..490030d30f3 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr @@ -5,6 +5,8 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here LL | <T as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr index 7f160d8e398..5e687805c6f 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr @@ -5,6 +5,8 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here LL | T::C | ^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr index 48d56fc1c02..7b5646de775 100644 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr +++ b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr @@ -5,10 +5,8 @@ LL | fn non_wf_associated_const<'a>(x: i32) { | -- lifetime `'a` defined here LL | A::<'a>::IC; | ^^^^^^^^^^^ requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index 64df1264d27..97653b8c199 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -15,10 +15,8 @@ LL | fn test<'a>() { | -- lifetime `'a` defined here LL | let _:fn(&()) = |_:&'a ()| {}; | ^ requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr index a629cc26763..f23ea9fdb5c 100644 --- a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr +++ b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr @@ -6,10 +6,8 @@ LL | fn coupled_regions_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-55748-pat-types-constrain-bindings.rs:49:5 @@ -19,10 +17,8 @@ LL | fn coupled_types_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-55748-pat-types-constrain-bindings.rs:62:5 @@ -32,10 +28,8 @@ LL | fn coupled_wilds_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr index 937db377573..426c57ef9c4 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -6,10 +6,8 @@ LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:22:5 @@ -19,10 +17,8 @@ LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:32:5 @@ -32,10 +28,8 @@ LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:37:5 @@ -45,10 +39,8 @@ LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index 981e59c08c5..c2786f0e8cc 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -156,10 +156,8 @@ LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:125:5 @@ -169,10 +167,8 @@ LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:130:5 @@ -182,10 +178,8 @@ LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; LL | y | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:134:18 @@ -194,10 +188,8 @@ LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let (y, _z): (&'static u32, u32) = (x, 44); | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error: aborting due to 19 previous errors diff --git a/src/test/ui/nll/user-annotations/wf-self-type.stderr b/src/test/ui/nll/user-annotations/wf-self-type.stderr index c3b32865b01..33bb1c519b1 100644 --- a/src/test/ui/nll/user-annotations/wf-self-type.stderr +++ b/src/test/ui/nll/user-annotations/wf-self-type.stderr @@ -7,10 +7,8 @@ LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | lifetime `'a` defined here LL | Foo::xmute(u) | ^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/nll/where_clauses_in_functions.stderr b/src/test/ui/nll/where_clauses_in_functions.stderr index c01101cf1f6..1badb7d753b 100644 --- a/src/test/ui/nll/where_clauses_in_functions.stderr +++ b/src/test/ui/nll/where_clauses_in_functions.stderr @@ -7,10 +7,8 @@ LL | fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { | lifetime `'a` defined here LL | foo(x, y) | ^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/nll/where_clauses_in_structs.stderr b/src/test/ui/nll/where_clauses_in_structs.stderr index aa15aa4ddca..2e990131e61 100644 --- a/src/test/ui/nll/where_clauses_in_structs.stderr +++ b/src/test/ui/nll/where_clauses_in_structs.stderr @@ -7,10 +7,8 @@ LL | fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { | lifetime `'a` defined here LL | Foo { x, y }; | ^ requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr index e94f2a92125..900cdfca244 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr @@ -8,6 +8,8 @@ LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { ... LL | ss | ^^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr index 7d6f9f39d13..defffe2b84b 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -5,6 +5,8 @@ LL | fn c<'a>(t: &'a Box<dyn Test+'a>, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr index 6df54638ce0..8c28a7a011a 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -5,6 +5,8 @@ LL | fn c<'a>(t: &'a MyBox<dyn Test+'a>, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr index cdfbf0fc878..d871eb5327d 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr @@ -8,6 +8,8 @@ LL | fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>, ... LL | a | ^ 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[E0521]: borrowed data escapes outside of function --> $DIR/object-lifetime-default-mybox.rs:31:5 @@ -16,6 +18,8 @@ LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> { | -- `ss` is a reference that is only valid in the function body LL | load0(ss) | ^^^^^^^^^ `ss` escapes the function body here + | + = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr index 76129b4d188..d941030d824 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr @@ -6,6 +6,8 @@ LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) { LL | let bad = if x.is_some() { LL | x.unwrap() | ^^^^^^^^^^ `x` escapes the function body here + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr index 60084773466..db45a03ad18 100644 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -7,6 +7,8 @@ LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | lifetime `'a` defined here LL | x.borrowed() | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr index 75b049dae21..fda66a2412c 100644 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -7,6 +7,8 @@ LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &' | lifetime `'a` defined here LL | x.borrowed() | ^^^^^^^^^^^^ 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 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 43acbfd412d..767853d8148 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 @@ -32,6 +32,8 @@ LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { | lifetime `'a` defined here LL | Box::new(v) | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr index 4944f2649b7..9bb385b0dcd 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr @@ -8,6 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr index 79ea4caa343..9bb385b0dcd 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr @@ -8,10 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr index 86bd100538d..ca153b9d9b1 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr @@ -5,6 +5,8 @@ LL | fn param_not_ok<'a>(x: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 @@ -13,6 +15,8 @@ LL | fn param_not_ok1<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 @@ -21,6 +25,8 @@ LL | fn param_not_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 @@ -29,6 +35,8 @@ LL | fn box_with_region_not_ok<'a>() { | -- lifetime `'a` defined here LL | assert_send::<Box<&'a isize>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 @@ -37,6 +45,8 @@ LL | fn unsafe_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 @@ -45,6 +55,8 @@ LL | fn unsafe_ok3<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to 6 previous errors diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr index a8ab92d75c0..47796e50a88 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr @@ -8,6 +8,8 @@ LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. LL | a.bigger_region(b) | ^^^^^^^^^^^^^^^^^^ argument requires that `'y` must outlive `'x` + | + = help: consider adding the following bound: `'y: 'x` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr index 52ad2d9daeb..d352d119a70 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr @@ -8,6 +8,8 @@ LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. LL | f.method(b); | ^^^^^^^^^^^ `b` escapes the function body here + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr index b6d7b8aac5f..2076772b59d 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr @@ -5,6 +5,8 @@ LL | fn caller<'a>(x: &isize) { | -- lifetime `'a` defined here LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr index 3345946bfdd..dd702755c7e 100644 --- a/src/test/ui/regions/regions-bounds.nll.stderr +++ b/src/test/ui/regions/regions-bounds.nll.stderr @@ -7,6 +7,8 @@ LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | lifetime `'a` defined here LL | return e; | ^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-bounds.rs:13:12 @@ -17,6 +19,8 @@ LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | lifetime `'a` defined here LL | return e; | ^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to 2 previous errors 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 806a3ca8242..882faf4ece3 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 @@ -5,6 +5,8 @@ LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> { | -- lifetime `'a` defined here LL | box B(&*v) as Box<dyn X> | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:10:5 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 1e57023bc23..93ac17810da 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 @@ -13,6 +13,8 @@ LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> { | -- lifetime `'a` defined here LL | box B(&*v) as Box<dyn X> | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:10:5 diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 88d6abd1428..2fb9dcc4e9e 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -8,6 +8,8 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + LL | // A outlives 'a AND 'b...but not 'c. LL | box v as Box<dyn SomeTrait + 'a> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` + | + = help: consider adding the following bound: `'a: 'c` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr index e35a878fce1..41d609b56d2 100644 --- a/src/test/ui/regions/regions-creating-enums3.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums3.nll.stderr @@ -7,6 +7,8 @@ LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | lifetime `'a` defined here LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ 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 diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr index 4eac457feda..dda374c90d9 100644 --- a/src/test/ui/regions/regions-creating-enums4.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums4.nll.stderr @@ -7,6 +7,8 @@ LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | lifetime `'a` defined here LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr index 1540a7bacd7..4957bcf3f73 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr @@ -7,6 +7,8 @@ LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { | -- lifetime `'b` defined here LL | g2.get() | ^^^^^^^^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr index 7836291a7ca..eb4cd5ca72e 100644 --- a/src/test/ui/regions/regions-early-bound-error.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error.nll.stderr @@ -7,6 +7,8 @@ LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | lifetime `'a` defined here LL | g1.get() | ^^^^^^^^ 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 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 9ae484eaf45..f61f068a486 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 @@ -8,6 +8,8 @@ LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { LL | // However, it is not safe to assume that 'b <= 'a LL | &*y | ^^^ 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/regions-free-region-ordering-callee.rs:18:12 @@ -19,6 +21,8 @@ LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { LL | // Do not infer an ordering from the return value. LL | let z: &'b usize = &*x; | ^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr index 16eda2844c6..0d4694a64d0 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr @@ -7,6 +7,8 @@ LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | lifetime `'a` defined here LL | let z: Option<&'b &'a usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-free-region-ordering-caller.rs:17:12 @@ -18,6 +20,8 @@ LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { LL | let y: Paramd<'a> = Paramd { x: a }; LL | let z: Option<&'b Paramd<'a>> = None; | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-free-region-ordering-caller.rs:22:12 @@ -28,6 +32,8 @@ LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | lifetime `'a` defined here LL | let z: Option<&'a &'b usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr index 594ea755e3d..0d4694a64d0 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr @@ -7,10 +7,8 @@ LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | lifetime `'a` defined here LL | let z: Option<&'b &'a usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-free-region-ordering-caller.rs:17:12 @@ -22,10 +20,8 @@ LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { LL | let y: Paramd<'a> = Paramd { x: a }; LL | let z: Option<&'b Paramd<'a>> = None; | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'a: 'b` + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-free-region-ordering-caller.rs:22:12 @@ -36,10 +32,8 @@ LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | lifetime `'a` defined here LL | let z: Option<&'a &'b usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr index 480a81d33f6..106d3df2744 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr @@ -10,6 +10,8 @@ LL | | Some(ref next) => next.get(), LL | | None => &self.val LL | | } | |_________^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr index cefeecf16e2..94b80852d01 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Contravariant<'short>, ... LL | let _: Contravariant<'long> = c; | ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr index 1bddecba50a..f44a0fad59b 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, ... LL | let _: Covariant<'short> = c; | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr index 0c1e3989b23..3256e3c0dd3 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr @@ -5,6 +5,8 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + | + = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr index 0edeb272399..991f9a287b9 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr @@ -5,6 +5,8 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + | + = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr index 724dd7e3f6d..2d62fb85b81 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr @@ -5,6 +5,8 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` + | + = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr index 2064b060ec4..fcc2ec31f3e 100644 --- a/src/test/ui/regions/regions-infer-not-param.nll.stderr +++ b/src/test/ui/regions/regions-infer-not-param.nll.stderr @@ -5,6 +5,8 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b` | | | lifetime `'a` defined here + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-infer-not-param.rs:19:63 @@ -13,6 +15,8 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | | | lifetime `'a` defined here + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-infer-not-param.rs:19:63 @@ -21,6 +25,10 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b` | | | lifetime `'a` defined here + | + = help: consider adding the following bound: `'a: 'b` + +help: `'b` and `'a` must be the same: replace one with the other error: aborting due to 3 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 97650636cb6..305a76815ac 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -45,6 +45,8 @@ LL | fn nested<'x>(x: &'x isize) { ... LL | if false { return x; } | ^ returning this value requires that `'x` must outlive `'static` + | + = help: consider replacing `'x` with `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr index eed9934be12..29e92f33ec9 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr @@ -8,6 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-outlives-projection-container-hrtb.rs:50:12 @@ -19,6 +21,8 @@ LL | fn with_assoc_sub<'a,'b>() { ... LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr index fb836d32a2b..29e92f33ec9 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr @@ -8,10 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-outlives-projection-container-hrtb.rs:50:12 @@ -23,10 +21,8 @@ LL | fn with_assoc_sub<'a,'b>() { ... LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr index 8c54d8da0a0..70351443024 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr @@ -8,6 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr index 3f5088c12d6..70351443024 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr @@ -8,10 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - -help: the following changes may resolve your lifetime errors | - = help: add bound `'b: 'a` + = help: consider adding the following bound: `'b: 'a` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr index 2cf6e245d19..073a3190022 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr @@ -8,6 +8,8 @@ LL | fn with_assoc<'a,'b>() { ... LL | let _x: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-outlives-projection-container.rs:54:13 @@ -19,6 +21,8 @@ LL | fn without_assoc<'a,'b>() { ... LL | let _x: &'a WithoutAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-outlives-projection-container.rs:63:5 @@ -30,6 +34,8 @@ LL | fn call_with_assoc<'a,'b>() { ... LL | call::<&'a WithAssoc<TheType<'b>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/regions-outlives-projection-container.rs:70:5 @@ -41,6 +47,8 @@ LL | fn call_without_assoc<'a,'b>() { ... LL | call::<&'a WithoutAssoc<TheType<'b>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr index c8582f8bfe7..dc905d076bb 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr @@ -7,6 +7,8 @@ LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b m | lifetime `'a` defined here LL | &mut ***p | ^^^^^^^^^ 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 diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr index 5946e7bf849..c98ec477417 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr @@ -7,6 +7,8 @@ LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | lifetime `'a` defined here LL | &mut **p | ^^^^^^^^ 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 diff --git a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr index b5f3e6cfaba..6f2c75d2eba 100644 --- a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr @@ -5,6 +5,8 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here LL | t | ^ returning this value requires that `'a` must outlive `'static` + | + = help: consider replacing `'a` with `'static` error[E0621]: explicit lifetime required in the type of `u` --> $DIR/regions-static-bound.rs:14:5 diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr index 281683ac1da..6f2c75d2eba 100644 --- a/src/test/ui/regions/regions-static-bound.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.nll.stderr @@ -5,10 +5,8 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here LL | t | ^ returning this value requires that `'a` must outlive `'static` - -help: the following changes may resolve your lifetime errors | - = help: replace `'a` with `'static` + = help: consider replacing `'a` with `'static` error[E0621]: explicit lifetime required in the type of `u` --> $DIR/regions-static-bound.rs:14:5 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 f4b1a89db9a..f92923a1125 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -8,6 +8,8 @@ LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { LL | // Without knowing 'a:'b, we can't coerce LL | x | ^ returning this value requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough --> $DIR/regions-trait-object-subtyping.rs:22:5 @@ -19,6 +21,8 @@ LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dum LL | // We can't coerce because it is packed in `Wrapper` LL | x | ^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr index f5b96f314c5..5352be430fb 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: S<'long, 'short>, ... LL | let _: S<'long, 'long> = c; | ^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr index 372510a2f7e..22c9b915bb9 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Contravariant<'short>, ... LL | let _: Contravariant<'long> = c; | ^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr index e87e914727c..a07181ad553 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, ... LL | let _: Covariant<'short> = c; | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr index adee33bfc7e..d51db99f81f 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Invariant<'long>, ... LL | let _: Invariant<'short> = c; | ^^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr index 15853e6ca5d..90388a1c51b 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr @@ -6,6 +6,8 @@ LL | fn use_<'b>(c: Invariant<'b>) { ... LL | let _: Invariant<'static> = c; | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static` + | + = help: consider replacing `'b` with `'static` error: aborting due to previous error diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr index 344437f74e4..be18737b5f1 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr @@ -5,6 +5,8 @@ LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, & | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:7:5 @@ -13,6 +15,8 @@ LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, ( | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:10:5 @@ -21,6 +25,8 @@ LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, & | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:13:5 @@ -29,6 +35,8 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, ( | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:18:5 @@ -38,6 +46,8 @@ LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) LL | -> OccupiedEntry<'a, &'new (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:22:5 @@ -47,6 +57,8 @@ LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) LL | -> OccupiedEntry<'a, (), &'new ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:26:5 @@ -56,6 +68,8 @@ LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) LL | -> OccupiedEntry<'a, &'static (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:30:5 @@ -65,6 +79,8 @@ LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) LL | -> OccupiedEntry<'a, (), &'static ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:35:5 @@ -74,6 +90,8 @@ LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) LL | -> VacantEntry<'a, &'new (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:39:5 @@ -83,6 +101,8 @@ LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) LL | -> VacantEntry<'a, (), &'new ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:43:5 @@ -92,6 +112,8 @@ LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) LL | -> VacantEntry<'a, &'static (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:47:5 @@ -101,6 +123,8 @@ LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) LL | -> VacantEntry<'a, (), &'static ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` + | + = help: consider replacing `'new` with `'static` error: aborting due to 12 previous errors diff --git a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr index a3ae5320c90..1fcdfc4b5bb 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr @@ -8,6 +8,8 @@ LL | fn use_<'short,'long>(c: Foo<'short>, ... LL | let _: Foo<'long> = c; | ^^^^^^^^^^ type annotation requires that `'short` must outlive `'long` + | + = help: consider adding the following bound: `'short: 'long` error: aborting due to previous error diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr index 69818aedd15..91d4fd2e971 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-object.rs:22:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr index dbd75cb52fa..6f136750ee1 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<G,&'min i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<G,&'max i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr index 9212cf24be3..fe08ce0b84d 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-contravariant-self-trait-match.rs:22:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr index 63ab7fe9651..37fdea960be 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-covariant-arg-object.rs:22:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr index 33589121c4b..a982a29d499 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<G,&'min i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-covariant-arg-trait-match.rs:20:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<G,&'max i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr index 6b2413d68be..81b25e38ec6 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-covariant-self-trait-match.rs:20:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr index fe2f35b63b5..f6265980af7 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-invariant-arg-object.rs:18:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr index 2ab44c54c72..2909e81fcbf 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<G,&'min i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-invariant-arg-trait-match.rs:16:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<G,&'max i32>() | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr index 7b7c42fea8d..01b2c8803ae 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr @@ -8,6 +8,8 @@ LL | fn get_min_from_max<'min, 'max, G>() ... LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-invariant-self-trait-match.rs:16:5 @@ -19,6 +21,8 @@ LL | fn get_max_from_min<'min, 'max, G>() ... LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr index 8468448b27b..eddd4b217c0 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr @@ -8,6 +8,8 @@ LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to previous error diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr index 19a22f064be..a86c1b93a73 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr @@ -8,6 +8,8 @@ LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to previous error diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr index 61f80fe77e6..385d83adaf8 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr @@ -8,6 +8,8 @@ LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough --> $DIR/variance-use-invariant-struct-1.rs:19:5 @@ -19,6 +21,8 @@ LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) ... LL | v | ^ returning this value requires that `'min` must outlive `'max` + | + = help: consider adding the following bound: `'min: 'max` error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr index 338de6db180..d031a68a51d 100644 --- a/src/test/ui/wf/wf-static-method.nll.stderr +++ b/src/test/ui/wf/wf-static-method.nll.stderr @@ -8,6 +8,8 @@ LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { ... LL | u | ^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/wf-static-method.rs:26:18 @@ -19,6 +21,8 @@ LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { ... LL | let me = Self::make_me(); | ^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/wf-static-method.rs:33:9 @@ -30,6 +34,8 @@ LL | impl<'a, 'b> Evil<'a, 'b> { LL | fn inherent_evil(u: &'b u32) -> &'a u32 { LL | u | ^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/wf-static-method.rs:41:5 @@ -40,6 +46,8 @@ LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | lifetime `'a` defined here LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/wf-static-method.rs:45:5 @@ -50,6 +58,8 @@ LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | lifetime `'a` defined here LL | <IndirectEvil>::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough --> $DIR/wf-static-method.rs:50:5 @@ -60,6 +70,8 @@ LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | lifetime `'a` defined here LL | <Evil>::inherent_evil(b) // bug? shouldn't this be an error | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` error: aborting due to 6 previous errors |
