diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-12-29 16:30:34 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-05-11 15:48:59 -0700 |
| commit | 9e1cf2098d68356bccf7112bbff1d9b565e80a02 (patch) | |
| tree | f9b2fa5f5790e5421fa215a2ade0c568052306e8 /compiler/rustc_parse/src/parser/stmt.rs | |
| parent | cbb8714a3f8a04cce698719df338fb095c40f479 (diff) | |
| download | rust-9e1cf2098d68356bccf7112bbff1d9b565e80a02.tar.gz rust-9e1cf2098d68356bccf7112bbff1d9b565e80a02.zip | |
Macro call with braces does not require semicolon to be statement
This commit by itself is supposed to have no effect on behavior. All of the call sites are updated to preserve their previous behavior. The behavior changes are in the commits that follow.
Diffstat (limited to 'compiler/rustc_parse/src/parser/stmt.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index f64a480a18c..684799eb6a7 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -648,8 +648,10 @@ impl<'a> Parser<'a> { match &mut stmt.kind { // Expression without semicolon. StmtKind::Expr(expr) - if classify::expr_requires_semi_to_be_stmt_FIXME(expr) - && !expr.attrs.is_empty() + if match expr.kind { + ExprKind::MacCall(_) => true, + _ => classify::expr_requires_semi_to_be_stmt(expr), + } && !expr.attrs.is_empty() && ![token::Eof, token::Semi, token::CloseDelim(Delimiter::Brace)] .contains(&self.token.kind) => { @@ -663,7 +665,10 @@ impl<'a> Parser<'a> { // Expression without semicolon. StmtKind::Expr(expr) if self.token != token::Eof - && classify::expr_requires_semi_to_be_stmt_FIXME(expr) => + && match expr.kind { + ExprKind::MacCall(_) => true, + _ => classify::expr_requires_semi_to_be_stmt(expr), + } => { // Just check for errors and recover; do not eat semicolon yet. |
