2020-06-29 11:14:42 -07:00
|
|
|
error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:20:13
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
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>()
|
2020-06-26 18:52:00 -07:00
|
|
|
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
|
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
note: `impl` of `foo::MyTrait` has a `'static` requirement
|
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:14:32
|
2020-06-28 18:07:26 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -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
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ {
|
|
|
|
| ^^^^
|
2020-06-26 18:52:00 -07:00
|
|
|
|
2020-06-29 11:14:42 -07:00
|
|
|
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:13
|
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
|
|
|
|
| ------------------- this data with lifetime `'a`...
|
|
|
|
LL | val.use_self()
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^ ...is captured and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl`
|
2020-06-28 15:26:12 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
note: inherent `impl` has a `'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:64:14
|
|
|
|
|
|
|
|
|
LL | impl dyn ObjectTrait {
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 17:41:15 -07:00
|
|
|
| -------- calling this method introduces the `impl`'s 'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
|
|
|
|
|
LL | impl dyn ObjectTrait + '_ {
|
|
|
|
| ^^^^
|
|
|
|
|
2020-06-29 11:14:42 -07:00
|
|
|
error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
|
2020-06-30 17:41:15 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:87:13
|
2020-06-29 11:14:42 -07:00
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
|
|
|
|
| ------------------- this data with lifetime `'a`...
|
|
|
|
LL | val.use_self()
|
|
|
|
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
|
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
note: `impl` of `ban::MyTrait` has a `'static` requirement
|
2020-06-29 11:14:42 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:83:26
|
|
|
|
|
|
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 17:41:15 -07:00
|
|
|
| -------- calling this method introduces the `impl`'s 'static` requirement
|
|
|
|
...
|
|
|
|
LL | impl MyTrait for dyn ObjectTrait {}
|
|
|
|
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
|
2020-06-29 11:14:42 -07:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
LL | impl MyTrait for dyn ObjectTrait + '_ {}
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^
|
|
|
|
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[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:37:13
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
|
|
|
|
| ------------------- this data with lifetime `'a`...
|
|
|
|
LL | val.use_self()
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^ ...is captured and required to live as long as `'static` here because of an implicit lifetime on the `impl` of `bar::MyTrait`
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
note: `impl` of `bar::MyTrait` has a `'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:31:26
|
|
|
|
|
|
|
|
|
LL | impl MyTrait for dyn ObjectTrait {
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 17:41:15 -07:00
|
|
|
| -------- calling this method introduces the `impl`'s 'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
|
|
|
LL | impl MyTrait for dyn ObjectTrait + '_ {
|
|
|
|
| ^^^^
|
|
|
|
|
2020-06-29 11:14:42 -07:00
|
|
|
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:54:13
|
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
|
|
|
|
| ----------------------------- this data with lifetime `'a`...
|
|
|
|
LL | val.use_self()
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^ ...is captured and required to live as long as `'static` here because of an implicit lifetime on the `impl` of `baz::MyTrait`
|
2020-06-28 15:26:12 -07:00
|
|
|
|
|
2020-06-30 17:41:15 -07:00
|
|
|
note: `impl` of `baz::MyTrait` has a `'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:48:30
|
|
|
|
|
|
|
|
|
LL | impl MyTrait for Box<dyn ObjectTrait> {
|
2020-06-29 11:14:42 -07:00
|
|
|
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 17:41:15 -07:00
|
|
|
| -------- calling this method introduces the `impl`'s 'static` requirement
|
2020-06-28 18:07:26 -07:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
2020-06-28 15:26:12 -07:00
|
|
|
|
|
|
|
|
LL | impl MyTrait for Box<dyn ObjectTrait + '_> {
|
|
|
|
| ^^^^
|
|
|
|
|
2020-06-29 11:14:42 -07:00
|
|
|
error: aborting due to 5 previous errors
|
2020-06-26 18:52:00 -07:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0759`.
|