@@ -511,22 +511,19 @@ impl<'a> Parser<'a> {
511511 /// If $e is something like `{}` or `if … {}`, then terminate the current
512512 /// arm and parse a new arm.
513513 fn expr_is_complete ( & self , e : & Expr ) -> bool {
514+ // Surprising special case: even though braced macro calls like
515+ // `m! {}` normally introduce a statement boundary when found at
516+ // the head of a statement, in match arms they do not terminate
517+ // the arm.
518+ //
519+ // let _ = { m! {} () }; // macro call followed by unit
520+ //
521+ // match ... {
522+ // _ => m! {} (), // macro that expands to a function, which is then called
523+ // }
524+ //
514525 self . restrictions . contains ( Restrictions :: STMT_EXPR )
515- && match e. kind {
516- // Surprising special case: even though braced macro calls like
517- // `m! {}` normally introduce a statement boundary when found at
518- // the head of a statement, in match arms they do not terminate
519- // the arm.
520- //
521- // let _ = { m! {} () }; // macro call followed by unit
522- //
523- // match ... {
524- // _ => m! {} (), // macro that expands to a function, which is then called
525- // }
526- //
527- ExprKind :: MacCall ( _) => false ,
528- _ => !classify:: expr_requires_semi_to_be_stmt ( e) ,
529- }
526+ && !classify:: expr_requires_comma_to_be_match_arm ( e)
530527 }
531528
532529 /// Parses `x..y`, `x..=y`, and `x..`/`x..=`.
@@ -3181,21 +3178,19 @@ impl<'a> Parser<'a> {
31813178 err
31823179 } ) ?;
31833180
3184- 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- //
3196- ExprKind :: MacCall ( _) => true ,
3197- _ => classify:: expr_requires_semi_to_be_stmt ( & expr) ,
3198- } && this. token != token:: CloseDelim ( Delimiter :: Brace ) ;
3181+ // Special case: braced macro calls require comma in a match
3182+ // arm, even though they do not require semicolon in a
3183+ // statement.
3184+ //
3185+ // m! {} // okay without semicolon
3186+ //
3187+ // match ... {
3188+ // _ => m! {}, // requires comma
3189+ // _ => ...
3190+ // }
3191+ //
3192+ let require_comma = classify:: expr_requires_comma_to_be_match_arm ( & expr)
3193+ && this. token != token:: CloseDelim ( Delimiter :: Brace ) ;
31993194
32003195 if !require_comma {
32013196 arm_body = Some ( expr) ;
0 commit comments