mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Fix array element attribute position
This commit is contained in:
parent
b2ed130ffd
commit
ed8d5c86e3
5 changed files with 60 additions and 36 deletions
|
@ -192,9 +192,8 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
|
|||
// 1,
|
||||
// 2,
|
||||
// ];
|
||||
attributes::outer_attributes(p);
|
||||
attributes::with_outer_attributes(p, |p| expr(p).0);
|
||||
|
||||
expr(p);
|
||||
if p.eat(T![;]) {
|
||||
expr(p);
|
||||
p.expect(T![']']);
|
||||
|
@ -212,12 +211,15 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
|
|||
// #[cfg(test)]
|
||||
// 2,
|
||||
// ];
|
||||
attributes::outer_attributes(p);
|
||||
if !p.at_ts(EXPR_FIRST) {
|
||||
p.error("expected expression");
|
||||
if !attributes::with_outer_attributes(p, |p| {
|
||||
if !p.at_ts(EXPR_FIRST) {
|
||||
p.error("expected expression");
|
||||
return None;
|
||||
}
|
||||
expr(p).0
|
||||
}) {
|
||||
break;
|
||||
}
|
||||
expr(p);
|
||||
}
|
||||
p.expect(T![']']);
|
||||
m.complete(p, ARRAY_EXPR)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue