-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Failure to parse {2} + {2}
#54482
Comments
Note: this is not a regression, these fail to parse all the way back to 1.0. I think this is a duplicate of #7909, but since we are now fairly accepting of look-ahead, this seems fairly valid. |
I believe that conversation is still ongoing, we'll probably have to go the RFCS route for that... |
I'm not certain this is actually a bug; it might be worse for |
This isn't a bug. It falls out of block expression statements terminating at the |
The relevant section of the reference:
While we could theoretically make That said, the error for this is terrible. Most likely you want to change your expression statement to be |
Identify when a stmt could have been parsed as an expr There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar. Fix rust-lang#54186, cc rust-lang#54482, fix rust-lang#59975, fix rust-lang#47287.
The current output for this is:
|
Triage: no change |
These examples should compile according to the rust reference:
(Playground)
Errors:
Rust reference snippet (thanks @Moongoodboy-K for the help here):
cc: @Moongoodboy-K
The text was updated successfully, but these errors were encountered: