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:
commit
15b364e2cb
3 changed files with 24 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
14
src/tools/rustfmt/tests/source/const_trait.rs
Normal file
14
src/tools/rustfmt/tests/source/const_trait.rs
Normal 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 {}
|
||||
|
|
@ -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 {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue