dtolnay / async-trait

Type erasure for async trait methods
Apache License 2.0
1.81k stars 84 forks source link

[Bug?] Error "expected trait impl" on associated impls #251

Closed ghost closed 1 year ago

ghost commented 1 year ago

description

I'm unsure whether this is just a limitation of the syn crate or a design choice within this crate, but when i use the async_trait macro on an associated impl, it gives the error expected trait impl. It's not the end of the world, i can make a separate trait for it, but that would be a little annoying to do.

expected behavior

I would expect asociated impls to be treated the same as trait impls, but maybe that's a me issue lol.

versions

rust version: 1.70.0 async_trait version: 0.1.69

minimal example

playground link

use async_trait::async_trait;

struct Test;

#[async_trait] // expected trait impl
impl Test {
    async fn test_fn() {}
}
dtolnay commented 1 year ago

Async-trait is for trait impls. The code you showed does not involve traits whatsoever.

ghost commented 1 year ago

okay, it's a me-issue then, thanks for clarifying ^^