Skip to content

Commit

Permalink
Document MacCall special case in Parser::parse_arm
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 11, 2024
1 parent 9dbe33d commit 728e117
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 728e117

Please sign in to comment.