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

Empty comment before match causes parse error #1306

Closed
dafaust opened this issue Jun 9, 2022 · 0 comments · Fixed by #1309
Closed

Empty comment before match causes parse error #1306

dafaust opened this issue Jun 9, 2022 · 0 comments · Fixed by #1309

Comments

@dafaust
Copy link
Collaborator

dafaust commented Jun 9, 2022

I tried this code:

fn foo (x: i8) -> i32 {
    //
    match x {
        1 => { return 1; }
        _ => { return 0; }
    }
}

I expected to see this happen: Compiles without error.

Instead, this happened:

bug.rs:3:11: error: expecting ‘}’ but ‘=>’ found
    3 |     match x {
      |           ^
bug.rs:3:11: error: error may be from having an expression (as opposed to statement) in the body of the function but not last
bug.rs:6:1: error: unrecognised token ‘}’ for start of item
    6 |     }
      | ^
bug.rs:6:1: error: failed to parse item in crate

Compiles fine without the empty comment line.

Meta

  • What version of Rust GCC were you using, git sha if possible: e6d32d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant