aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar/items
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-27 19:10:02 +0100
committerAleksey Kladov <[email protected]>2018-08-27 19:10:02 +0100
commitb79c8b6d8a3b38c94de992a54ffb9055c1ad6f31 (patch)
tree4979b92b8f4e41bf55e4e1404a8cb183c034d6d7 /crates/libsyntax2/src/grammar/items
parent7f4b07a9076a38b2bd0fa0518ba090311dcaf880 (diff)
Fix error blocks
Diffstat (limited to 'crates/libsyntax2/src/grammar/items')
-rw-r--r--crates/libsyntax2/src/grammar/items/structs.rs4
-rw-r--r--crates/libsyntax2/src/grammar/items/traits.rs8
2 files changed, 12 insertions, 0 deletions
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);