error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds --> $DIR/nested-return-type4.rs:4:5 | LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { | -- --------------------------------------------- opaque type defined here | | | hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here LL | async move { let _s = s; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: to declare that `impl Future` captures `'s`, you can add an explicit `'s` lifetime bound | LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future + 's { | ++++ help: to declare that `impl Sized` captures `'s`, you can add an explicit `'s` lifetime bound | LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { | ++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0700`.