@@ -191,7 +191,7 @@ impl<'a> Parser<'a> {
191191 }
192192 } ;
193193
194- if !self . should_continue_as_assoc_expr_FIXME ( & lhs) {
194+ if !self . should_continue_as_assoc_expr ( & lhs) {
195195 return Ok ( lhs) ;
196196 }
197197
@@ -382,9 +382,8 @@ impl<'a> Parser<'a> {
382382 Ok ( lhs)
383383 }
384384
385- #[ allow( non_snake_case) ]
386- fn should_continue_as_assoc_expr_FIXME ( & mut self , lhs : & Expr ) -> bool {
387- match ( self . expr_is_complete_FIXME ( lhs) , AssocOp :: from_token ( & self . token ) ) {
385+ fn should_continue_as_assoc_expr ( & mut self , lhs : & Expr ) -> bool {
386+ match ( self . expr_is_complete ( lhs) , AssocOp :: from_token ( & self . token ) ) {
388387 // Semi-statement forms are odd:
389388 // See https://github.com/rust-lang/rust/issues/29071
390389 ( true , None ) => false ,
@@ -469,10 +468,48 @@ impl<'a> Parser<'a> {
469468 }
470469
471470 /// Checks if this expression is a successfully parsed statement.
472- #[ allow( non_snake_case) ]
473- fn expr_is_complete_FIXME ( & self , e : & Expr ) -> bool {
471+ ///
472+ /// This determines whether to continue parsing more of an expression in a
473+ /// match arm (false) vs continue to the next arm (true).
474+ ///
475+ /// ```ignore (illustrative)
476+ /// match ... {
477+ /// // Is this calling $e as a function, or is it the start of a new arm
478+ /// // with a tuple pattern?
479+ /// _ => $e (
480+ /// ^ )
481+ ///
482+ /// // Is this an Index operation, or new arm with a slice pattern?
483+ /// _ => $e [
484+ /// ^ ]
485+ ///
486+ /// // Is this a binary operator, or leading vert in a new arm? Same for
487+ /// // other punctuation which can either be a binary operator in
488+ /// // expression or unary operator in pattern, such as `&` and `-`.
489+ /// _ => $e |
490+ /// ^
491+ /// }
492+ /// ```
493+ ///
494+ /// If $e is something like `path::to` or `(…)`, continue parsing the same
495+ /// arm.
496+ ///
497+ /// If $e is something like `{}` or `if … {}`, then terminate the current
498+ /// arm and parse a new arm.
499+ fn expr_is_complete ( & self , e : & Expr ) -> bool {
474500 self . restrictions . contains ( Restrictions :: STMT_EXPR )
475501 && match e. kind {
502+ // Surprising special case: even though braced macro calls like
503+ // `m! {}` normally introduce a statement boundary when found at
504+ // the head of a statement, in match arms they do not terminate
505+ // the arm.
506+ //
507+ // let _ = { m! {} () }; // macro call followed by unit
508+ //
509+ // match ... {
510+ // _ => m! {} (), // macro that expands to a function, which is then called
511+ // }
512+ //
476513 ExprKind :: MacCall ( _) => false ,
477514 _ => !classify:: expr_requires_semi_to_be_stmt ( e) ,
478515 }
@@ -980,7 +1017,7 @@ impl<'a> Parser<'a> {
9801017 e = self . parse_dot_suffix_expr ( lo, e) ?;
9811018 continue ;
9821019 }
983- if self . expr_is_complete_FIXME ( & e) {
1020+ if self . expr_is_complete ( & e) {
9841021 return Ok ( e) ;
9851022 }
9861023 e = match self . token . kind {
0 commit comments