Skip to content

Commit 5b4bc05

Browse files
committed
Fix ast expanded printing for anonymous types
1 parent af2ed1b commit 5b4bc05

File tree

1 file changed

+6
-10
lines changed
  • compiler/rustc_ast_pretty/src/pprust

1 file changed

+6
-10
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,12 @@ impl<'a> State<'a> {
955955
self.pclose();
956956
}
957957
ast::TyKind::AnonymousStruct(ref fields, ..) => {
958-
self.s.word("struct");
959-
self.print_record_struct_body(fields, ty.span);
958+
self.head("struct");
959+
self.print_record_struct_body(&fields, ty.span);
960960
}
961961
ast::TyKind::AnonymousUnion(ref fields, ..) => {
962-
self.s.word("union");
963-
self.print_record_struct_body(fields, ty.span);
962+
self.head("union");
963+
self.print_record_struct_body(&fields, ty.span);
964964
}
965965
ast::TyKind::Paren(ref typ) => {
966966
self.popen();
@@ -1397,12 +1397,7 @@ impl<'a> State<'a> {
13971397
}
13981398
}
13991399

1400-
crate fn print_record_struct_body(
1401-
&mut self,
1402-
fields: &Vec<ast::FieldDef>,
1403-
span: rustc_span::Span,
1404-
) {
1405-
self.nbsp();
1400+
crate fn print_record_struct_body(&mut self, fields: &[ast::FieldDef], span: rustc_span::Span) {
14061401
self.bopen();
14071402
self.hardbreak_if_not_bol();
14081403

@@ -1451,6 +1446,7 @@ impl<'a> State<'a> {
14511446
}
14521447
ast::VariantData::Struct(ref fields, ..) => {
14531448
self.print_where_clause(&generics.where_clause);
1449+
self.nbsp();
14541450
self.print_record_struct_body(fields, span);
14551451
}
14561452
}

0 commit comments

Comments
 (0)