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

Can't parse binops after blocks in... some cases(?) #7909

Closed
bblum opened this issue Jul 19, 2013 · 3 comments
Closed

Can't parse binops after blocks in... some cases(?) #7909

bblum opened this issue Jul 19, 2013 · 3 comments
Labels
A-parser Area: The parsing of Rust source code to an AST.

Comments

@bblum
Copy link
Contributor

bblum commented Jul 19, 2013

This gives unexpected token on the ==. But if you change foo to use explicit return, with a semicolon after it, or if you put the binary equals expression inside of an assert, it appears to work fine.

fn foo() -> bool {
    { true } == true
}
fn main() {}
@huonw
Copy link
Member

huonw commented Jul 20, 2013

I believe this is because the parser sees { and that means that the {true} is parsed as a block; in the other two instances, i.e. return {true} == true; and assert!({true} == true), the surrounds force {true} == true to be parsed as an expression, which works.

@bblum
Copy link
Contributor Author

bblum commented Aug 9, 2013

not really a bwds-compat hazard, since it's less permissive than it should be. nominating well covered.

@catamorphism
Copy link
Contributor

wontfix -- this is by design, to avoid lookahead

flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
Fix false negative in [`match_overlapping_arms`]

changelog: Fix false negative in [`match_overlapping_arms`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST.
Projects
None yet
Development

No branches or pull requests

3 participants