Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate the span of Self keyword to QSelf #103

Merged
merged 1 commit into from Jun 8, 2020
Merged

Conversation

taiki-e
Copy link
Contributor

@taiki-e taiki-e commented Jun 7, 2020

A similar case to #102.

The following code:

pub enum E {
    V {}
}

#[async_trait]
impl Trait for E {
    async fn method(self) {
        let _: () = self;
        let _: Self = Self::V;
    }
}

The error message points to call-site span:

error[E0533]: expected unit struct, unit variant or constant, found struct variant `#[async_trait]`
  --> $DIR/self-span.rs:22:1
   |
22 | #[async_trait]
   | ^^^^^^^^^^^^^^
   |

This PR fixes span of < and > tokens of QSelf to make the error message to point to the correct span:

error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V`
  --> $DIR/self-span.rs:26:23
   |
26 |         let _: Self = Self::V;
   |                       ^^^^^^^

(this originally caught in taiki-e/pin-project#249. also serde-rs/serde#1830 is already updated to include this)

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you.

@dtolnay dtolnay merged commit 9d364cf into dtolnay:master Jun 8, 2020
@taiki-e taiki-e deleted the self branch June 8, 2020 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants