@@ -1375,6 +1375,12 @@ impl<'a> Parser<'a> {
13751375 return Ok ( self . mk_await_expr ( self_arg, lo) ) ;
13761376 }
13771377
1378+ if self . eat_keyword ( kw:: Match ) {
1379+ let match_span = self . prev_token . span ;
1380+ self . psess . gated_spans . gate ( sym:: postfix_match, match_span) ;
1381+ return self . parse_match_block ( lo, match_span, self_arg) ;
1382+ }
1383+
13781384 let fn_span_lo = self . token . span ;
13791385 let mut seg = self . parse_path_segment ( PathStyle :: Expr , None ) ?;
13801386 self . check_trailing_angle_brackets ( & seg, & [ & token:: OpenDelim ( Delimiter :: Parenthesis ) ] ) ;
@@ -2889,8 +2895,19 @@ impl<'a> Parser<'a> {
28892895 /// Parses a `match ... { ... }` expression (`match` token already eaten).
28902896 fn parse_expr_match ( & mut self ) -> PResult < ' a , P < Expr > > {
28912897 let match_span = self . prev_token . span ;
2892- let lo = self . prev_token . span ;
28932898 let scrutinee = self . parse_expr_res ( Restrictions :: NO_STRUCT_LITERAL , None ) ?;
2899+
2900+ self . parse_match_block ( match_span, match_span, scrutinee)
2901+ }
2902+
2903+ /// Parses a `match expr { ... }` or a `expr.match { ... }` expression.
2904+ /// This is after the match token and scrutinee are eaten
2905+ fn parse_match_block (
2906+ & mut self ,
2907+ lo : Span ,
2908+ match_span : Span ,
2909+ scrutinee : P < Expr > ,
2910+ ) -> PResult < ' a , P < Expr > > {
28942911 if let Err ( mut e) = self . expect ( & token:: OpenDelim ( Delimiter :: Brace ) ) {
28952912 if self . token == token:: Semi {
28962913 e. span_suggestion_short (
0 commit comments