1
Fork 0

Fix ast expanded printing for anonymous types

This commit is contained in:
jedel1043 2021-05-20 10:06:11 -05:00
parent af2ed1b518
commit 5b4bc05fa5

View file

@ -955,12 +955,12 @@ impl<'a> State<'a> {
self.pclose(); self.pclose();
} }
ast::TyKind::AnonymousStruct(ref fields, ..) => { ast::TyKind::AnonymousStruct(ref fields, ..) => {
self.s.word("struct"); self.head("struct");
self.print_record_struct_body(fields, ty.span); self.print_record_struct_body(&fields, ty.span);
} }
ast::TyKind::AnonymousUnion(ref fields, ..) => { ast::TyKind::AnonymousUnion(ref fields, ..) => {
self.s.word("union"); self.head("union");
self.print_record_struct_body(fields, ty.span); self.print_record_struct_body(&fields, ty.span);
} }
ast::TyKind::Paren(ref typ) => { ast::TyKind::Paren(ref typ) => {
self.popen(); self.popen();
@ -1397,12 +1397,7 @@ impl<'a> State<'a> {
} }
} }
crate fn print_record_struct_body( crate fn print_record_struct_body(&mut self, fields: &[ast::FieldDef], span: rustc_span::Span) {
&mut self,
fields: &Vec<ast::FieldDef>,
span: rustc_span::Span,
) {
self.nbsp();
self.bopen(); self.bopen();
self.hardbreak_if_not_bol(); self.hardbreak_if_not_bol();
@ -1451,6 +1446,7 @@ impl<'a> State<'a> {
} }
ast::VariantData::Struct(ref fields, ..) => { ast::VariantData::Struct(ref fields, ..) => {
self.print_where_clause(&generics.where_clause); self.print_where_clause(&generics.where_clause);
self.nbsp();
self.print_record_struct_body(fields, span); self.print_record_struct_body(fields, span);
} }
} }