Document MacCall special case in Parser::parse_arm

This commit is contained in:
David Tolnay 2023-12-29 17:15:34 -08:00
parent 9dbe33d256
commit 728e117166
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -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);