2022-04-01 12:13:25 -05:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:21:9
|
2020-06-26 20:52:00 -05:00
|
|
|
|
|
2020-06-30 19:41:15 -05:00
|
|
|
LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a {
|
2022-04-01 12:13:25 -05:00
|
|
|
| -- --- `val` is a reference that is only valid in the function body
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
2020-06-30 19:41:15 -05:00
|
|
|
LL | val.use_self::<T>()
|
2022-04-01 12:13:25 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `val` escapes the function body here
|
|
|
|
| argument requires that `'a` must outlive `'static`
|
2020-06-26 20:52:00 -05:00
|
|
|
|
|
2020-07-01 16:02:57 -05:00
|
|
|
note: the used `impl` has a `'static` requirement
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:15:32
|
2020-06-28 20:07:26 -05:00
|
|
|
|
|
2020-06-30 19:41:15 -05: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 20:07:26 -05:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
2020-06-26 20:52:00 -05:00
|
|
|
|
|
2020-06-30 19:41:15 -05:00
|
|
|
LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ {
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2020-06-26 20:52:00 -05:00
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:70:9
|
2020-06-28 17:26:12 -05:00
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
|
2022-04-01 12:13:25 -05:00
|
|
|
| -- --- `val` is a reference that is only valid in the function body
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
2020-06-28 17:26:12 -05:00
|
|
|
LL | val.use_self()
|
2022-04-01 12:13:25 -05:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `val` escapes the function body here
|
|
|
|
| argument requires that `'a` must outlive `'static`
|
2020-06-28 17:26:12 -05:00
|
|
|
|
|
2020-07-01 16:02:57 -05:00
|
|
|
note: the used `impl` has a `'static` requirement
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:65:14
|
2020-06-28 20:07:26 -05:00
|
|
|
|
|
|
|
|
LL | impl dyn ObjectTrait {
|
2020-06-29 13:14:42 -05:00
|
|
|
| ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
|
2020-06-28 20:07:26 -05:00
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 19:41:15 -05:00
|
|
|
| -------- calling this method introduces the `impl`'s 'static` requirement
|
2020-06-28 20:07:26 -05:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
2020-06-28 17:26:12 -05:00
|
|
|
|
|
|
|
|
LL | impl dyn ObjectTrait + '_ {
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2020-06-28 17:26:12 -05:00
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:90:9
|
2020-06-29 13:14:42 -05:00
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
|
2022-04-01 12:13:25 -05:00
|
|
|
| -- --- `val` is a reference that is only valid in the function body
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
2020-06-29 13:14:42 -05:00
|
|
|
LL | val.use_self()
|
2022-04-01 12:13:25 -05:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `val` escapes the function body here
|
|
|
|
| argument requires that `'a` must outlive `'static`
|
2020-06-29 13:14:42 -05:00
|
|
|
|
|
2020-07-01 16:02:57 -05:00
|
|
|
note: the used `impl` has a `'static` requirement
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:87:26
|
2020-06-29 13:14:42 -05:00
|
|
|
|
|
|
|
|
LL | fn use_self(&self) -> &() { panic!() }
|
2020-06-30 19:41:15 -05: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 13:14:42 -05:00
|
|
|
help: consider relaxing the implicit `'static` requirement
|
|
|
|
|
|
2020-06-30 19:41:15 -05:00
|
|
|
LL | impl MyTrait for dyn ObjectTrait + '_ {}
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2020-06-29 13:14:42 -05:00
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
error[E0521]: borrowed data escapes outside of function
|
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:110:9
|
2020-07-01 16:02:57 -05:00
|
|
|
|
|
|
|
|
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
|
2022-04-01 12:13:25 -05:00
|
|
|
| -- --- `val` is a reference that is only valid in the function body
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
2020-07-01 16:02:57 -05:00
|
|
|
LL | MyTrait::use_self(val)
|
2022-04-01 12:13:25 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `val` escapes the function body here
|
|
|
|
| argument requires that `'a` must outlive `'static`
|
2020-07-01 16:02:57 -05:00
|
|
|
|
|
|
|
|
note: the used `impl` has a `'static` requirement
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:106:26
|
2020-07-01 16:02:57 -05:00
|
|
|
|
|
|
|
|
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 + '_ {}
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2020-07-01 16:02:57 -05:00
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
error: aborting due to 4 previous errors
|
2020-06-26 20:52:00 -05:00
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
For more information about this error, try `rustc --explain E0521`.
|