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

|| () as ()() is no longer supposed to parse #1117

Closed
dtolnay opened this issue Dec 30, 2021 · 0 comments · Fixed by #1142
Closed

|| () as ()() is no longer supposed to parse #1117

dtolnay opened this issue Dec 30, 2021 · 0 comments · Fixed by #1142

Comments

@dtolnay
Copy link
Owner

dtolnay commented Dec 30, 2021

fn main() {
    || () as ()();
}

This used to compile successfully in rustc versions 1.42.0 and older. It was parsed as (|| () as ())(). But since 1.43.0 it is no longer parsed by rustc: rust-lang/rust#68985.

error: casts cannot be followed by a function call
 --> src/main.rs:2:8
  |
2 |     || () as ()();
  |        ^^^^^^^^
  |
help: try surrounding the expression in parentheses
  |
2 |     || (() as ())();
  |        +        +
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 a pull request may close this issue.

1 participant