about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2021-09-08 14:52:49 -0400
committerFelix S. Klock II <pnkfelix@pnkfx.org>2021-09-09 09:14:16 -0400
commit5560f6d90a6a15fdb52a30f97d28b439b72f6cf3 (patch)
tree067194d8a9d16a6229a27d2d13cf37c2a634a903
parent2041fb1a2dc06237ffb63eff8fcfaa93abf67952 (diff)
downloadrust-5560f6d90a6a15fdb52a30f97d28b439b72f6cf3.tar.gz
rust-5560f6d90a6a15fdb52a30f97d28b439b72f6cf3.zip
Revert "Fix ast expanded printing for anonymous types"
This reverts commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151.
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs
index 3cf04be160c..bb00e20d699 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -986,12 +986,12 @@ impl<'a> State<'a> {
                 self.pclose();
             }
             ast::TyKind::AnonymousStruct(ref fields, ..) => {
-                self.head("struct");
-                self.print_record_struct_body(&fields, ty.span);
+                self.s.word("struct");
+                self.print_record_struct_body(fields, ty.span);
             }
             ast::TyKind::AnonymousUnion(ref fields, ..) => {
-                self.head("union");
-                self.print_record_struct_body(&fields, ty.span);
+                self.s.word("union");
+                self.print_record_struct_body(fields, ty.span);
             }
             ast::TyKind::Paren(ref typ) => {
                 self.popen();
@@ -1413,7 +1413,12 @@ impl<'a> State<'a> {
         }
     }
 
-    crate fn print_record_struct_body(&mut self, fields: &[ast::FieldDef], span: rustc_span::Span) {
+    crate fn print_record_struct_body(
+        &mut self,
+        fields: &Vec<ast::FieldDef>,
+        span: rustc_span::Span,
+    ) {
+        self.nbsp();
         self.bopen();
         self.hardbreak_if_not_bol();
 
@@ -1462,7 +1467,6 @@ 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);
             }
         }