about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 98b41013a2c..bb0873a814d 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -3182,6 +3182,17 @@ impl<'a> Parser<'a> {
                     })?;
 
                 let require_comma = match expr.kind {
+                    // Special case: braced macro calls require comma in a match
+                    // arm, even though they do not require semicolon in a
+                    // statement.
+                    //
+                    //     m! {}  // okay without semicolon
+                    //
+                    //     match ... {
+                    //         _ => m! {},  // requires comma
+                    //         _ => ...
+                    //     }
+                    //
                     ExprKind::MacCall(_) => true,
                     _ => classify::expr_requires_semi_to_be_stmt(&expr),
                 } && this.token != token::CloseDelim(Delimiter::Brace);