File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
src/librustc_parse/parser Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -1093,21 +1093,20 @@ impl<'a> Parser<'a> {
1093
1093
let ( await_hi, e_kind) = self . parse_incorrect_await_syntax ( lo, self . prev_span ) ?;
1094
1094
hi = await_hi;
1095
1095
ex = e_kind;
1096
+ } else if !self . unclosed_delims . is_empty ( ) && self . check ( & token:: Semi ) {
1097
+ // Don't complain about bare semicolons after unclosed braces
1098
+ // recovery in order to keep the error count down. Fixing the
1099
+ // delimiters will possibly also fix the bare semicolon found in
1100
+ // expression context. For example, silence the following error:
1101
+ //
1102
+ // error: expected expression, found `;`
1103
+ // --> file.rs:2:13
1104
+ // |
1105
+ // 2 | foo(bar(;
1106
+ // | ^ expected expression
1107
+ self . bump ( ) ;
1108
+ return Ok ( self . mk_expr ( self . token . span , ExprKind :: Err , ThinVec :: new ( ) ) ) ;
1096
1109
} else {
1097
- if !self . unclosed_delims . is_empty ( ) && self . check ( & token:: Semi ) {
1098
- // Don't complain about bare semicolons after unclosed braces
1099
- // recovery in order to keep the error count down. Fixing the
1100
- // delimiters will possibly also fix the bare semicolon found in
1101
- // expression context. For example, silence the following error:
1102
- //
1103
- // error: expected expression, found `;`
1104
- // --> file.rs:2:13
1105
- // |
1106
- // 2 | foo(bar(;
1107
- // | ^ expected expression
1108
- self . bump ( ) ;
1109
- return Ok ( self . mk_expr ( self . token . span , ExprKind :: Err , ThinVec :: new ( ) ) ) ;
1110
- }
1111
1110
parse_lit ! ( )
1112
1111
}
1113
1112
}
You can’t perform that action at this time.
0 commit comments