]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
Account for multiple impl/dyn Trait in return type when suggesting `'_`
[rust.git] / src / test / ui / self / arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
1 error[E0759]: cannot infer an appropriate lifetime
2   --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:16
3    |
4 LL |     async fn f(self: Pin<&Self>) -> impl Clone { self }
5    |                ^^^^  ----------     ---------- ...and is required to live as long as `'static` here
6    |                |     |
7    |                |     this data with an anonymous lifetime `'_`...
8    |                ...is captured here...
9    |
10 help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
11    |
12 LL |     async fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
13    |                                                ^^^^
14
15 error: aborting due to previous error
16
17 For more information about this error, try `rustc --explain E0759`.