@@ -1375,6 +1375,12 @@ impl<'a> Parser<'a> {
1375
1375
return Ok ( self . mk_await_expr ( self_arg, lo) ) ;
1376
1376
}
1377
1377
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
+
1378
1384
let fn_span_lo = self . token . span ;
1379
1385
let mut seg = self . parse_path_segment ( PathStyle :: Expr , None ) ?;
1380
1386
self . check_trailing_angle_brackets ( & seg, & [ & token:: OpenDelim ( Delimiter :: Parenthesis ) ] ) ;
@@ -2889,8 +2895,19 @@ impl<'a> Parser<'a> {
2889
2895
/// Parses a `match ... { ... }` expression (`match` token already eaten).
2890
2896
fn parse_expr_match ( & mut self ) -> PResult < ' a , P < Expr > > {
2891
2897
let match_span = self . prev_token . span ;
2892
- let lo = self . prev_token . span ;
2893
2898
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 > > {
2894
2911
if let Err ( mut e) = self . expect ( & token:: OpenDelim ( Delimiter :: Brace ) ) {
2895
2912
if self . token == token:: Semi {
2896
2913
e. span_suggestion_short (
0 commit comments