Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable code formatting involving some macros (every rustfmt run indents some lines further) #88959

Closed
chris-morgan opened this issue Sep 15, 2021 · 1 comment
Labels
C-bug Category: This is a bug.

Comments

@chris-morgan
Copy link
Member

Sample code, minimised as far as I was able:

macro_rules! alpha {
    () => {
        macro_rules! beta {
            () => {
                gamma!(
                    *
                )
            };
        }
    };
}

Every time you run rustfmt over it, it indents lines 4–9 by another two levels.

Closely related, if you remove the first and last two lines (the outer macro_rules layer), formatting leaves lines 4–9 at whatever level it finds them rather than correcting their indentation. (But this is probably better than indenting them by two levels.)

Reproduced on rustc 1.57.0-nightly (c3c0f80 2021-09-14).

@chris-morgan chris-morgan added the C-bug Category: This is a bug. label Sep 15, 2021
@chris-morgan
Copy link
Member Author

Oops, saw A-rustfmt and figured bugs were going here, but after posting I thought to look further and found the rustfmt repository where has a couple of reports of this exact issue, e.g. rust-lang/rustfmt#4609. What’s the deal with A-rustfmt versus the rustfmt repository? Anyway, closing in favour of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant