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
This commit is contained in:
bors 2020-02-02 09:19:40 +00:00
commit cef6894572
2 changed files with 17 additions and 0 deletions

View file

@ -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);

View file

@ -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,};