Unnamed repository; edit this file 'description' to name the repository.
move outer_attrs call before the match
zhoufan 2021-10-03
parent 0ee6b70 · commit 116c7ae
-rw-r--r--crates/parser/src/grammar/patterns.rs23
-rw-r--r--crates/syntax/Cargo.toml2
2 files changed, 9 insertions, 16 deletions
diff --git a/crates/parser/src/grammar/patterns.rs b/crates/parser/src/grammar/patterns.rs
index 7ba81d0cb1..7a49b1b8e8 100644
--- a/crates/parser/src/grammar/patterns.rs
+++ b/crates/parser/src/grammar/patterns.rs
@@ -243,27 +243,20 @@ fn record_pat_field_list(p: &mut Parser) {
let m = p.start();
p.bump(T!['{']);
while !p.at(EOF) && !p.at(T!['}']) {
+ let m = p.start();
+ attributes::outer_attrs(p);
+
match p.current() {
// A trailing `..` is *not* treated as a REST_PAT.
T![.] if p.at(T![..]) => {
- rest_pat(p);
+ p.bump(T![..]);
+ m.complete(p, REST_PAT);
}
- T!['{'] => error_block(p, "expected ident"),
- T![#] => {
- let m = p.start();
- 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);
- }
+ T!['{'] => {
+ error_block(p, "expected ident");
+ m.abandon(p);
}
-
_ => {
- let m = p.start();
- attributes::outer_attrs(p);
record_pat_field(p);
m.complete(p, RECORD_PAT_FIELD);
}
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index f889fa2a2c..3c5adb97fb 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -29,7 +29,7 @@ rayon = "1"
expect-test = "1.1"
proc-macro2 = "1.0.8"
quote = "1.0.2"
-ungrammar = "=1.14.5"
+ungrammar = "=1.14.6"
test_utils = { path = "../test_utils" }
sourcegen = { path = "../sourcegen" }