Open
Description
#![feature(async_fn_in_trait)]
fn main() {}
trait MyTrait<T> {
async fn foo(&mut self) -> T;
}
impl<T> MyTrait<bool> for T {
async fn foo(&mut self) -> bool {
true
}
}
impl<T> MyTrait<i32> for T {
async fn foo(&mut self) -> i32 {
let x: bool = self.foo().await; //error[E0698]: type inside `async fn` body must be known in this context
42
}
}
works fine when removing async
or using the async-trait
crate
workaround:
let x: bool = MyTrait::<bool>::foo(self).await;
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: Type inferenceAsync-await issues that have been triaged during a working group meeting.Relevant to the compiler team, which will review and decide on the PR/issue.Working group: Async & await