diff options
Diffstat (limited to 'src/test')
18 files changed, 140 insertions, 27 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr index 987cde191cb..2bccec45894 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr @@ -4,7 +4,13 @@ error[E0310]: the parameter type `U` may not live long enough LL | struct Foo<U> { | - help: consider adding an explicit lifetime bound...: `U: 'static` LL | bar: Bar<U> - | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds + | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/feature-gate-infer_static_outlives_requirements.rs:7:15 + | +LL | struct Bar<T: 'static> { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr index 2106b214fec..f5b92beb3b2 100644 --- a/src/test/ui/generic-associated-types/issue-86483.stderr +++ b/src/test/ui/generic-associated-types/issue-86483.stderr @@ -11,7 +11,13 @@ LL | | { ... | LL | | LL | | } - | |_^ ...so that the type `T` will meet its required lifetime bounds + | |_^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/issue-86483.rs:7:16 + | +LL | for<'a> T: 'a, + | ^^ error[E0311]: the parameter type `T` may not live long enough --> $DIR/issue-86483.rs:9:5 @@ -20,7 +26,13 @@ LL | pub trait IceIce<T> | - help: consider adding an explicit lifetime bound...: `T: 'a` ... LL | type Ice<'v>: IntoIterator<Item = &'v T>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/issue-86483.rs:7:16 + | +LL | for<'a> T: 'a, + | ^^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/issue-86483.rs:9:32 diff --git a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr index d2482b2998b..8237d3718c2 100644 --- a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr +++ b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr @@ -4,7 +4,7 @@ error[E0477]: the type `&'b ()` does not fulfill the required lifetime LL | type Item<'a> = &'b (); | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: type must outlive the lifetime `'a` as defined on the associated item at 8:15 +note: type must outlive the lifetime `'a` as defined on the associated item at 8:15 as required by this binding --> $DIR/unsatisfied-outlives-bound.rs:8:15 | LL | type Item<'a> = &'b (); @@ -16,7 +16,11 @@ error[E0477]: the type `&'a ()` does not fulfill the required lifetime LL | type Item<'a> = &'a (); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/unsatisfied-outlives-bound.rs:13:20 + | +LL | type Item<'a>: 'static; + | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-54943.stderr b/src/test/ui/issues/issue-54943.stderr index 62aacee8111..e917958c05e 100644 --- a/src/test/ui/issues/issue-54943.stderr +++ b/src/test/ui/issues/issue-54943.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a u32` does not fulfill the required lifetime LL | let x = foo::<&'a u32>(); | ^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/issue-54943.rs:1:11 + | +LL | fn foo<T: 'static>() { } + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index aa72fda3670..b2b70976080 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -16,7 +16,11 @@ error[E0477]: the type `&'a (dyn Dummy + Sync + 'a)` does not fulfill the requir LL | assert_send::<&'a (dyn Dummy + Sync)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/kindck-send-object1.rs:5:23 + | +LL | fn assert_send<T:Send+'static>() { } + | ^^^^^^^ error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index eba00c5a945..88253bad194 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -5,7 +5,12 @@ LL | bar::<T::Output>() | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`... - = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds + = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds... +note: ...that is required by this bound + --> $DIR/projection-where-clause-env-wrong-bound.rs:29:8 + | +LL | T: 'a, + | ^^ error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr index 34b83859a6b..9f7fc030aa9 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr @@ -5,7 +5,12 @@ LL | bar::<<T as MyTrait<'a>>::Output>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `<T as MyTrait<'a>>::Output: 'a`... - = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds + = note: ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds... +note: ...that is required by this bound + --> $DIR/projection-where-clause-env-wrong-lifetime.rs:20:8 + | +LL | T: 'a, + | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr index 03da33ae11f..52802848d56 100644 --- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:5:17 + | +LL | type Value: 'a; + | ^^ error[E0477]: the type `&'a i32` does not fulfill the required lifetime --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:20:5 @@ -12,7 +16,7 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^^^^^^^^^^^^^^^ | -note: type must outlive the lifetime `'b` as defined on the impl at 19:10 +note: type must outlive the lifetime `'b` as defined on the impl at 19:10 as required by this binding --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:10 | LL | impl<'a, 'b> Foo<'b> for &'a i64 { diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr index d8efeac5b8a..a03210db6df 100644 --- a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:5:17 + | +LL | type Value: 'static; + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr index 930bf608ac4..68b90eee72d 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error[E0477]: the type `&'a str` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 @@ -12,7 +16,11 @@ error[E0477]: the type `&'a str` does not fulfill the required lifetime LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 @@ -20,7 +28,11 @@ error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error[E0477]: the type `Box<&'a isize>` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 @@ -28,7 +40,11 @@ error[E0477]: the type `Box<&'a isize>` does not fulfill the required lifetime LL | assert_send::<Box<&'a isize>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 @@ -36,7 +52,11 @@ error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 @@ -44,7 +64,11 @@ error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + | +LL | fn assert_send<T:'static>() { } + | ^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr index e5a80cbd547..5b692cdcc0e 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr @@ -23,7 +23,13 @@ LL | fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! LL | box B(&*v) as Box<X> - | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-close-object-into-object-5.rs:9:17 + | +LL | struct B<'a, T: 'a>(&'a (A<T> + 'a)); + | ^^ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-object-into-object-5.rs:17:11 diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr index 4ca5ac291d5..97a3947bc0a 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr @@ -5,7 +5,12 @@ LL | check_bound(x, self) | ^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `Self: 'a`... - = note: ...so that the type `Self` will meet its required lifetime bounds + = note: ...so that the type `Self` will meet its required lifetime bounds... +note: ...that is required by this bound + --> $DIR/regions-infer-bound-from-trait-self.rs:12:21 + | +LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } + | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.stderr index 196ee8ca7c0..fd1090d2dbd 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.stderr @@ -4,7 +4,13 @@ error[E0309]: the parameter type `A` may not live long enough LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound...: `A: 'a` LL | check_bound(x, a) - | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds + | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-infer-bound-from-trait.rs:12:21 + | +LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } + | ^^ error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-infer-bound-from-trait.rs:37:5 @@ -12,7 +18,13 @@ error[E0309]: the parameter type `A` may not live long enough LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound...: `A: 'a +` LL | check_bound(x, a) - | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds + | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-infer-bound-from-trait.rs:12:21 + | +LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } + | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr index a449fac1193..1f387a042e6 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -4,7 +4,13 @@ error[E0310]: the parameter type `U` may not live long enough LL | struct Foo<U> { | - help: consider adding an explicit lifetime bound...: `U: 'static` LL | bar: Bar<U> - | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds + | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/dont-infer-static.rs:10:15 + | +LL | struct Bar<T: 'static> { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index 44812a51778..71caeefabac 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -12,7 +12,13 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound...: `T: 'a` LL | type Out = RefOk<'a, T>; - | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-struct-not-wf.rs:16:20 + | +LL | struct RefOk<'a, T:'a> { + | ^^ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references --> $DIR/regions-struct-not-wf.rs:25:5 diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed index 589ee1a474a..65aab97d3d7 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed @@ -9,7 +9,7 @@ fn foo(d: impl Debug + 'static) { //~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds } -fn bar(d: impl Debug + 'static) { +fn bar(d: impl Debug + 'static) { //~ NOTE ...that is required by this bound println!("{:?}", d) } diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs index 9a87129fbf2..fb1848d130f 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs @@ -9,7 +9,7 @@ fn foo(d: impl Debug) { //~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds } -fn bar(d: impl Debug + 'static) { +fn bar(d: impl Debug + 'static) { //~ NOTE ...that is required by this bound println!("{:?}", d) } diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr index 643dac25724..e4a247993c2 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr @@ -5,7 +5,13 @@ LL | fn foo(d: impl Debug) { | ---------- help: consider adding an explicit lifetime bound...: `impl Debug + 'static` LL | LL | bar(d); - | ^^^ ...so that the type `impl Debug` will meet its required lifetime bounds + | ^^^ ...so that the type `impl Debug` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/suggest-impl-trait-lifetime.rs:12:24 + | +LL | fn bar(d: impl Debug + 'static) { + | ^^^^^^^ error: aborting due to previous error |
