Files
rust/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

136 lines
6.6 KiB
Plaintext
Raw Normal View History

error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:25:13
|
LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a {
| ---------------------- this data with lifetime `'a`...
LL | val.use_self::<T>()
2021-10-15 15:13:21 +00:00
| ^^^^^^^^ ...is used and required to live as long as `'static` here
|
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:19:32
2020-06-28 18:07:26 -07:00
|
LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> {
| ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
LL | fn use_self<K>(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
2020-06-28 18:07:26 -07:00
help: consider relaxing the implicit `'static` requirement
|
LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ {
| ++++
2020-07-20 13:56:50 -07:00
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:74:13
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| ------------------- this data with lifetime `'a`...
LL | val.use_self()
2021-10-15 15:13:21 +00:00
| ^^^^^^^^ ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl`
|
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:14
2020-06-28 18:07:26 -07:00
|
LL | impl dyn ObjectTrait {
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
2020-06-28 18:07:26 -07:00
LL | fn use_self(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
2020-06-28 18:07:26 -07:00
help: consider relaxing the implicit `'static` requirement
|
LL | impl dyn ObjectTrait + '_ {
| ++++
error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:93:13
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
| ------------------- this data with lifetime `'a`...
LL | val.use_self()
2021-10-15 15:13:21 +00:00
| ^^^^^^^^ ...is used and required to live as long as `'static` here
|
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:90:26
|
LL | fn use_self(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
...
LL | impl MyTrait for dyn ObjectTrait {}
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
help: consider relaxing the implicit `'static` requirement
|
LL | impl MyTrait for dyn ObjectTrait + '_ {}
| ++++
help: to declare that the `impl Trait` captures data from argument `val`, you can add an explicit `'a` lifetime bound
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| ++++
error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:113:27
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| ------------------- this data with lifetime `'a`...
LL | MyTrait::use_self(val)
2021-10-15 15:13:21 +00:00
| ^^^ ...is used here...
|
note: ...and is required to live as long as `'static` here
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:113:9
|
LL | MyTrait::use_self(val)
| ^^^^^^^^^^^^^^^^^
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:109:26
|
LL | fn use_self(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
...
LL | impl MyTrait for dyn ObjectTrait {}
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
help: consider relaxing the implicit `'static` requirement
|
LL | impl MyTrait for dyn ObjectTrait + '_ {}
| ++++
2020-07-20 13:56:50 -07:00
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:42:13
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
| ------------------- this data with lifetime `'a`...
LL | val.use_self()
2021-10-15 15:13:21 +00:00
| ^^^^^^^^ ...is used and required to live as long as `'static` here
|
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:36:26
2020-06-28 18:07:26 -07:00
|
LL | impl MyTrait for dyn ObjectTrait {
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
2020-06-28 18:07:26 -07:00
LL | fn use_self(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
2020-06-28 18:07:26 -07:00
help: consider relaxing the implicit `'static` requirement
|
LL | impl MyTrait for dyn ObjectTrait + '_ {
| ++++
2020-07-20 13:56:50 -07:00
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:59:13
|
LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
| ----------------------------- this data with lifetime `'a`...
LL | val.use_self()
2021-10-15 15:13:21 +00:00
| ^^^^^^^^ ...is used and required to live as long as `'static` here
|
note: the used `impl` has a `'static` requirement
2022-05-22 01:36:12 -04:00
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:53:30
2020-06-28 18:07:26 -07:00
|
LL | impl MyTrait for Box<dyn ObjectTrait> {
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
2020-06-28 18:07:26 -07:00
LL | fn use_self(&self) -> &() { panic!() }
| -------- calling this method introduces the `impl`'s 'static` requirement
2020-06-28 18:07:26 -07:00
help: consider relaxing the implicit `'static` requirement
|
LL | impl MyTrait for Box<dyn ObjectTrait + '_> {
| ++++
error: aborting due to 6 previous errors
2022-01-28 11:00:56 -05:00
Some errors have detailed explanations: E0759, E0772.
For more information about an error, try `rustc --explain E0759`.