Skip to content

Keep non-brace macro invocations in trailing expr position as Expr::Macro#1420

Merged
dtolnay merged 1 commit intomasterfrom
nonbracemacro
Mar 22, 2023
Merged

Keep non-brace macro invocations in trailing expr position as Expr::Macro#1420
dtolnay merged 1 commit intomasterfrom
nonbracemacro

Conversation

@dtolnay
Copy link
Owner

@dtolnay dtolnay commented Mar 22, 2023

Rust does not allow a stmt macro to be called with this syntax.

macro_rules! m {
    () => {
        struct S;
    }
}

fn main() {
    m!()
}

But if the call is written as m!(); or m! {}, we'll continue to parse it as Stmt::Macro.

@dtolnay dtolnay merged commit e76d644 into master Mar 22, 2023
@dtolnay dtolnay deleted the nonbracemacro branch March 22, 2023 20:27
smoelius added a commit to trailofbits/necessist that referenced this pull request Apr 1, 2023
dependabot bot pushed a commit to trailofbits/necessist that referenced this pull request Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant