aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs11
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.rs5
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.txt60
3 files changed, 0 insertions, 76 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index 5e51d667e..6bda04141 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -177,21 +177,10 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
177 // 1, 177 // 1,
178 // 2, 178 // 2,
179 // ]; 179 // ];
180 let first_member_has_attrs = p.at(T![#]);
181 attributes::outer_attributes(p); 180 attributes::outer_attributes(p);
182 181
183 expr(p); 182 expr(p);
184 if p.eat(T![;]) { 183 if p.eat(T![;]) {
185 if first_member_has_attrs {
186 // test_err array_length_attributes
187 // pub const A: &[i64] = &[
188 // #[cfg(test)]
189 // 1;
190 // 2,
191 // ];
192 p.error("removing an expression is not supported in this position");
193 }
194
195 expr(p); 184 expr(p);
196 p.expect(T![']']); 185 p.expect(T![']']);
197 return m.complete(p, ARRAY_EXPR); 186 return m.complete(p, ARRAY_EXPR);
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.rs b/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.rs
deleted file mode 100644
index ba630981d..000000000
--- a/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.rs
+++ /dev/null
@@ -1,5 +0,0 @@
1pub const A: &[i64] = &[
2 #[cfg(test)]
3 1;
4 2,
5];
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.txt b/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.txt
deleted file mode 100644
index 5f0e3f22c..000000000
--- a/crates/ra_syntax/tests/data/parser/inline/err/0015_array_length_attributes.txt
+++ /dev/null
@@ -1,60 +0,0 @@
1SOURCE_FILE@[0; 53)
2 CONST_DEF@[0; 48)
3 VISIBILITY@[0; 3)
4 PUB_KW@[0; 3) "pub"
5 WHITESPACE@[3; 4) " "
6 CONST_KW@[4; 9) "const"
7 WHITESPACE@[9; 10) " "
8 NAME@[10; 11)
9 IDENT@[10; 11) "A"
10 COLON@[11; 12) ":"
11 WHITESPACE@[12; 13) " "
12 REFERENCE_TYPE@[13; 19)
13 AMP@[13; 14) "&"
14 SLICE_TYPE@[14; 19)
15 L_BRACK@[14; 15) "["
16 PATH_TYPE@[15; 18)
17 PATH@[15; 18)
18 PATH_SEGMENT@[15; 18)
19 NAME_REF@[15; 18)
20 IDENT@[15; 18) "i64"
21 R_BRACK@[18; 19) "]"
22 WHITESPACE@[19; 20) " "
23 EQ@[20; 21) "="
24 WHITESPACE@[21; 22) " "
25 REF_EXPR@[22; 48)
26 AMP@[22; 23) "&"
27 ARRAY_EXPR@[23; 48)
28 L_BRACK@[23; 24) "["
29 WHITESPACE@[24; 27) "\n "
30 ATTR@[27; 39)
31 POUND@[27; 28) "#"
32 TOKEN_TREE@[28; 39)
33 L_BRACK@[28; 29) "["
34 IDENT@[29; 32) "cfg"
35 TOKEN_TREE@[32; 38)
36 L_PAREN@[32; 33) "("
37 IDENT@[33; 37) "test"
38 R_PAREN@[37; 38) ")"
39 R_BRACK@[38; 39) "]"
40 WHITESPACE@[39; 42) "\n "
41 LITERAL@[42; 43)
42 INT_NUMBER@[42; 43) "1"
43 SEMI@[43; 44) ";"
44 WHITESPACE@[44; 47) "\n "
45 LITERAL@[47; 48)
46 INT_NUMBER@[47; 48) "2"
47 ERROR@[48; 49)
48 COMMA@[48; 49) ","
49 WHITESPACE@[49; 50) "\n"
50 ERROR@[50; 51)
51 R_BRACK@[50; 51) "]"
52 ERROR@[51; 52)
53 SEMI@[51; 52) ";"
54 WHITESPACE@[52; 53) "\n"
55error 44: removing an expression is not supported in this position
56error 48: expected R_BRACK
57error 48: expected SEMI
58error 48: expected an item
59error 50: expected an item
60error 51: expected an item