diff options
| author | bors <bors@rust-lang.org> | 2020-02-02 09:19:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-02 09:19:40 +0000 |
| commit | cef68945722fa593a4a1314f4a2f1ff095aab4f4 (patch) | |
| tree | d4da0032a3bb619c96558a432a0b6b1219d2d3f3 | |
| parent | 0cbcb17d3306d6e22eafc2c05ce885db97d0189c (diff) | |
| parent | 00f0b0cd3ab667e151b8e4d06e314d3b40038495 (diff) | |
| download | rust-cef68945722fa593a4a1314f4a2f1ff095aab4f4.tar.gz rust-cef68945722fa593a4a1314f4a2f1ff095aab4f4.zip | |
Auto merge of #68737 - Centril:fix-68710, r=petrochenkov
pretty: print attrs in struct expr Fixes https://github.com/rust-lang/rust/issues/68710 by printing the attributes on struct expression fields. r? @petrochenkov cc @dtolnay
| -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,}; |
