Rollup merge of #150358 - fee1-dead-contrib:push-utvysrrzsvvm, r=oli-obk

fix rustfmt on `const impl Ty {}`

r? `@oli-obk` on rust-lang/rust#148434, cc `@ytmimi` for https://github.com/rust-lang/rust/pull/148434/changes#r2637972310

format_constness_right outputs `" const"` whereas format_constness outputs `"const "`

Not making this change to rust-lang/rustfmt since I'm not sure if that repo has these changes yet.
This commit is contained in:
Matthias Krüger 2025-12-27 22:36:35 +01:00 committed by GitHub
commit 15b364e2cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 1 deletions

View file

@ -971,7 +971,7 @@ fn format_impl_ref_and_type(
result.push_str(format_defaultness(of_trait.defaultness));
result.push_str(format_safety(of_trait.safety));
} else {
result.push_str(format_constness_right(*constness));
result.push_str(format_constness(*constness));
}
let shape = if context.config.style_edition() >= StyleEdition::Edition2024 {

View file

@ -0,0 +1,14 @@
#![feature(trait_alias, const_trait_impl)]
const trait Bar {}
const trait Foo = Bar;
impl const Bar for () {}
// const impl gets reformatted to impl const.. for now
const impl Bar for u8 {}
struct X;
const impl X {}

View file

@ -3,3 +3,12 @@
const trait Bar {}
const trait Foo = Bar;
impl const Bar for () {}
// const impl gets reformatted to impl const.. for now
impl const Bar for u8 {}
struct X;
const impl X {}