Summary
I tried to format this code:
trait SpinGuardian {}
struct RwLockUpgradeableGuard<'a, T, G: SpinGuardian>(&'a T, G);
// Compile fail after rustfmt
impl<T: /*?Sized*/, G: SpinGuardian> RwLockUpgradeableGuard<'_, T, G> {}
Expected behavior
I expected the formated code to be compiled normally.
Actual behavior
Instead, this happened:
trait SpinGuardian {}
struct RwLockUpgradeableGuard<'a, T, G: SpinGuardian>(&'a T, G);
// Compile fail after rustfmt
impl<T /*?Sized*/,, G: SpinGuardian> RwLockUpgradeableGuard<'_, T, G> {}
And I get a compile error:
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
--> /playground/src/main.rs:6:19
|
6 | impl<T /*?Sized*/,, G: SpinGuardian> RwLockUpgradeableGuard<'_, T, G> {}
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
Configuration
No extra configuration.
Reproduction Steps
Just run rustfmt and then compile.
You can reproduce this in the Rust Playground:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=358af121c5c0572cf0663c013de3948e
Meta
rustfmt --version:
rustfmt 1.9.0-nightly (562dee4820 2026-03-21)
Summary
I tried to format this code:
Expected behavior
I expected the formated code to be compiled normally.
Actual behavior
Instead, this happened:
And I get a compile error:
Configuration
No extra configuration.
Reproduction Steps
Just run
rustfmtand then compile.You can reproduce this in the Rust Playground:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=358af121c5c0572cf0663c013de3948e
Meta
rustfmt --version: