Skip to content

Rustfmt breaks static async closure #5149

@dtolnay

Description

@dtolnay
#![feature(async_closure)]

macro_rules! expr {
    ($e:expr) => {};
}

expr!(static async || {});

As of current master (7b8303d), cargo run --bin rustfmt -- repro.rs --emit=stdout --edition=2021 creates the following diff:

- expr!(static async || {});
+ expr!(async static || {});

which fails to compile:

error: expected one of `move`, `|`, or `||`, found keyword `static`
 --> repro.rs:7:13
  |
4 |     ($e:expr) => {};
  |      ------- while parsing argument for this `expr` macro fragment
...
7 | expr!(async static || {});
  |             ^^^^^^ expected one of `move`, `|`, or `||`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions