Allow attribute on struct literal field

This commit is contained in:
pcpthm 2019-03-17 00:27:07 +09:00
parent 7d3f48cdaf
commit a1d84f5fb0
3 changed files with 54 additions and 1 deletions

View file

@ -453,8 +453,13 @@ pub(crate) fn named_field_list(p: &mut Parser) {
p.bump();
while !p.at(EOF) && !p.at(R_CURLY) {
match p.current() {
IDENT => {
// test struct_literal_field_with_attr
// fn main() {
// S { #[cfg(test)] field: 1 }
// }
IDENT | POUND => {
let m = p.start();
attributes::outer_attributes(p);
name_ref(p);
if p.eat(COLON) {
expr(p);