Closed taiki-e closed 4 years ago
The following code:
use async_trait::async_trait; pub struct Struct {} #[async_trait] pub trait Trait { async fn method(self); } #[async_trait] impl Trait for Struct { async fn method(self) { let _: Self = Self; } }
The error message points to wrong span:
error[E0423]: expected value, found struct `Struct` --> src/lib.rs:11:16 | 11 | impl Trait for Struct { | ^^^^^^ did you mean `(Struct { /* fields */ })`? |
This PR fixes span of Self keyword to make the error message to point to the correct span:
error[E0423]: expected value, found struct `Struct` --> $DIR/self-span.rs:14:23 | 3 | pub struct Struct {} | -------------------- `Struct` defined here ... 14 | let _: Self = Self; | ^^^^ did you mean `Struct { /* fields */ }`? |
The following code:
The error message points to wrong span:
This PR fixes span of Self keyword to make the error message to point to the correct span: