-
Notifications
You must be signed in to change notification settings - Fork 925
Indentation in macro is increased in each run (non-idempotent) #5778
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
Comments
@JanBeh thanks for reaching out! This issue stems from rustfmt's lack of support for formatting associated types using the new recommend style where the For example: type Assoc<Params> = Type where WhereBounds;
type Assoc<Params> where WhereBounds = Type; // deprecated, prefer the form above This is related to #5580 As a workaround you might consider using the deprecated style to avoid this issue (which rustfmt handles just fine): macro_rules! m {
($x:tt) => {
// FIXME: waiting till https://github.com/rust-lang/rustfmt/issues/5778 is resolved.
type T
where
A: B,
= $x;
};
} Alternatively, you could use the #[rustfmt::skip]
macro_rules! m {
($x:tt) => {
type T = $x
where
A: B;
};
} |
Thanks for reaching out and creating a minimal repo! I'm going to close this, however, because as Yacin noted it's a duplicate of couple known items tracked elsewhere; in addition to #5580 rustfmt has a bug (#5062/#5044) where if it encounters something it doesn't know how to format within a macro it produces that non-idempotent |
Thank you very much for the references and the hint to use the old-style syntax. I figured there were somes issues with non-idempotence, but I wasn't sure which of those (if any) was covered by my case. |
The following code is given:
Running
rustfmt
results in:Running it again:
And so on.
The following smaller example is idempotent, however:
I'm using:
The above example is a minimal example to reproduce the problem. The full code I used can be found here.
The text was updated successfully, but these errors were encountered: