Skip to content

Commit 116c7ae

Browse files
committed
move outer_attrs call before the match
1 parent 0ee6b70 commit 116c7ae

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

crates/parser/src/grammar/patterns.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,27 +243,20 @@ fn record_pat_field_list(p: &mut Parser) {
243243
let m = p.start();
244244
p.bump(T!['{']);
245245
while !p.at(EOF) && !p.at(T!['}']) {
246+
let m = p.start();
247+
attributes::outer_attrs(p);
248+
246249
match p.current() {
247250
// A trailing `..` is *not* treated as a REST_PAT.
248251
T![.] if p.at(T![..]) => {
249-
rest_pat(p);
252+
p.bump(T![..]);
253+
m.complete(p, REST_PAT);
250254
}
251-
T!['{'] => error_block(p, "expected ident"),
252-
T![#] => {
253-
let m = p.start();
254-
attributes::outer_attrs(p);
255-
if p.at(T![..]) {
256-
p.bump(T![..]);
257-
m.complete(p, REST_PAT);
258-
} else {
259-
record_pat_field(p);
260-
m.complete(p, RECORD_PAT_FIELD);
261-
}
255+
T!['{'] => {
256+
error_block(p, "expected ident");
257+
m.abandon(p);
262258
}
263-
264259
_ => {
265-
let m = p.start();
266-
attributes::outer_attrs(p);
267260
record_pat_field(p);
268261
m.complete(p, RECORD_PAT_FIELD);
269262
}

crates/syntax/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ rayon = "1"
2929
expect-test = "1.1"
3030
proc-macro2 = "1.0.8"
3131
quote = "1.0.2"
32-
ungrammar = "=1.14.5"
32+
ungrammar = "=1.14.6"
3333

3434
test_utils = { path = "../test_utils" }
3535
sourcegen = { path = "../sourcegen" }

0 commit comments

Comments
 (0)