]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #78376 - Aaron1011:feature/consistent-empty-expr, r=petrochenkov
authorYuki Okushi <huyuumi.dev@gmail.com>
Tue, 3 Nov 2020 06:27:03 +0000 (15:27 +0900)
committerGitHub <noreply@github.com>
Tue, 3 Nov 2020 06:27:03 +0000 (15:27 +0900)
commit0716724a0b29269ba3b79abb65f1f0505e5bb0ec
treed9e9e635c41b6d29e9edf0c90ff7cf02e563d23e
parent4c0c5e099a3b1f1c6ad53115189c2710495588b3
parente78e9d4a06192cfbb9e1417fdd7a0753d51684a3
Rollup merge of #78376 - Aaron1011:feature/consistent-empty-expr, r=petrochenkov

Treat trailing semicolon as a statement in macro call

See #61733 (comment)

We now preserve the trailing semicolon in a macro invocation, even if
the macro expands to nothing. As a result, the following code no longer
compiles:

```rust
macro_rules! empty {
    () => { }
}

fn foo() -> bool { //~ ERROR mismatched
    { true } //~ ERROR mismatched
    empty!();
}
```

Previously, `{ true }` would be considered the trailing expression, even
though there's a semicolon in `empty!();`

This makes macro expansion more token-based.