diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-03 10:30:40 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-20 22:41:29 +0100 |
| commit | dd15904a4dc77a74046ffe47ce8592d06bea60a6 (patch) | |
| tree | 3930a0b175cdaf0b09018f3085ca5c4efe20272c | |
| parent | 52acaa69743be657f7d3003ca2a2abf7f1cd7a2e (diff) | |
| download | rust-dd15904a4dc77a74046ffe47ce8592d06bea60a6.tar.gz rust-dd15904a4dc77a74046ffe47ce8592d06bea60a6.zip | |
parse_bottom_expr: use else if
| -rw-r--r-- | src/librustc_parse/parser/expr.rs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 0792f1b3b7f..7af9b7267a8 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -1093,21 +1093,20 @@ impl<'a> Parser<'a> { let (await_hi, e_kind) = self.parse_incorrect_await_syntax(lo, self.prev_span)?; hi = await_hi; ex = e_kind; + } else if !self.unclosed_delims.is_empty() && self.check(&token::Semi) { + // Don't complain about bare semicolons after unclosed braces + // recovery in order to keep the error count down. Fixing the + // delimiters will possibly also fix the bare semicolon found in + // expression context. For example, silence the following error: + // + // error: expected expression, found `;` + // --> file.rs:2:13 + // | + // 2 | foo(bar(; + // | ^ expected expression + self.bump(); + return Ok(self.mk_expr(self.token.span, ExprKind::Err, ThinVec::new())); } else { - if !self.unclosed_delims.is_empty() && self.check(&token::Semi) { - // Don't complain about bare semicolons after unclosed braces - // recovery in order to keep the error count down. Fixing the - // delimiters will possibly also fix the bare semicolon found in - // expression context. For example, silence the following error: - // - // error: expected expression, found `;` - // --> file.rs:2:13 - // | - // 2 | foo(bar(; - // | ^ expected expression - self.bump(); - return Ok(self.mk_expr(self.token.span, ExprKind::Err, ThinVec::new())); - } parse_lit!() } } |
