diff options
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/grammar/expressions/atom.rs | 4 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/expressions/mod.rs | 1 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/items/structs.rs | 4 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/items/traits.rs | 8 |
4 files changed, 17 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/atom.rs b/crates/libsyntax2/src/grammar/expressions/atom.rs index e83c82c92..ab4aa49d2 100644 --- a/crates/libsyntax2/src/grammar/expressions/atom.rs +++ b/crates/libsyntax2/src/grammar/expressions/atom.rs | |||
@@ -269,6 +269,10 @@ fn match_arm_list(p: &mut Parser) { | |||
269 | let m = p.start(); | 269 | let m = p.start(); |
270 | p.eat(L_CURLY); | 270 | p.eat(L_CURLY); |
271 | while !p.at(EOF) && !p.at(R_CURLY) { | 271 | while !p.at(EOF) && !p.at(R_CURLY) { |
272 | if p.at(L_CURLY) { | ||
273 | error_block(p, "expected match arm"); | ||
274 | continue; | ||
275 | } | ||
272 | // test match_arms_commas | 276 | // test match_arms_commas |
273 | // fn foo() { | 277 | // fn foo() { |
274 | // match () { | 278 | // match () { |
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs index fb702a398..9379ed938 100644 --- a/crates/libsyntax2/src/grammar/expressions/mod.rs +++ b/crates/libsyntax2/src/grammar/expressions/mod.rs | |||
@@ -433,6 +433,7 @@ fn named_field_list(p: &mut Parser) { | |||
433 | p.bump(); | 433 | p.bump(); |
434 | expr(p); | 434 | expr(p); |
435 | } | 435 | } |
436 | L_CURLY => error_block(p, "expected a field"), | ||
436 | _ => p.err_and_bump("expected identifier"), | 437 | _ => p.err_and_bump("expected identifier"), |
437 | } | 438 | } |
438 | if !p.at(R_CURLY) { | 439 | if !p.at(R_CURLY) { |
diff --git a/crates/libsyntax2/src/grammar/items/structs.rs b/crates/libsyntax2/src/grammar/items/structs.rs index 93d3381f8..180205393 100644 --- a/crates/libsyntax2/src/grammar/items/structs.rs +++ b/crates/libsyntax2/src/grammar/items/structs.rs | |||
@@ -56,6 +56,10 @@ fn enum_variant_list(p: &mut Parser) { | |||
56 | let m = p.start(); | 56 | let m = p.start(); |
57 | p.bump(); | 57 | p.bump(); |
58 | while !p.at(EOF) && !p.at(R_CURLY) { | 58 | while !p.at(EOF) && !p.at(R_CURLY) { |
59 | if p.at(L_CURLY) { | ||
60 | error_block(p, "expected enum variant"); | ||
61 | continue; | ||
62 | } | ||
59 | let var = p.start(); | 63 | let var = p.start(); |
60 | attributes::outer_attributes(p); | 64 | attributes::outer_attributes(p); |
61 | if p.at(IDENT) { | 65 | if p.at(IDENT) { |
diff --git a/crates/libsyntax2/src/grammar/items/traits.rs b/crates/libsyntax2/src/grammar/items/traits.rs index 3853ccaab..01b79e3c9 100644 --- a/crates/libsyntax2/src/grammar/items/traits.rs +++ b/crates/libsyntax2/src/grammar/items/traits.rs | |||
@@ -30,6 +30,10 @@ fn trait_item_list(p: &mut Parser) { | |||
30 | let m = p.start(); | 30 | let m = p.start(); |
31 | p.bump(); | 31 | p.bump(); |
32 | while !p.at(EOF) && !p.at(R_CURLY) { | 32 | while !p.at(EOF) && !p.at(R_CURLY) { |
33 | if p.at(L_CURLY) { | ||
34 | error_block(p, "expected an item"); | ||
35 | continue; | ||
36 | } | ||
33 | item_or_macro(p, true, ItemFlavor::Trait); | 37 | item_or_macro(p, true, ItemFlavor::Trait); |
34 | } | 38 | } |
35 | p.expect(R_CURLY); | 39 | p.expect(R_CURLY); |
@@ -76,6 +80,10 @@ fn impl_item_list(p: &mut Parser) { | |||
76 | p.bump(); | 80 | p.bump(); |
77 | 81 | ||
78 | while !p.at(EOF) && !p.at(R_CURLY) { | 82 | while !p.at(EOF) && !p.at(R_CURLY) { |
83 | if p.at(L_CURLY) { | ||
84 | error_block(p, "expected an item"); | ||
85 | continue; | ||
86 | } | ||
79 | item_or_macro(p, true, ItemFlavor::Mod); | 87 | item_or_macro(p, true, ItemFlavor::Mod); |
80 | } | 88 | } |
81 | p.expect(R_CURLY); | 89 | p.expect(R_CURLY); |