diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-11-03 12:08:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-03 12:08:55 +0100 |
| commit | 13cdfae599cd0e6b84e8aab34bd5d4286032b7ca (patch) | |
| tree | ea8bd2c2767c12f8135e2abfa11ae0b90d608274 /src/tools/rustfmt/tests | |
| parent | 7d7f2b5e2f79473d6f972fceae0f51fa55468d29 (diff) | |
| parent | 16394e9776e1be1abc61a9b26baf73070aa7c37b (diff) | |
| download | rust-13cdfae599cd0e6b84e8aab34bd5d4286032b7ca.tar.gz rust-13cdfae599cd0e6b84e8aab34bd5d4286032b7ca.zip | |
Rollup merge of #132540 - compiler-errors:gc, r=calebcartwright
Do not format generic consts We introduced **nightly support** for generic const items in #113522, but formatting of consts was not modified. Making them format *correctly* is hard, so let's just bail formatting them so we don't accidentally strip their generics and where clauses. This is essentially no-op formatting for generic const items. r? `````@calebcartwright````` or `````@ytmimi`````
Diffstat (limited to 'src/tools/rustfmt/tests')
| -rw-r--r-- | src/tools/rustfmt/tests/target/const-generics.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/const-generics.rs b/src/tools/rustfmt/tests/target/const-generics.rs new file mode 100644 index 00000000000..94f76643664 --- /dev/null +++ b/src/tools/rustfmt/tests/target/const-generics.rs @@ -0,0 +1,25 @@ +// Make sure we don't mess up the formatting of generic consts + +#![feature(generic_const_items)] + +const GENERIC<N, const M: usize>: i32 = 0; + +const WHERECLAUSE: i32 = 0 +where + i32:; + +trait Foo { + const GENERIC<N, const M: usize>: i32; + + const WHERECLAUSE: i32 + where + i32:; +} + +impl Foo for () { + const GENERIC<N, const M: usize>: i32 = 0; + + const WHERECLAUSE: i32 = 0 + where + i32:; +} |
