Skip to content

Commit

Permalink
Fix ast expanded printing for anonymous types
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed May 24, 2021
1 parent af2ed1b commit 5b4bc05
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1397,12 +1397,7 @@ impl<'a> State<'a> {
}
}

crate fn print_record_struct_body(
&mut self,
fields: &Vec<ast::FieldDef>,
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();

Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 5b4bc05

Please sign in to comment.