mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Fix error blocks
This commit is contained in:
parent
7f4b07a907
commit
b79c8b6d8a
6 changed files with 20 additions and 1 deletions
|
@ -269,6 +269,10 @@ fn match_arm_list(p: &mut Parser) {
|
|||
let m = p.start();
|
||||
p.eat(L_CURLY);
|
||||
while !p.at(EOF) && !p.at(R_CURLY) {
|
||||
if p.at(L_CURLY) {
|
||||
error_block(p, "expected match arm");
|
||||
continue;
|
||||
}
|
||||
// test match_arms_commas
|
||||
// fn foo() {
|
||||
// match () {
|
||||
|
|
|
@ -433,6 +433,7 @@ fn named_field_list(p: &mut Parser) {
|
|||
p.bump();
|
||||
expr(p);
|
||||
}
|
||||
L_CURLY => error_block(p, "expected a field"),
|
||||
_ => p.err_and_bump("expected identifier"),
|
||||
}
|
||||
if !p.at(R_CURLY) {
|
||||
|
|
|
@ -56,6 +56,10 @@ fn enum_variant_list(p: &mut Parser) {
|
|||
let m = p.start();
|
||||
p.bump();
|
||||
while !p.at(EOF) && !p.at(R_CURLY) {
|
||||
if p.at(L_CURLY) {
|
||||
error_block(p, "expected enum variant");
|
||||
continue;
|
||||
}
|
||||
let var = p.start();
|
||||
attributes::outer_attributes(p);
|
||||
if p.at(IDENT) {
|
||||
|
|
|
@ -30,6 +30,10 @@ fn trait_item_list(p: &mut Parser) {
|
|||
let m = p.start();
|
||||
p.bump();
|
||||
while !p.at(EOF) && !p.at(R_CURLY) {
|
||||
if p.at(L_CURLY) {
|
||||
error_block(p, "expected an item");
|
||||
continue;
|
||||
}
|
||||
item_or_macro(p, true, ItemFlavor::Trait);
|
||||
}
|
||||
p.expect(R_CURLY);
|
||||
|
@ -76,6 +80,10 @@ fn impl_item_list(p: &mut Parser) {
|
|||
p.bump();
|
||||
|
||||
while !p.at(EOF) && !p.at(R_CURLY) {
|
||||
if p.at(L_CURLY) {
|
||||
error_block(p, "expected an item");
|
||||
continue;
|
||||
}
|
||||
item_or_macro(p, true, ItemFlavor::Mod);
|
||||
}
|
||||
p.expect(R_CURLY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue