2019-07-02 13:23:38 -05:00
|
|
|
error: lifetime may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/ret-impl-trait-one.rs:10:85
|
2021-09-23 10:21:01 -05:00
|
|
|
|
|
2022-02-17 10:00:04 -06:00
|
|
|
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
|
|
|
| ________________________________--__--_______________________________________________^
|
|
|
|
| | | |
|
|
|
|
| | | lifetime `'b` defined here
|
|
|
|
| | lifetime `'a` defined here
|
|
|
|
LL | |
|
|
|
|
LL | | (a, b)
|
|
|
|
LL | | }
|
|
|
|
| |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
2021-09-23 10:21:01 -05:00
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'a: 'b`
|
|
|
|
|
2022-07-26 01:19:58 -05:00
|
|
|
error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/ret-impl-trait-one.rs:16:80
|
2019-07-02 13:23:38 -05:00
|
|
|
|
|
2022-02-14 10:10:22 -06:00
|
|
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
|
|
|
| ____________________________________--__________________________________________^
|
|
|
|
| | |
|
|
|
|
| | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
|
|
|
LL | |
|
|
|
|
LL | | (a, b)
|
|
|
|
LL | | }
|
|
|
|
| |_^
|
2021-09-23 10:21:01 -05:00
|
|
|
|
|
2022-01-25 10:51:42 -06:00
|
|
|
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
2019-10-27 09:39:14 -05:00
|
|
|
|
|
2022-01-25 10:51:42 -06:00
|
|
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
|
|
|
| ++++
|
2019-07-02 13:23:38 -05:00
|
|
|
|
2021-09-23 10:21:01 -05:00
|
|
|
error: aborting due to 2 previous errors
|
2019-07-02 13:23:38 -05:00
|
|
|
|
2021-09-23 10:21:01 -05:00
|
|
|
For more information about this error, try `rustc --explain E0700`.
|