move outer_attrs call before the match

This commit is contained in:
zhoufan 2021-10-03 09:22:02 +08:00
parent 0ee6b70b34
commit 116c7aef7f
2 changed files with 9 additions and 16 deletions

View file

@ -243,27 +243,20 @@ fn record_pat_field_list(p: &mut Parser) {
let m = p.start(); let m = p.start();
p.bump(T!['{']); p.bump(T!['{']);
while !p.at(EOF) && !p.at(T!['}']) { while !p.at(EOF) && !p.at(T!['}']) {
let m = p.start();
attributes::outer_attrs(p);
match p.current() { match p.current() {
// A trailing `..` is *not* treated as a REST_PAT. // A trailing `..` is *not* treated as a REST_PAT.
T![.] if p.at(T![..]) => { T![.] if p.at(T![..]) => {
rest_pat(p); p.bump(T![..]);
m.complete(p, REST_PAT);
} }
T!['{'] => error_block(p, "expected ident"), T!['{'] => {
T![#] => { error_block(p, "expected ident");
let m = p.start(); m.abandon(p);
attributes::outer_attrs(p);
if p.at(T![..]) {
p.bump(T![..]);
m.complete(p, REST_PAT);
} else {
record_pat_field(p);
m.complete(p, RECORD_PAT_FIELD);
}
} }
_ => { _ => {
let m = p.start();
attributes::outer_attrs(p);
record_pat_field(p); record_pat_field(p);
m.complete(p, RECORD_PAT_FIELD); m.complete(p, RECORD_PAT_FIELD);
} }

View file

@ -29,7 +29,7 @@ rayon = "1"
expect-test = "1.1" expect-test = "1.1"
proc-macro2 = "1.0.8" proc-macro2 = "1.0.8"
quote = "1.0.2" quote = "1.0.2"
ungrammar = "=1.14.5" ungrammar = "=1.14.6"
test_utils = { path = "../test_utils" } test_utils = { path = "../test_utils" }
sourcegen = { path = "../sourcegen" } sourcegen = { path = "../sourcegen" }