diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-01 18:45:03 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-02 09:25:54 +0100 |
| commit | 00f0b0cd3ab667e151b8e4d06e314d3b40038495 (patch) | |
| tree | 149fd6fc250377df42fb2edb3ccb1ed3314f8250 | |
| parent | bc4a3390648dffd88e6d69d06e6d49cf3981e713 (diff) | |
| download | rust-00f0b0cd3ab667e151b8e4d06e314d3b40038495.tar.gz rust-00f0b0cd3ab667e151b8e4d06e314d3b40038495.zip | |
pretty: print attrs in struct expr
| -rw-r--r-- | src/librustc_ast_pretty/pprust.rs | 1 | ||||
| -rw-r--r-- | src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs index 761af72f95d..3cc67a7c821 100644 --- a/src/librustc_ast_pretty/pprust.rs +++ b/src/librustc_ast_pretty/pprust.rs @@ -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); diff --git a/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs b/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs new file mode 100644 index 00000000000..643ca761aac --- /dev/null +++ b/src/test/pretty/issue-68710-field-attr-proc-mac-lost.rs @@ -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,}; |
