Summary
Reported in #6639 (comment) by @yuxqiu, split out to its own issue.
I tried to format this code:
fn f() -> usize {
/*A*/ /*B*/
1 + 2
}
Expected behavior
I expected to see this happen: be idempotent.
Actual behavior
Instead, this happened: formatting is non-idempotent and takes 2 steps to converge:
start
fn f() -> usize {
/*A*/ /*B*/
1 + 2
}
start -> form 1
fn f() -> usize {
/*A*/
/*B*/
1 + 2
}
form 1 -> form 2
fn f() -> usize {
/*A*/
/*B*/
1 + 2
}
Configuration
rustfmt cli options used (if applicable):
$ rustfmt +stable --config-path=/dev/null
rustfmt configuration file (e.g. rustfmt.toml, if applicable): none
Reproduction Steps
$ cat foo.rs
fn f() -> usize {
/*A*/ /*B*/
1 + 2
}
$ rustfmt +stable --config-path=/dev/null foo.rs # step 1
$ cat foo.rs
fn f() -> usize {
/*A*/
/*B*/
1 + 2
}
$ rustfmt +stable --config-path=/dev/null foo.rs # step 2
$ cat foo.rs
fn f() -> usize {
/*A*/
/*B*/
1 + 2
}
Meta
rustfmt --version:
rustfmt 1.9.0-stable (8bab26f4f6 2026-07-14)
Summary
Reported in #6639 (comment) by @yuxqiu, split out to its own issue.
I tried to format this code:
Expected behavior
I expected to see this happen: be idempotent.
Actual behavior
Instead, this happened: formatting is non-idempotent and takes 2 steps to converge:
start
start -> form 1
form 1 -> form 2
Configuration
rustfmtcli options used (if applicable):rustfmtconfiguration file (e.g.rustfmt.toml, if applicable): noneReproduction Steps
Meta
rustfmt --version: