Skip to content

Fix return precedence in match guard #1528

@dtolnay

Description

@dtolnay

With feature(if_let_guard), the following is valid Rust syntax.

fn ret_guard() {
    match 2 {
      x if let true = return => { x; }
      _ => {}
    }
}

Syn currently fails to parse it:

error: expected an expression
 --> dev/main.rs:3:30
  |
3 |       x if let true = return => { x; }
  |                              ^

Tracking issue: rust-lang/rust#51114

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions