Skip to content

Incomplete macro_rules definition is deleted #6037

Open
@Jarcho

Description

@Jarcho

Given a macro_rules definition containing only a matcher without a body, rustfmt will delete the matcher text. e.g.

macro_rules! foo { (foo) }

Is converted to:

macro_rules! foo {}

This happens for any brace style, but only if they're the last token. e.g. the following works properly:

macro_rules! foo { (foo) => }

using rustfmt 1.7.0-stable (82e1608d 2023-12-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-macrosbugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions