diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 6c4f38e9f63..0d5ce07c6ca 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1116,9 +1116,11 @@ impl<'a> State<'a> { self.print_ident(ident); self.word_space(":"); self.print_type(ty); + if body.is_some() { + self.space(); + } self.end(); // end the head-ibox if let Some(body) = body { - self.space(); self.word_space("="); self.print_expr(body); } diff --git a/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs b/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs index 5dd04a569e7..ed7879001d5 100644 --- a/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs +++ b/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs @@ -7,8 +7,7 @@ struct C { } #[allow()] -const C: C - = +const C: C = C{ #[cfg(debug_assertions)] field: 0, diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index d806d7c9aad..4bdc04b9ac4 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -43,8 +43,7 @@ fn main() { crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('\u{3b}', crate::Spacing::Alone)))].iter().cloned().collect::() } -const _: () - = +const _: () = { extern crate proc_macro; #[rustc_proc_macro_decls]