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

Incomplete macro_rules definition is deleted #6037

Open
Jarcho opened this issue Jan 21, 2024 · 1 comment
Open

Incomplete macro_rules definition is deleted #6037

Jarcho opened this issue Jan 21, 2024 · 1 comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.

Comments

@Jarcho
Copy link

Jarcho commented Jan 21, 2024

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)

@ytmimi
Copy link
Contributor

ytmimi commented Jan 21, 2024

seems related to changes made in #5883. probably need to go back and update the logic to take incomplete matchers into account.

@ytmimi ytmimi added bug Panic, non-idempotency, invalid code, etc. a-macros labels Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants