Skip to content

Indentation in macro is increased in each run (non-idempotent) #5778

Closed as not planned
@JanBeh

Description

@JanBeh

The following code is given:

macro_rules! m {
    ($x:tt) => {
        type T = $x
        where
            A: B;
    };
}

Running rustfmt results in:

macro_rules! m {
    ($x:tt) => {
        type T = $x
                where
                    A: B;
    };
}

Running it again:

macro_rules! m {
    ($x:tt) => {
        type T = $x
                        where
                            A: B;
    };
}

And so on.

The following smaller example is idempotent, however:

 macro_rules! m {
     ($x:tt) => {
-        type T = $x
+        type $x
         where
             A: B;
     };

I'm using:

rustfmt 1.5.2-nightly (b2b34bd8 2023-06-06)

The above example is a minimal example to reproduce the problem. The full code I used can be found here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions