Skip to content

Commit a6e3f13

Browse files
committed
Document MacCall special case in Parser::parse_arm
1 parent 18bc0bb commit a6e3f13

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
@@ -3035,6 +3035,17 @@ impl<'a> Parser<'a> {
30353035
})?;
30363036

30373037
let require_comma = match expr.kind {
3038+
// Special case: braced macro calls require comma in a match
3039+
// arm, even though they do not require semicolon in a
3040+
// statement.
3041+
//
3042+
// m! {} // okay without semicolon
3043+
//
3044+
// match ... {
3045+
// _ => m! {}, // requires comma
3046+
// _ => ...
3047+
// }
3048+
//
30383049
ExprKind::MacCall(_) => true,
30393050
_ => classify::expr_requires_semi_to_be_stmt(&expr),
30403051
} && this.token != token::CloseDelim(Delimiter::Brace);

0 commit comments

Comments
 (0)