diff options
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 41be283d0..5e51d667e 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -170,8 +170,28 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
170 | if p.eat(T![']']) { | 170 | if p.eat(T![']']) { |
171 | return m.complete(p, ARRAY_EXPR); | 171 | return m.complete(p, ARRAY_EXPR); |
172 | } | 172 | } |
173 | |||
174 | // test first_array_member_attributes | ||
175 | // pub const A: &[i64] = &[ | ||
176 | // #[cfg(test)] | ||
177 | // 1, | ||
178 | // 2, | ||
179 | // ]; | ||
180 | let first_member_has_attrs = p.at(T![#]); | ||
181 | attributes::outer_attributes(p); | ||
182 | |||
173 | expr(p); | 183 | expr(p); |
174 | if p.eat(T![;]) { | 184 | 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 | |||
175 | expr(p); | 195 | expr(p); |
176 | p.expect(T![']']); | 196 | p.expect(T![']']); |
177 | return m.complete(p, ARRAY_EXPR); | 197 | return m.complete(p, ARRAY_EXPR); |
@@ -181,6 +201,14 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
181 | if p.at(T![']']) { | 201 | if p.at(T![']']) { |
182 | break; | 202 | break; |
183 | } | 203 | } |
204 | |||
205 | // test subsequent_array_member_attributes | ||
206 | // pub const A: &[i64] = &[ | ||
207 | // 1, | ||
208 | // #[cfg(test)] | ||
209 | // 2, | ||
210 | // ]; | ||
211 | attributes::outer_attributes(p); | ||
184 | if !p.at_ts(EXPR_FIRST) { | 212 | if !p.at_ts(EXPR_FIRST) { |
185 | p.error("expected expression"); | 213 | p.error("expected expression"); |
186 | break; | 214 | break; |