Skip to content

Commit

Permalink
pretty: print attrs in struct expr
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Feb 2, 2020
1 parent bc4a339 commit 00f0b0c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_ast_pretty/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@ impl<'a> State<'a> {
Consistent,
&fields[..],
|s, field| {
s.print_outer_attributes(&field.attrs);
s.ibox(INDENT_UNIT);
if !field.is_shorthand {
s.print_ident(field.ident);
Expand Down
16 changes: 16 additions & 0 deletions src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// pp-exact

fn main() { }

struct C {
field: u8,
}

#[allow()]
const C: C =
C{
#[cfg(debug_assertions)]
field: 0,

#[cfg(not (debug_assertions))]
field: 1,};

0 comments on commit 00f0b0c

Please sign in to comment.