Closed
Description
#![feature(async_await)]
use std::marker::PhantomData;
trait Trait {}
async fn f<'a>(reference: &(), marker: PhantomData<dyn Trait>) {}
This fails with:
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> src/main.rs:7:64
|
7 | async fn f<'a>(reference: &(), marker: PhantomData<dyn Trait>) {}
| ^
|
note: hidden type `impl std::future::Future` captures the scope of call-site for function at 7:64
--> src/main.rs:7:64
|
7 | async fn f<'a>(reference: &(), marker: PhantomData<dyn Trait>) {}
| ^^
I believe this should compile because:
-
The non-async function with the same signature does compile;
fn f<'a>(reference: &(), marker: PhantomData<dyn Trait>) {}
-
Seemingly insignificant tweaks, like adding a wrapper struct, make it compile.
struct Wrapper(PhantomData<dyn Trait>); async fn f<'a>(reference: &(), marker: Wrapper) {}
Mentioning @cramertj who fixed a similar error message in #59001.
Mentioning @nikomatsakis who touched this error message in #49041 and #61775.
rustc 1.38.0-nightly (c43753f 2019-07-26)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done