Skip to content

Commit 8304a36

Browse files
committed
Document MacCall special case in Parser::parse_arm
1 parent e678f3d commit 8304a36

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,17 @@ impl<'a> Parser<'a> {
31603160
})?;
31613161

31623162
let require_comma = match expr.kind {
3163+
// Special case: braced macro calls require comma in a match
3164+
// arm, even though they do not require semicolon in a
3165+
// statement.
3166+
//
3167+
// m! {} // okay without semicolon
3168+
//
3169+
// match ... {
3170+
// _ => m! {}, // requires comma
3171+
// _ => ...
3172+
// }
3173+
//
31633174
ExprKind::MacCall(_) => true,
31643175
_ => classify::expr_requires_semi_to_be_stmt(&expr),
31653176
} && this.token != token::CloseDelim(Delimiter::Brace);

0 commit comments

Comments
 (0)