diff options
author | Aleksey Kladov <[email protected]> | 2018-08-16 11:20:59 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-16 11:20:59 +0100 |
commit | eda52cbc348f37c1ae4391da901b2d605e161716 (patch) | |
tree | a5ca0308241aea303a207a424464abbbf6614d40 /crates/libsyntax2/src | |
parent | a5515d9d6f215da4351b482d839aab5212fa0e6f (diff) |
allow field attrs
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/grammar/items/structs.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/libsyntax2/src/grammar/items/structs.rs b/crates/libsyntax2/src/grammar/items/structs.rs index 80e77edd3..41bd2a4e0 100644 --- a/crates/libsyntax2/src/grammar/items/structs.rs +++ b/crates/libsyntax2/src/grammar/items/structs.rs | |||
@@ -84,15 +84,21 @@ fn named_fields(p: &mut Parser) { | |||
84 | p.expect(R_CURLY); | 84 | p.expect(R_CURLY); |
85 | 85 | ||
86 | fn named_field(p: &mut Parser) { | 86 | fn named_field(p: &mut Parser) { |
87 | let field = p.start(); | 87 | let m = p.start(); |
88 | // test field_attrs | ||
89 | // struct S { | ||
90 | // #[serde(with = "url_serde")] | ||
91 | // pub uri: Uri, | ||
92 | // } | ||
93 | attributes::outer_attributes(p); | ||
88 | visibility(p); | 94 | visibility(p); |
89 | if p.at(IDENT) { | 95 | if p.at(IDENT) { |
90 | name(p); | 96 | name(p); |
91 | p.expect(COLON); | 97 | p.expect(COLON); |
92 | types::type_(p); | 98 | types::type_(p); |
93 | field.complete(p, NAMED_FIELD); | 99 | m.complete(p, NAMED_FIELD); |
94 | } else { | 100 | } else { |
95 | field.abandon(p); | 101 | m.abandon(p); |
96 | p.err_and_bump("expected field declaration"); | 102 | p.err_and_bump("expected field declaration"); |
97 | } | 103 | } |
98 | } | 104 | } |