Skip to content

Commit cba0761

Browse files
committed
update tests
1 parent 0026e3e commit cba0761

File tree

134 files changed

+409
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+409
-207
lines changed

src/test/ui/associated-type-bounds/implied-region-constraints.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
88
...
99
LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
1010
| ^^^^^ type annotation requires that `'a` must outlive `'b`
11+
|
12+
= help: consider adding the following bound: `'a: 'b`
1113

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

2327
error: aborting due to 2 previous errors
2428

src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr

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

1214
error: lifetime may not live long enough
1315
--> $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>>(
1921
...
2022
LL | let z: I::A = if cond { x } else { y };
2123
| ^ assignment requires that `'b` must outlive `'a`
24+
|
25+
= help: consider adding the following bound: `'b: 'a`
26+
27+
help: `'a` and `'b` must be the same: replace one with the other
2228

2329
error: aborting due to 2 previous errors
2430

src/test/ui/associated-types/associated-types-subtyping-1.nll.stderr

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

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

2327
error: aborting due to 2 previous errors
2428

src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr

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

1214
error: lifetime may not live long enough
1315
--> $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) {
1921
...
2022
LL | (a, b)
2123
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
24+
|
25+
= help: consider adding the following bound: `'b: 'a`
26+
27+
help: `'a` and `'b` must be the same: replace one with the other
2228

2329
error: aborting due to 2 previous errors
2430

src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr

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

911
error: aborting due to previous error
1012

src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr

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

1214
error: lifetime may not live long enough
1315
--> $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>) {
1921
...
2022
LL | (a, b)
2123
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
24+
|
25+
= help: consider adding the following bound: `'b: 'a`
26+
27+
help: `'a` and `'b` must be the same: replace one with the other
2228

2329
error: aborting due to 2 previous errors
2430

src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr

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

1214
error: lifetime may not live long enough
1315
--> $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>) {
1921
...
2022
LL | let b = bar(f, y);
2123
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
24+
|
25+
= help: consider adding the following bound: `'b: 'a`
26+
27+
help: `'a` and `'b` must be the same: replace one with the other
2228

2329
error: aborting due to 2 previous errors
2430

src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
66
...
77
LL | bar(foo, x)
88
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
9+
|
10+
= help: consider replacing `'a` with `'static`
911

1012
error: aborting due to previous error
1113

src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ LL | |
1010
LL | | (a, b)
1111
LL | | }
1212
| |_^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
13+
|
14+
= help: consider adding the following bound: `'b: 'a`
1315

1416
error: aborting due to previous error
1517

src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr

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

1113
error: aborting due to previous error
1214

src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ LL | fn expect_bound_supply_named<'x>() {
3737
...
3838
LL | closure_expecting_bound(|x: &'x u32| {
3939
| ^ requires that `'x` must outlive `'static`
40+
|
41+
= help: consider replacing `'x` with `'static`
4042

4143
error: aborting due to 4 previous errors
4244

src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr

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

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

2933
error: aborting due to 2 previous errors
3034

src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ LL | gimme::<$t1>(None::<$t2>);
1111
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
1212
LL | | fn(&'y u32)) }
1313
| |__________________________________________- in this macro invocation
14+
|
15+
= help: consider adding the following bound: `'x: 'y`
1416

1517
error: aborting due to previous error
1618

src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ LL | fn foo_hrtb_bar_not<'b,T>(mut t: T)
5858
...
5959
LL | foo_hrtb_bar_not(&mut t);
6060
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
61+
|
62+
= help: consider replacing `'b` with `'static`
6163

6264
warning: function cannot return without recursing
6365
--> $DIR/hrtb-perfect-forwarding.rs:49:1

src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
55
| - `x` is a reference that is only valid in the function body
66
LL | static_val(x);
77
| ^^^^^^^^^^^^^ `x` escapes the function body here
8+
|
9+
= help: consider replacing `'a` with `'static`
810

911
error: aborting due to previous error
1012

src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ error: lifetime may not live long enough
44
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
55
| -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
66
|
7+
= help: consider replacing `'a` with `'static`
78
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
89
|
910
LL | type E<'a, 'b> = impl Sized; + 'a

src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
| |
2020
| lifetime `'a` defined here
2121
|
22+
= help: consider replacing `'a` with `'static`
2223
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
2324
|
2425
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 }
3132
| -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
3233
|
3334
= help: consider replacing `'a` with `'static`
35+
= help: consider replacing `'a` with `'static`
3436

3537
error: lifetime may not live long enough
3638
--> $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
3941
| -- -- lifetime `'b` defined here ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
4042
| |
4143
| lifetime `'a` defined here
44+
|
45+
= help: consider adding the following bound: `'b: 'a`
4246

4347
error[E0310]: the parameter type `T` may not live long enough
4448
--> $DIR/must_outlive_least_region_or_bound.rs:22:51

src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
1919
| |
2020
| lifetime `'a` defined here
2121
|
22+
= help: consider replacing `'a` with `'static`
2223
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
2324
|
2425
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {

src/test/ui/in-band-lifetimes/mismatched.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
1414
| | |
1515
| | lifetime `'b` defined here
1616
| lifetime `'a` defined here
17+
|
18+
= help: consider adding the following bound: `'b: 'a`
1719

1820
error: aborting due to 2 previous errors
1921

src/test/ui/issues/issue-10291.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | fn test<'x>(x: &'x isize) {
66
LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
77
LL | x
88
| ^ returning this value requires that `'x` must outlive `'static`
9+
|
10+
= help: consider replacing `'x` with `'static`
911

1012
error: aborting due to previous error
1113

src/test/ui/issues/issue-26217.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | fn bar<'a>() {
55
| -- lifetime `'a` defined here
66
LL | foo::<&'a i32>();
77
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
8+
|
9+
= help: consider replacing `'a` with `'static`
810

911
error: aborting due to previous error
1012

src/test/ui/issues/issue-28848.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
77
| lifetime `'a` defined here
88
LL | Foo::<'a, 'b>::xmute(u)
99
| ^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a`
10+
|
11+
= help: consider adding the following bound: `'b: 'a`
1012

1113
error: aborting due to previous error
1214

src/test/ui/issues/issue-52213.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
88
LL | match (&t,) {
99
LL | ((u,),) => u,
1010
| ^ returning this value requires that `'a` must outlive `'b`
11+
|
12+
= help: consider adding the following bound: `'a: 'b`
1113

1214
error: aborting due to previous error
1315

src/test/ui/issues/issue-54943.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | fn boo<'a>() {
66
...
77
LL | let x = foo::<&'a u32>();
88
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
9+
|
10+
= help: consider replacing `'a` with `'static`
911

1012
error: aborting due to previous error
1113

src/test/ui/issues/issue-55796.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | pub trait Graph<'a> {
66
...
77
LL | Box::new(self.out_edges(u).map(|e| e.target()))
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
9+
|
10+
= help: consider replacing `'a` with `'static`
911

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

1923
error: aborting due to 2 previous errors
2024

src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr

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

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

1923
error: aborting due to 2 previous errors
2024

src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr

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

1214
error: aborting due to previous error
1315

src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr

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

1214
error: aborting due to previous error
1315

src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr

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

1214
error: aborting due to previous error
1315

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ LL | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
88
...
99
LL | x.push(y);
1010
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
11+
|
12+
= help: consider adding the following bound: `'b: 'a`
1113

1214
error: aborting due to previous error
1315

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr

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

1113
error: aborting due to previous error
1214

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr

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

1113
error: aborting due to previous error
1214

0 commit comments

Comments
 (0)