-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Rustfmt break macros which match on empty angle brackets #7136
Copy link
Copy link
Open
Labels
A-genericsArea: genericsArea: genericsA-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failI-unexpectedly-removes-codeIssue: unexpectedly removes code that we should not be removingIssue: unexpectedly removes code that we should not be removing
Description
Activity
Metadata
Metadata
Assignees
Labels
A-genericsArea: genericsArea: genericsA-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-invalid-codeIssue: formatting causes compile-pass code to compile-failIssue: formatting causes compile-pass code to compile-failI-unexpectedly-removes-codeIssue: unexpectedly removes code that we should not be removingIssue: unexpectedly removes code that we should not be removing
Summary
If a macro needs empty angle brackets after an ident, rustfmt may end up deleting them.
I tried to format this code:
Expected behavior
The angle brackets should remain.
Actual behavior
The angle brackets are deleted, leading the code to no longer compile after formatting.
Configuration
Reproduces on the playground.
Reproduction Steps
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=4787f0b7d4242108cd3982d5c7748ba1
Meta
I checked if this bug was reported previously by looking for "angle brackets", and I didn't see any similar threads.