about summary refs log tree commit diff
path: root/compiler/rustc_attr_data_structures
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-05 15:20:16 +0000
committerMichael Goulet <michael@errs.io>2025-03-10 02:04:26 +0000
commit279377f87aa1871e1011366b6cf997cfa24e3d65 (patch)
tree5f9f24231063dabcb8bc1b8d8eb625fa6e462047 /compiler/rustc_attr_data_structures
parent6a38322d2608a480b38da6efd926627950bc0537 (diff)
Fix pretty printing of parsed attrs in hir_pretty
Diffstat (limited to 'compiler/rustc_attr_data_structures')
-rw-r--r--compiler/rustc_attr_data_structures/src/lib.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_attr_data_structures/src/lib.rs b/compiler/rustc_attr_data_structures/src/lib.rs
index 16ff4183ef5..bbd3308809c 100644
--- a/compiler/rustc_attr_data_structures/src/lib.rs
+++ b/compiler/rustc_attr_data_structures/src/lib.rs
@@ -125,7 +125,7 @@ macro_rules! print_tup {
                 let ($t, $($ts),*) = self;
                 let parens = print_tup!(num_should_render $t $($ts)*) > 1;
                 if parens {
-                    p.word("(");
+                    p.popen();
                 }
 
                 let mut printed_anything = $t.should_render();
@@ -134,14 +134,16 @@ macro_rules! print_tup {
 
                 $(
                     if $ts.should_render() {
-                        p.word_space(",");
+                        if printed_anything {
+                            p.word_space(",");
+                        }
                         printed_anything = true;
                     }
                     $ts.print_attribute(p);
                 )*
 
                 if parens {
-                    p.word(")");
+                    p.pclose();
                 }
             }
         }
@@ -152,8 +154,8 @@ macro_rules! print_tup {
 
 print_tup!(A B C D E F G H);
 print_skip!(Span, ());
-print_disp!(Symbol, u16, bool, NonZero<u32>);
-print_debug!(UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);
+print_disp!(u16, bool, NonZero<u32>);
+print_debug!(Symbol, UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);
 
 /// Finds attributes in sequences of attributes by pattern matching.
 ///