Below is an async fn that does not compile:
async fn trouble(_: &str, _: &str, _: &'static str) {}
with message:
error[E0700]: hidden type for
impl Trait
captures lifetime that does not appear in bounds
But the problem disappears as soon as we change the signature. All of the following are good:
async fn ok_str_str(_: &str, _: &str) {}
async fn ok_str_str_str(_: &str, _: &str, _: &str) {}
async fn ok_str_static(_: &str, _: &'static str) {}
async fn ok_str_static_static(_: &str, _: &'static str, _: &'static str) {}
fn ok_str_str_static_desugar(_: &str, _: &str, _: &'static str) -> impl Future<Output = ()> {
async { () }
}
Why is this happening? Playground link.