dtolnay / async-trait

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

Failed to resolve `self` in path #158

Closed Stock84-dev closed 3 years ago

Stock84-dev commented 3 years ago

Macro doesn't handle when self is used as path.

use async_trait::async_trait; // 0.1.48

fn bar() {}

#[async_trait]
trait Foo {
    async fn bar(&self) {
        self::bar()
    }
}
error[E0433]: failed to resolve: use of undeclared crate or module `__self`
 --> src/lib.rs:8:9
  |
8 |         self::bar()
  |         ^^^^ use of undeclared crate or module `__self`

Playground

dtolnay commented 3 years ago

Good catch -- I've published a fix in 0.1.49.