Skip to content

Commit 728e117

Browse files
committed
Document MacCall special case in Parser::parse_arm
1 parent 9dbe33d commit 728e117

File tree

1 file changed

+11
-0
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+11
-0
lines changed

compiler/rustc_parse/src/parser/expr.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,17 @@ impl<'a> Parser<'a> {
31823182
})?;
31833183

31843184
let require_comma = match expr.kind {
3185+
// Special case: braced macro calls require comma in a match
3186+
// arm, even though they do not require semicolon in a
3187+
// statement.
3188+
//
3189+
// m! {} // okay without semicolon
3190+
//
3191+
// match ... {
3192+
// _ => m! {}, // requires comma
3193+
// _ => ...
3194+
// }
3195+
//
31853196
ExprKind::MacCall(_) => true,
31863197
_ => classify::expr_requires_semi_to_be_stmt(&expr),
31873198
} && this.token != token::CloseDelim(Delimiter::Brace);

0 commit comments

Comments
 (0)