Closed thanatos closed 4 years ago
Minimized:
use async_trait::async_trait;
#[async_trait]
trait Trait {
async fn f(&self);
}
#[async_trait]
impl Trait for Send + Sync {
async fn f(&self) {}
}
Fixed in 0.1.30.
Wow that was fast! Also, thank you for an excellent library!
In non-async-trait code, this is currently legal, though it emits a warning that it should have the
dyn
keyword:In async-trait code, this causes a panic:
A full example in the Playground
I'm not sure whether the code should be accepted, given that the current compiler warns that the
impl
w/o thedyn
is deprecated, but I figureasync_trait
might want to either accept w/ a similar warning, or at the very least reject with a clearer error message.(I mostly stumbled into this; I do not think the
impl
is anything close to what I actually want in my real-world use case. The compiler's insistence ondyn
is nice though, since it clued me in that I'm barking up the wrong syntactical tree.)