]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/nested-return-type4.stderr
Rollup merge of #106799 - scottmcm:remove-unused-generics, r=cuviper
[rust.git] / tests / ui / impl-trait / nested-return-type4.stderr
1 error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifetime that does not appear in bounds
2   --> $DIR/nested-return-type4.rs:4:5
3    |
4 LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> {
5    |         -- hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here
6 LL |     async move { let _s = s; }
7    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
8    |
9 help: to declare that `impl Future<Output = impl Sized>` captures `'s`, you can add an explicit `'s` lifetime bound
10    |
11 LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> + 's {
12    |                                                                              ++++
13 help: to declare that `impl Sized` captures `'s`, you can add an explicit `'s` lifetime bound
14    |
15 LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized + 's> {
16    |                                                                             ++++
17
18 error: aborting due to previous error
19
20 For more information about this error, try `rustc --explain E0700`.