Closed
Description
Describe the bug
If I start with this code and repeatedly run rustfmt, I get:
#![feature(or_patterns)]
macro_rules! t_or_f {
() => {
(true // some comment
| false)
};
}
==>>
#![feature(or_patterns)]
macro_rules! t_or_f {
() => {
(true // some comment
| false)
};
}
==>>
#![feature(or_patterns)]
macro_rules! t_or_f {
() => {
(true // some comment
| false)
};
}
etc. After enough iterations the | false)
stops moving but it's way off to the right.
This bug doesn't appear without the comment or outside a macro. Note that this macro returns a pattern, and that or-patterns are an unstable feature.
To Reproduce
This works on a fresh project without a rustfmt.toml and with both stable and nightly rustfmt.
Expected behavior
The absence of a | false)
glider trying to escape from the file.
Meta
- rustfmt version:
rustfmt 1.4.24-stable (eb894d5 2020-11-05)
&&rustfmt 1.4.29-nightly (70ce182 2020-12-04)
- From where did you install rustfmt?: rustup
- How do you run rustfmt: tried both
rustfmt
andcargo fmt