- Notifications
You must be signed in to change notification settings - Fork 973
Open
Labels
A-commentsArea: commentsArea: commentsA-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)P-lowLow priorityLow priority
Description
Rust allows placing comments inside macro names between the macro identifier and the exclamation/bang (playground link)
This comment is gobbled by rustfmt:
$ cat x.rs fn main() { println/*test*/!("hi"); } $ rustc x.rs && ./x hi $ rustfmt --check x.rs Diff in /tmp/x.rs:1: fn main() { - println/*test*/!("hi"); + println!("hi"); } $ rustc --version && rustfmt --version rustc 1.85.0 (4d91de4e4 2025-02-17) rustfmt 1.8.0-stable (4d91de4e48 2025-02-17)Admittedly, this is a silly case and I don't expect anyone to actually be using this "feature" of Rust, but I thought I should document this low-priority issue that I found a little funny.
Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsA-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)P-lowLow priorityLow priority