Bless tests.
This commit is contained in:
parent
94449e6101
commit
03bbb98019
68 changed files with 527 additions and 298 deletions
|
@ -14,10 +14,10 @@ note: captured value is not `Send` because `&` references cannot be sent unless
|
|||
LL | let x = x;
|
||||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
|
||||
= note: required for the cast to the object type `dyn Future<Output = ()> + Send`
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | where 'me:'async_trait, T: std::marker::Sync {
|
||||
| ++++++++++++++++++++++
|
||||
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
|
|||
--> $DIR/builtin-superkinds-self-type.rs:10:16
|
||||
|
|
||||
LL | impl <T: Sync> Foo for T { }
|
||||
| -- ^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `T: 'static +`
|
||||
| ^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl <T: Sync + 'static> Foo for T { }
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:10
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -11,6 +9,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct Bar<T: 'static> {
|
||||
| ^^^^^^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Foo<U: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
error[E0311]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-86483.rs:5:1
|
||||
|
|
||||
LL | pub trait IceIce<T>
|
||||
| ^ - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
| _|
|
||||
| |
|
||||
LL | / pub trait IceIce<T>
|
||||
LL | | where
|
||||
LL | | for<'a> T: 'a,
|
||||
LL | | {
|
||||
|
@ -19,13 +16,14 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | for<'a> T: 'a,
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | for<'a> T: 'a + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0311]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-86483.rs:9:5
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -34,6 +32,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | for<'a> T: 'a,
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | for<'a> T: 'a + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-86483.rs:9:32
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
error[E0311]: the parameter type `T` may not live long enough
|
||||
--> $DIR/issue-91139.rs:27:12
|
||||
|
|
||||
LL | fn foo<T>() {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | let _: for<'a> fn(<() as Foo<T>>::Type<'a>, &'a T) = |_, _| ();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn foo<T: 'a>() {
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,17 +2,23 @@ error[E0311]: the parameter type `C` may not live long enough
|
|||
--> $DIR/issue-92096.rs:20:33
|
||||
|
|
||||
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `C: 'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | C: Client + Send + Sync + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0311]: the parameter type `C` may not live long enough
|
||||
--> $DIR/issue-92096.rs:20:33
|
||||
|
|
||||
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `C: 'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | C: Client + Send + Sync + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -87,10 +87,10 @@ note: tuple struct defined here
|
|||
|
|
||||
LL | struct E<B>(B);
|
||||
| ^
|
||||
help: consider further restricting type parameter `B`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B, B: Add<Output = B> {
|
||||
| ++++++++++++++++++++
|
||||
LL | impl<B: Add + Add<Output = B>> Add for E<B> where <B as Add>::Output = B {
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ warning: unnecessary lifetime parameter `'a`
|
|||
--> $DIR/unsatified-item-lifetime-bound.rs:4:12
|
||||
|
|
||||
LL | type Y<'a: 'static>;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ warning: unnecessary lifetime parameter `'a`
|
|||
--> $DIR/equal-hidden-lifetimes.rs:7:25
|
||||
|
|
||||
LL | fn equal_regions_static<'a: 'static>(x: &'a i32) -> impl Sized {
|
||||
| ^^^^^^^^^^^
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
|
|
|
@ -128,9 +128,12 @@ error[E0310]: the parameter type `T` may not live long enough
|
|||
--> $DIR/must_outlive_least_region_or_bound.rs:38:51
|
||||
|
|
||||
LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
|
||||
| -- ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `T: 'static +`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn ty_param_wont_outlive_static<T:Debug + 'static>(x: T) -> impl Debug + 'static {
|
||||
| +++++++++
|
||||
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/must_outlive_least_region_or_bound.rs:16:50
|
||||
|
|
|
@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
|
|||
--> $DIR/type_parameters_captured.rs:7:20
|
||||
|
|
||||
LL | fn foo<T>(x: T) -> impl Any + 'static {
|
||||
| - ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
| ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn foo<T: 'static>(x: T) -> impl Any + 'static {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ trait Trait { type Out; }
|
|||
struct Test<'a> { s: &'a str }
|
||||
|
||||
fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
|
||||
//~^ WARN unnecessary lifetime parameter `'z`
|
||||
let x = Test { s: "this cannot last" };
|
||||
&x
|
||||
//~^ ERROR: cannot return reference to local variable `x`
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
warning: unnecessary lifetime parameter `'z`
|
||||
--> $DIR/issue-30438-c.rs:7:74
|
||||
|
|
||||
LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'z`
|
||||
|
||||
error[E0515]: cannot return reference to local variable `x`
|
||||
--> $DIR/issue-30438-c.rs:9:5
|
||||
--> $DIR/issue-30438-c.rs:10:5
|
||||
|
|
||||
LL | &x
|
||||
| ^^ returns a reference to data owned by the current function
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0515`.
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/lifetime-doesnt-live-long-enough.rs:19:10
|
||||
|
|
||||
LL | struct Foo<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | foo: &'static T
|
||||
| ^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Foo<T: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0309]: the parameter type `K` may not live long enough
|
||||
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:19
|
||||
|
|
||||
LL | trait X<K>: Sized {
|
||||
| - help: consider adding an explicit lifetime bound...: `K: 'a`
|
||||
LL | fn foo<'a, L: X<&'a Nested<K>>>();
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | trait X<K: 'a>: Sized {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `Self` may not live long enough
|
||||
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:19
|
||||
|
@ -27,25 +33,34 @@ error[E0309]: the parameter type `L` may not live long enough
|
|||
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:22
|
||||
|
|
||||
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
|
||||
| - ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `L: 'a`
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn baz<'a, L: 'a, M: X<&'a Nested<L>>>() {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `K` may not live long enough
|
||||
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:33
|
||||
|
|
||||
LL | impl<K> Nested<K> {
|
||||
| - help: consider adding an explicit lifetime bound...: `K: 'a`
|
||||
LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<K: 'a> Nested<K> {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `M` may not live long enough
|
||||
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:36
|
||||
|
|
||||
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
|
||||
| ^^^^^^^^^^^^^^^^ -- help: consider adding an explicit lifetime bound...: `M: 'a +`
|
||||
| |
|
||||
| ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b + 'a>() {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
@ -54,31 +54,31 @@ where
|
|||
|
||||
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A,
|
||||
T: B, T: Trait, T: Copy
|
||||
//~^ HELP consider further restricting type parameter `T`
|
||||
T: A + Trait + Copy,
|
||||
//~^ HELP consider further restricting this bound
|
||||
T: B,
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>)
|
||||
fn duplicate_custom_4<T: A + Trait + Copy>(t: S<T>) -> (S<T>, S<T>)
|
||||
//~^ HELP consider further restricting this bound
|
||||
where
|
||||
T: B + Trait + Copy,
|
||||
//~^ HELP consider further restricting this bound
|
||||
T: B,
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn existing_colon<T: Copy>(t: T) {
|
||||
fn existing_colon<T: Copy:>(t: T) {
|
||||
//~^ HELP consider restricting type parameter `T`
|
||||
[t, t]; //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
fn existing_colon_in_where<T>(t: T)
|
||||
where
|
||||
T: Copy,
|
||||
//~^ HELP consider further restricting this bound
|
||||
T:, T: Copy
|
||||
//~^ HELP consider further restricting type parameter `T`
|
||||
{
|
||||
[t, t]; //~ use of moved value: `t`
|
||||
}
|
||||
|
|
|
@ -55,16 +55,16 @@ where
|
|||
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
|
||||
where
|
||||
T: A,
|
||||
//~^ HELP consider further restricting this bound
|
||||
T: B,
|
||||
//~^ HELP consider further restricting type parameter `T`
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
||||
fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>)
|
||||
//~^ HELP consider further restricting this bound
|
||||
where
|
||||
T: B,
|
||||
//~^ HELP consider further restricting this bound
|
||||
{
|
||||
(t, t) //~ use of moved value: `t`
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ fn existing_colon<T:>(t: T) {
|
|||
fn existing_colon_in_where<T>(t: T)
|
||||
where
|
||||
T:,
|
||||
//~^ HELP consider further restricting this bound
|
||||
//~^ HELP consider further restricting type parameter `T`
|
||||
{
|
||||
[t, t]; //~ use of moved value: `t`
|
||||
}
|
||||
|
|
|
@ -121,10 +121,10 @@ LL | (t, t)
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider further restricting type parameter `T`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | T: B, T: Trait, T: Copy
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
LL | T: A + Trait + Copy,
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0382]: use of moved value: `t`
|
||||
--> $DIR/use_of_moved_value_copy_suggestions.rs:69:9
|
||||
|
@ -139,8 +139,8 @@ LL | (t, t)
|
|||
|
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | T: B + Trait + Copy,
|
||||
| ++++++++++++++
|
||||
LL | fn duplicate_custom_4<T: A + Trait + Copy>(t: S<T>) -> (S<T>, S<T>)
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0382]: use of moved value: `t`
|
||||
--> $DIR/use_of_moved_value_copy_suggestions.rs:83:9
|
||||
|
@ -153,10 +153,10 @@ LL | [t, t];
|
|||
| |
|
||||
| value moved here
|
||||
|
|
||||
help: consider further restricting this bound
|
||||
help: consider further restricting type parameter `T`
|
||||
|
|
||||
LL | T: Copy,
|
||||
| ++++
|
||||
LL | T:, T: Copy
|
||||
| ~~~~~~~~~
|
||||
|
||||
error[E0382]: use of moved value: `t`
|
||||
--> $DIR/use_of_moved_value_copy_suggestions.rs:75:9
|
||||
|
@ -171,8 +171,8 @@ LL | [t, t];
|
|||
|
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
LL | fn existing_colon<T: Copy>(t: T) {
|
||||
| ++++
|
||||
LL | fn existing_colon<T: Copy:>(t: T) {
|
||||
| ++++++
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
|
|
@ -36,9 +36,6 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/propagate-from-trait-match.rs:32:36
|
||||
|
|
||||
LL | fn supply<'a, T>(value: T)
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | establish_relationships(value, |value| {
|
||||
| ____________________________________^
|
||||
LL | |
|
||||
|
@ -48,6 +45,11 @@ LL | | // This function call requires that
|
|||
LL | | require(value);
|
||||
LL | | });
|
||||
| |_____^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Trait<'a> + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:11:5
|
||||
|
|
||||
LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | x
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:26:5
|
||||
|
|
||||
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | x
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: 'b + Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-implied-bounds.rs:30:18
|
||||
|
|
||||
LL | fn generic2<T: Iterator>(value: T) {
|
||||
| -- help: consider adding an explicit lifetime bound...: `T: 'static +`
|
||||
LL | twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn generic2<T: Iterator + 'static>(value: T) {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -31,11 +31,13 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:45:29
|
||||
|
|
||||
LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Anything<'b> + 'a,
|
||||
| ++++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:45:39
|
||||
|
@ -82,11 +84,13 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:56:29
|
||||
|
|
||||
LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Anything<'b> + 'a,
|
||||
| ++++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:56:39
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-where-clause-none.rs:16:5
|
||||
|
|
||||
LL | fn foo<'a, T>() -> &'a ()
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | bar::<T::Output>()
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: MyTrait<'a> + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -52,10 +52,13 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24
|
||||
|
|
||||
LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
| ^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn generic_fail<'a, T: 'a>(cell: Cell<&'a ()>, value: T) {
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -29,20 +29,24 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23
|
||||
|
|
||||
LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | with_signature(x, |y| y)
|
||||
| ^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:41:5
|
||||
|
|
||||
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | x
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: 'b + Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26
|
||||
|
|
||||
LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
LL | |
|
||||
|
@ -48,6 +46,11 @@ LL | | // See `correct_region`, which explains the point of this
|
|||
LL | | require(&x, &y)
|
||||
LL | | })
|
||||
| |_____^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn no_region<'a, T: 'a>(a: Cell<&'a ()>, b: T) {
|
||||
| ++++
|
||||
|
||||
note: external requirements
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26
|
||||
|
@ -121,9 +124,6 @@ LL | | }
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26
|
||||
|
|
||||
LL | fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
LL | |
|
||||
|
@ -131,6 +131,11 @@ LL | | // See `correct_region`
|
|||
LL | | require(&x, &y)
|
||||
LL | | })
|
||||
| |_____^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: 'b + 'a,
|
||||
| ++++
|
||||
|
||||
note: external requirements
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn-body.rs:19:5
|
||||
|
|
||||
LL | fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | outlives(cell, t)
|
||||
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn region_static<'a, T: 'a>(cell: Cell<&'a usize>, t: T) {
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn.rs:11:5
|
||||
|
|
||||
LL | fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | x
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn.rs:26:5
|
||||
|
|
||||
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | x
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | T: 'b + Debug + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,26 +1,35 @@
|
|||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:13:5
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| - help: consider adding an explicit lifetime bound...: `U: 'static`
|
||||
LL | Box::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:13:5
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| - help: consider adding an explicit lifetime bound...: `U: 'static`
|
||||
LL | Box::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:13:5
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| - help: consider adding an explicit lifetime bound...: `U: 'static`
|
||||
LL | Box::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:13:5
|
||||
|
@ -51,10 +60,13 @@ LL | Box::new(B(&*v)) as Box<dyn X>
|
|||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:13:14
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| - help: consider adding an explicit lifetime bound...: `U: 'static`
|
||||
LL | Box::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
||||
|
|
||||
|
@ -12,22 +9,25 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct B<'a, T: 'a>(&'a (A<T> + 'a));
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `B<'_, T>` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:14
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds...
|
||||
|
|
||||
|
@ -36,13 +36,14 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct B<'a, T: 'a>(&'a (A<T> + 'a));
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:14
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
||||
|
|
||||
|
@ -51,33 +52,43 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct B<'a, T: 'a>(&'a (A<T> + 'a));
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:16
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^ ...so that the reference type `&dyn A<T>` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:16
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^ ...so that the type `(dyn A<T> + 'static)` is not borrowed for too long
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:16
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^ ...so that the type `(dyn A<T> + 'static)` is not borrowed for too long
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0515]: cannot return value referencing local data `*v`
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:5
|
||||
|
@ -37,11 +43,13 @@ LL | Box::new(B(&*v)) as Box<dyn X>
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-5.rs:21:14
|
||||
|
|
||||
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::new(B(&*v)) as Box<dyn X>
|
||||
| ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
error[E0310]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-close-over-type-parameter-1.rs:15:5
|
||||
|
|
||||
LL | fn make_object1<A: SomeTrait>(v: A) -> Box<dyn SomeTrait + 'static> {
|
||||
| -- help: consider adding an explicit lifetime bound...: `A: 'static +`
|
||||
LL | Box::new(v) as Box<dyn SomeTrait + 'static>
|
||||
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0309]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-close-over-type-parameter-1.rs:24:5
|
||||
|
|
||||
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'b> {
|
||||
| -- help: consider adding an explicit lifetime bound...: `A: 'b +`
|
||||
LL | Box::new(v) as Box<dyn SomeTrait + 'b>
|
||||
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a + 'b>(v: A) -> Box<dyn SomeTrait + 'b> {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
error[E0310]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-close-over-type-parameter-1.rs:15:5
|
||||
|
|
||||
LL | fn make_object1<A: SomeTrait>(v: A) -> Box<dyn SomeTrait + 'static> {
|
||||
| -- help: consider adding an explicit lifetime bound...: `A: 'static +`
|
||||
LL | Box::new(v) as Box<dyn SomeTrait + 'static>
|
||||
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0309]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-close-over-type-parameter-1.rs:24:5
|
||||
|
|
||||
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'b> {
|
||||
| -- help: consider adding an explicit lifetime bound...: `A: 'b +`
|
||||
LL | Box::new(v) as Box<dyn SomeTrait + 'b>
|
||||
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a + 'b>(v: A) -> Box<dyn SomeTrait + 'b> {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,38 +1,46 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:10:5
|
||||
|
|
||||
LL | fn p1<T>(v: T) -> Box<dyn X + 'static>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | where T : X + 'static
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:16:5
|
||||
|
|
||||
LL | fn p2<T>(v: Box<T>) -> Box<dyn X + 'static>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `Box<T>` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
|
||||
| +++++++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:22:5
|
||||
|
|
||||
LL | fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | where T : X + 'a
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:28:5
|
||||
|
|
||||
LL | fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `Box<T>` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn p4<'a,T: 'a>(v: Box<T>) -> Box<dyn X + 'a>
|
||||
| ++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -1,38 +1,46 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:10:5
|
||||
|
|
||||
LL | fn p1<T>(v: T) -> Box<dyn X + 'static>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | where T : X + 'static
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:16:5
|
||||
|
|
||||
LL | fn p2<T>(v: Box<T>) -> Box<dyn X + 'static>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
|
||||
| +++++++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:22:5
|
||||
|
|
||||
LL | fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | where T : X + 'a
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-close-param-into-object.rs:28:5
|
||||
|
|
||||
LL | fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
...
|
||||
LL | Box::new(v)
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn p4<'a,T: 'a>(v: Box<T>) -> Box<dyn X + 'a>
|
||||
| ++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// 'a : 'b
|
||||
|
||||
fn test<'a,'b>(x: &'a i32) -> &'b i32
|
||||
where 'a: 'static
|
||||
where 'a: 'static //~ WARN unnecessary lifetime parameter `'a`
|
||||
{
|
||||
x
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
warning: unnecessary lifetime parameter `'a`
|
||||
--> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:13:5
|
||||
--> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:12:11
|
||||
|
|
||||
LL | 'a: 'static,
|
||||
| ^^
|
||||
LL | where 'a: 'static
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-implied-bounds-projection-gap-1.rs:20:10
|
||||
|
|
||||
LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
|
||||
| -- help: consider adding an explicit lifetime bound...: `T: 'x +`
|
||||
LL | {
|
||||
LL | wf::<&'x T>();
|
||||
| ^^^^^ ...so that the reference type `&'x T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn func<'x, T:Trait1<'x> + 'x>(t: &'x T::Foo)
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-implied-bounds-projection-gap-1.rs:20:5
|
||||
|
|
||||
LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
|
||||
| -- help: consider adding an explicit lifetime bound...: `T: 'x +`
|
||||
LL | {
|
||||
LL | wf::<&'x T>();
|
||||
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn func<'x, T:Trait1<'x> + 'x>(t: &'x T::Foo)
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
error[E0309]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-infer-bound-from-trait.rs:37:5
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -11,12 +9,14 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { }
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn bar1<'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:41:5
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -25,6 +25,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { }
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn bar2<'a,'b,A:Is<'b> + 'a>(x: Inv<'a>, y: Inv<'b>, a: A) {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
error[E0309]: the parameter type `A` may not live long enough
|
||||
--> $DIR/regions-infer-bound-from-trait.rs:37:5
|
||||
|
|
||||
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
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn bar1<'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:41:5
|
||||
|
|
||||
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
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn bar2<'a,'b,A:Is<'b> + 'a>(x: Inv<'a>, y: Inv<'b>, a: A) {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
// run-pass
|
||||
|
||||
fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a ()
|
||||
where 'a: 'static { t }
|
||||
//~^ WARN unnecessary lifetime parameter `'a`
|
||||
|
||||
fn static_id<'a>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'static { t }
|
||||
//~^ WARN unnecessary lifetime parameter `'a`
|
||||
|
||||
fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'b, 'b: 'static { t }
|
||||
//~^ WARN unnecessary lifetime parameter `'b`
|
||||
|
||||
fn ref_id<'a>(t: &'a ()) -> &'a () where 'static: 'a { t }
|
||||
|
||||
static UNIT: () = ();
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
warning: unnecessary lifetime parameter `'a`
|
||||
--> $DIR/regions-static-bound-rpass.rs:5:5
|
||||
--> $DIR/regions-static-bound-rpass.rs:4:11
|
||||
|
|
||||
LL | 'a: 'static,
|
||||
| ^^
|
||||
LL | where 'a: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
warning: unnecessary lifetime parameter `'a`
|
||||
--> $DIR/regions-static-bound-rpass.rs:12:5
|
||||
--> $DIR/regions-static-bound-rpass.rs:8:11
|
||||
|
|
||||
LL | 'a: 'static,
|
||||
| ^^
|
||||
LL | where 'a: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
warning: unnecessary lifetime parameter `'b`
|
||||
--> $DIR/regions-static-bound-rpass.rs:20:5
|
||||
--> $DIR/regions-static-bound-rpass.rs:12:19
|
||||
|
|
||||
LL | 'b: 'static,
|
||||
| ^^
|
||||
LL | where 'a: 'b, 'b: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'b`
|
||||
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
warning: unnecessary lifetime parameter `'a`
|
||||
--> $DIR/regions-static-bound.rs:6:11
|
||||
|
|
||||
LL | where 'a: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
warning: unnecessary lifetime parameter `'b`
|
||||
--> $DIR/regions-static-bound.rs:10:19
|
||||
|
|
||||
LL | where 'a: 'b, 'b: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'b`
|
||||
|
||||
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||
--> $DIR/regions-static-bound.rs:10:5
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
|
|
||||
LL | t
|
||||
| ^
|
||||
|
|
||||
= note: ...the reference is valid for the static lifetime...
|
||||
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
|
||||
--> $DIR/regions-static-bound.rs:9:24
|
||||
--> $DIR/regions-static-bound.rs:13:24
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| ^^
|
||||
|
||||
error[E0759]: `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
--> $DIR/regions-static-bound.rs:20:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
|
@ -20,13 +36,13 @@ LL | static_id(&u);
|
|||
| ^^^^^^^^^ -- ...is used here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
--> $DIR/regions-static-bound.rs:20:5
|
||||
|
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/regions-static-bound.rs:19:5
|
||||
--> $DIR/regions-static-bound.rs:23:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
|
@ -35,12 +51,12 @@ LL | static_id_indirect(&v);
|
|||
| ^^^^^^^^^^^^^^^^^^ -- ...is used here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/regions-static-bound.rs:19:5
|
||||
--> $DIR/regions-static-bound.rs:23:5
|
||||
|
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 3 previous errors; 2 warnings emitted
|
||||
|
||||
Some errors have detailed explanations: E0312, E0759.
|
||||
For more information about an error, try `rustc --explain E0312`.
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
warning: unnecessary lifetime parameter `'a`
|
||||
--> $DIR/regions-static-bound.rs:6:11
|
||||
|
|
||||
LL | where 'a: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
warning: unnecessary lifetime parameter `'b`
|
||||
--> $DIR/regions-static-bound.rs:10:19
|
||||
|
|
||||
LL | where 'a: 'b, 'b: 'static { t }
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'b`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/regions-static-bound.rs:10:5
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -7,7 +23,7 @@ LL | t
|
|||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
--> $DIR/regions-static-bound.rs:20:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| - - let's call the lifetime of this reference `'1`
|
||||
|
@ -20,7 +36,7 @@ LL | static_id(&u);
|
|||
| argument requires that `'1` must outlive `'static`
|
||||
|
||||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/regions-static-bound.rs:19:5
|
||||
--> $DIR/regions-static-bound.rs:23:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| - - let's call the lifetime of this reference `'2`
|
||||
|
@ -33,6 +49,6 @@ LL | static_id_indirect(&v);
|
|||
| `v` escapes the function body here
|
||||
| argument requires that `'2` must outlive `'static`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 3 previous errors; 2 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0521`.
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
|
||||
fn static_id<'a,'b>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'static { t }
|
||||
//~^ WARN unnecessary lifetime parameter `'a`
|
||||
|
||||
fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'b, 'b: 'static { t }
|
||||
//~^ WARN unnecessary lifetime parameter `'b`
|
||||
|
||||
fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
t
|
||||
//[base]~^ ERROR E0312
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/dont-infer-static.rs:8:10
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -11,6 +9,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct Bar<T: 'static> {
|
||||
| ^^^^^^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Foo<U: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,27 +1,35 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-enum-not-wf.rs:17:18
|
||||
|
|
||||
LL | enum Ref1<'a, T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | Ref1Variant1(RequireOutlives<'a, T>),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | enum Ref1<'a, T: 'a> {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-enum-not-wf.rs:22:25
|
||||
|
|
||||
LL | enum Ref2<'a, T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | Ref2Variant1,
|
||||
LL | Ref2Variant2(isize, RequireOutlives<'a, T>),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | enum Ref2<'a, T: 'a> {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-enum-not-wf.rs:35:23
|
||||
|
|
||||
LL | enum RefDouble<'a, 'b, T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'b`
|
||||
LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | enum RefDouble<'a, 'b, T: 'b> {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-struct-not-wf.rs:13:16
|
||||
|
|
||||
LL | impl<'a, T> Trait<'a, T> for usize {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | type Out = &'a T;
|
||||
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/regions-struct-not-wf.rs:21:16
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -19,6 +20,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | struct RefOk<'a, T:'a> {
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
|
||||
| ++++
|
||||
|
||||
error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
|
||||
--> $DIR/regions-struct-not-wf.rs:25:16
|
||||
|
|
|
@ -2,7 +2,7 @@ warning: unnecessary lifetime parameter `'a`
|
|||
--> $DIR/static-lifetime-bound.rs:1:6
|
||||
|
|
||||
LL | fn f<'a: 'static>(_: &'a i32) {}
|
||||
| ^^^^^^^^^^^
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
|
||||
fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized {
|
||||
println!("{:?}", x);
|
||||
//~^ ERROR doesn't implement
|
||||
}
|
||||
|
|
|
@ -65,10 +65,10 @@ LL | println!("{:?}", x);
|
|||
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `X`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
|
||||
| ++++++++++++++++++++
|
||||
LL | fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/bound-suggestions.rs:44:46
|
||||
|
|
|
@ -8,7 +8,7 @@ LL | foo.hello();
|
|||
help: the following trait defines an item `hello`, perhaps you need to restrict type parameter `impl Foo` with it:
|
||||
|
|
||||
LL | fn test(foo: impl Foo + Bar) {
|
||||
| ~~~~~~~~~~~~~~
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | x.method()
|
|||
= help: items from traits can only be used if the type parameter is bounded by the trait
|
||||
help: the following trait defines an item `method`, perhaps you need to restrict type parameter `T` with it:
|
||||
|
|
||||
LL | fn call_method<T: Foo + std::fmt::Debug>(x: &T) {
|
||||
| ~~~~~~~~
|
||||
LL | fn call_method<T: std::fmt::Debug + Foo>(x: &T) {
|
||||
| +++++
|
||||
|
||||
error[E0599]: no method named `method` found for type parameter `T` in the current scope
|
||||
--> $DIR/issue-21673.rs:10:7
|
||||
|
@ -20,7 +20,7 @@ LL | x.method()
|
|||
help: the following trait defines an item `method`, perhaps you need to restrict type parameter `T` with it:
|
||||
|
|
||||
LL | fn call_method_2<T: Foo>(x: T) {
|
||||
| ~~~~~~
|
||||
| +++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
error[E0311]: the parameter type `T` may not live long enough
|
||||
--> $DIR/missing-lifetimes-in-signature-2.rs:20:9
|
||||
|
|
||||
LL | fn func<T: Test>(foo: &Foo, t: T) {
|
||||
| -- help: consider adding an explicit lifetime bound...: `T: 'a +`
|
||||
LL | foo.bar(move |_| {
|
||||
| ^^^
|
||||
|
|
||||
|
@ -21,6 +19,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | F: 'a,
|
||||
| ^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn func<T: Test + 'a>(foo: &Foo, t: T) {
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -41,8 +41,11 @@ LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
help: consider introducing an explicit lifetime bound
|
||||
|
|
||||
LL | fn bar<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
|
||||
| ~~~~~ ++++
|
||||
LL ~ fn bar<'a, G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
|
||||
LL |
|
||||
LL | where
|
||||
LL ~ G: Get<T> + 'a,
|
||||
|
|
||||
|
||||
error[E0311]: the parameter type `G` may not live long enough
|
||||
--> $DIR/missing-lifetimes-in-signature.rs:48:45
|
||||
|
@ -62,8 +65,8 @@ LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
help: consider introducing an explicit lifetime bound
|
||||
|
|
||||
LL | fn qux<'b, 'a, G: 'b + 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b
|
||||
| +++ ~~~~~~~ ++++
|
||||
LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b
|
||||
| +++ ++++ ++++
|
||||
|
||||
error[E0311]: the parameter type `G` may not live long enough
|
||||
--> $DIR/missing-lifetimes-in-signature.rs:60:58
|
||||
|
@ -83,8 +86,8 @@ LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
|
|||
| ^^^^^^^^^^^^^^^^^^
|
||||
help: consider introducing an explicit lifetime bound
|
||||
|
|
||||
LL | fn qux<'c, 'b, G: 'c + Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c {
|
||||
| +++ ~~~~~~~ ++++
|
||||
LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c {
|
||||
| +++ ++++ ++++
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `dest`
|
||||
--> $DIR/missing-lifetimes-in-signature.rs:69:45
|
||||
|
@ -98,9 +101,12 @@ error[E0309]: the parameter type `G` may not live long enough
|
|||
--> $DIR/missing-lifetimes-in-signature.rs:80:44
|
||||
|
|
||||
LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
|
||||
| - ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:85:5: 87:6]` will meet its required lifetime bounds
|
||||
| |
|
||||
| help: consider adding an explicit lifetime bound...: `G: 'a`
|
||||
| ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:85:5: 87:6]` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | G: Get<T> + 'a,
|
||||
| ++++
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ LL | fn is_send<T: Send>(val: T) {}
|
|||
| ^^^^ required by this bound in `is_send`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | fn use_bound_and_where<S: Sync>(val: S) where S: std::fmt::Debug + std::marker::Send {
|
||||
| +++++++++++++++++++
|
||||
LL | fn use_bound_and_where<S: Sync + std::marker::Send>(val: S) where S: std::fmt::Debug {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: `S` cannot be sent between threads safely
|
||||
--> $DIR/restrict-type-argument.rs:28:13
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
error[E0310]: the parameter type `impl Debug` may not live long enough
|
||||
--> $DIR/suggest-impl-trait-lifetime.rs:7:5
|
||||
|
|
||||
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...
|
||||
|
|
||||
|
@ -12,6 +9,10 @@ note: ...that is required by this bound
|
|||
|
|
||||
LL | fn bar(d: impl Debug + 'static) {
|
||||
| ^^^^^^^
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn foo(d: impl Debug + 'static) {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | t.foo()
|
|||
= help: items from traits can only be used if the type parameter is bounded by the trait
|
||||
help: the following trait defines an item `foo`, perhaps you need to restrict type parameter `T` with it:
|
||||
|
|
||||
LL | fn do_stuff<T: Foo + Bar>(t : T) {
|
||||
| ~~~~~~~~
|
||||
LL | fn do_stuff<T : Bar + Foo>(t : T) {
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | t.clone();
|
|||
= help: items from traits can only be used if the type parameter is bounded by the trait
|
||||
help: the following trait defines an item `clone`, perhaps you need to restrict type parameter `T` with it:
|
||||
|
|
||||
LL | fn foo<T: Clone>(t: T) {
|
||||
| ~~~~~~~~
|
||||
LL | fn foo<T: Clone:>(t: T) {
|
||||
| +++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ warning: unnecessary lifetime parameter `'a`
|
|||
--> $DIR/bounds-are-checked.rs:8:6
|
||||
|
|
||||
LL | fn f<'a: 'static>(t: &'a str) -> X<'a> {
|
||||
| ^^^^^^^^^^^
|
||||
| ^^
|
||||
|
|
||||
= help: you can use the `'static` lifetime directly, in place of `'a`
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@ LL | type WrongGeneric<T> = impl 'static;
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/generic_type_does_not_live_long_enough.rs:18:5
|
||||
|
|
||||
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | t
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@ LL | type WrongGeneric<T> = impl 'static;
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/generic_type_does_not_live_long_enough.rs:18:5
|
||||
|
|
||||
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | t
|
||||
| ^ ...so that the type `T` will meet its required lifetime bounds
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-impl-associated-type-region.rs:10:16
|
||||
|
|
||||
LL | impl<'a, T> Foo<'a> for T {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | type Bar = &'a T;
|
||||
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<'a, T: 'a> Foo<'a> for T {
|
||||
| ++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-in-fn-type-static.rs:13:8
|
||||
|
|
||||
LL | struct Foo<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | // needs T: 'static
|
||||
LL | x: fn() -> &'static T
|
||||
| ^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Foo<T: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-in-fn-type-static.rs:18:8
|
||||
|
|
||||
LL | struct Bar<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | // needs T: Copy
|
||||
LL | x: fn(&'static T)
|
||||
| ^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Bar<T: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-in-obj-type-static.rs:14:8
|
||||
|
|
||||
LL | struct Foo<T> {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'static`
|
||||
LL | // needs T: 'static
|
||||
LL | x: dyn Object<&'static T>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | struct Foo<T: 'static> {
|
||||
| +++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
|
||||
|
|
||||
LL | impl<'a, T> Trait<'a, T> for usize {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | type Out = &'a fn(T);
|
||||
| ^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
|
||||
| ++++
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
|
||||
|
|
||||
LL | impl<'a, T> Trait<'a, T> for u32 {
|
||||
| - help: consider adding an explicit lifetime bound...: `T: 'a`
|
||||
LL | type Out = &'a dyn Baz<T>;
|
||||
| ^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
|
||||
|
|
||||
help: consider adding an explicit lifetime bound...
|
||||
|
|
||||
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -6,12 +6,6 @@ LL | fn unused_lt<'a>(x: u8) {}
|
|||
|
|
||||
= note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings`
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:16:25
|
||||
|
|
||||
LL | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
|
||||
| ^^
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:41:10
|
||||
|
|
||||
|
@ -24,5 +18,5 @@ error: this lifetime isn't used in the function definition
|
|||
LL | fn unused_lt<'a>(x: u8) {}
|
||||
| ^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -108,12 +108,6 @@ error: explicit lifetimes given in parameter types where they could be elided (o
|
|||
LL | fn baz<'a>(&'a self) -> impl Foo + 'a {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:307:5
|
||||
|
|
||||
LL | fn impl_trait_elidable_nested_named_lifetimes<'a>(i: &'a i32, f: impl for<'b> Fn(&'b i32) -> &'b i32) -> &'a i32 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/needless_lifetimes.rs:310:5
|
||||
|
|
||||
|
@ -192,5 +186,5 @@ error: explicit lifetimes given in parameter types where they could be elided (o
|
|||
LL | fn lifetime_elsewhere_provided<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 32 previous errors
|
||||
error: aborting due to 31 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue