aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/grammar/items/nominal.rs10
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.rs4
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.txt39
3 files changed, 53 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/grammar/items/nominal.rs b/crates/ra_syntax/src/grammar/items/nominal.rs
index 495462ca7..0784fb7b1 100644
--- a/crates/ra_syntax/src/grammar/items/nominal.rs
+++ b/crates/ra_syntax/src/grammar/items/nominal.rs
@@ -140,6 +140,16 @@ fn pos_field_list(p: &mut Parser) {
140 } 140 }
141 while !p.at(R_PAREN) && !p.at(EOF) { 141 while !p.at(R_PAREN) && !p.at(EOF) {
142 let m = p.start(); 142 let m = p.start();
143 // test pos_field_attrs
144 // struct S (
145 // #[serde(with = "url_serde")]
146 // pub Uri,
147 // );
148 //
149 // enum S {
150 // Uri(#[serde(with = "url_serde")] Uri),
151 // }
152 attributes::outer_attributes(p);
143 opt_visibility(p); 153 opt_visibility(p);
144 if !p.at_ts(types::TYPE_FIRST) { 154 if !p.at_ts(types::TYPE_FIRST) {
145 p.error("expected a type"); 155 p.error("expected a type");
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.rs
new file mode 100644
index 000000000..635b9ac21
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.rs
@@ -0,0 +1,4 @@
1struct S (
2 #[serde(with = "url_serde")]
3 pub Uri,
4);
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.txt
new file mode 100644
index 000000000..99ec0755b
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0115_pos_field_attrs.txt
@@ -0,0 +1,39 @@
1SOURCE_FILE@[0; 60)
2 STRUCT_DEF@[0; 59)
3 STRUCT_KW@[0; 6)
4 WHITESPACE@[6; 7)
5 NAME@[7; 8)
6 IDENT@[7; 8) "S"
7 WHITESPACE@[8; 9)
8 POS_FIELD_LIST@[9; 58)
9 L_PAREN@[9; 10)
10 WHITESPACE@[10; 15)
11 POS_FIELD@[15; 55)
12 ATTR@[15; 43)
13 POUND@[15; 16)
14 TOKEN_TREE@[16; 43)
15 L_BRACK@[16; 17)
16 IDENT@[17; 22) "serde"
17 TOKEN_TREE@[22; 42)
18 L_PAREN@[22; 23)
19 IDENT@[23; 27) "with"
20 WHITESPACE@[27; 28)
21 EQ@[28; 29)
22 WHITESPACE@[29; 30)
23 STRING@[30; 41)
24 R_PAREN@[41; 42)
25 R_BRACK@[42; 43)
26 WHITESPACE@[43; 48)
27 VISIBILITY@[48; 51)
28 PUB_KW@[48; 51)
29 WHITESPACE@[51; 52)
30 PATH_TYPE@[52; 55)
31 PATH@[52; 55)
32 PATH_SEGMENT@[52; 55)
33 NAME_REF@[52; 55)
34 IDENT@[52; 55) "Uri"
35 COMMA@[55; 56)
36 WHITESPACE@[56; 57)
37 R_PAREN@[57; 58)
38 SEMI@[58; 59)
39 WHITESPACE@[59; 60)