From 5b4bc05fa57be19bb5962f4b7c0f165e194e3151 Mon Sep 17 00:00:00 2001 From: jedel1043 Date: Thu, 20 May 2021 10:06:11 -0500 Subject: [PATCH] Fix ast expanded printing for anonymous types --- compiler/rustc_ast_pretty/src/pprust/state.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index da9d89745a824..b7bb896f31802 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -955,12 +955,12 @@ impl<'a> State<'a> { self.pclose(); } ast::TyKind::AnonymousStruct(ref fields, ..) => { - self.s.word("struct"); - self.print_record_struct_body(fields, ty.span); + self.head("struct"); + self.print_record_struct_body(&fields, ty.span); } ast::TyKind::AnonymousUnion(ref fields, ..) => { - self.s.word("union"); - self.print_record_struct_body(fields, ty.span); + self.head("union"); + self.print_record_struct_body(&fields, ty.span); } ast::TyKind::Paren(ref typ) => { self.popen(); @@ -1397,12 +1397,7 @@ impl<'a> State<'a> { } } - crate fn print_record_struct_body( - &mut self, - fields: &Vec, - span: rustc_span::Span, - ) { - self.nbsp(); + crate fn print_record_struct_body(&mut self, fields: &[ast::FieldDef], span: rustc_span::Span) { self.bopen(); self.hardbreak_if_not_bol(); @@ -1451,6 +1446,7 @@ impl<'a> State<'a> { } ast::VariantData::Struct(ref fields, ..) => { self.print_where_clause(&generics.where_clause); + self.nbsp(); self.print_record_struct_body(fields, span); } }