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

Treat trailing semicolon as a statement in macro call #78376

Merged
merged 1 commit into from
Nov 3, 2020

Commits on Nov 2, 2020

  1. Treat trailing semicolon as a statement in macro call

    See rust-lang#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.
    Aaron1011 committed Nov 2, 2020
    Configuration menu
    Copy the full SHA
    e78e9d4 View commit details
    Browse the repository at this point in the history