Skip to content

Defining generics in a macro inside macro causes infinite indentation #6299

Open
@maxcabrajac

Description

@maxcabrajac
macro_rules! example {
    (good) => {
        macro_rules! good {
            () => {
                A
            };
        }
    };
    (bad) => {
        macro_rules! bad {
            () => {
                A<'a>
            };
        }
    };
    (alsobad) => {
        macro_rules! bad {
            () => {
                A<B>
            };
        }
    };
}

Running multiple rounds of fmt in this causes both versions of bad's body to be indented indefinitely, but not good's.
Might be related to #4609, #5044 and other issues involving infinite indentation, but none of them mentioned generics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-macrosbugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions