Skip to content

"left behind trailing whitespace" on non-meta macro attributes #6648

@maxdexh

Description

@maxdexh

Rustfmt fails with error[internal]: left behind trailing whitespace when formatting attributes that have arguments with trailing whitespace + non-meta format.

#[my_attr(aa bb   
)]    // spaces ^
fn f() {}
#[my_attr(
    aa
    
    bb // (spaces at beginning of previous line)
)]
fn f() {}

Versions tested:

  • rustfmt 1.8.0-stable (29483883ee 2025-08-04)
  • rustfmt 1.7.0-stable (3f5fd8d 2024-08-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions