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

Incorrect precedence of closure body vs ExprRange rhs #1019

Closed
dtolnay opened this issue Apr 21, 2021 · 0 comments · Fixed by #1020
Closed

Incorrect precedence of closure body vs ExprRange rhs #1019

dtolnay opened this issue Apr 21, 2021 · 0 comments · Fixed by #1020
Labels

Comments

@dtolnay
Copy link
Owner

dtolnay commented Apr 21, 2021

Input:

trait Trait {
    fn method(&self);
}

impl<F: Fn() -> T, T> Trait for F {
    fn method(&self) {}
}

fn main() {
    || .. .method();
}

Rustc's parser accepts this with the precedence as (|| ..).method(), while Syn fails to parse.

error: expected expression
  --> dev/main.rs:10:11
   |
10 |     || .. .method();
   |           ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant