@@ -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 . sess . 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 ) ] ) ;
@@ -2887,8 +2893,19 @@ impl<'a> Parser<'a> {
2887
2893
/// Parses a `match ... { ... }` expression (`match` token already eaten).
2888
2894
fn parse_expr_match ( & mut self ) -> PResult < ' a , P < Expr > > {
2889
2895
let match_span = self . prev_token . span ;
2890
- let lo = self . prev_token . span ;
2891
2896
let scrutinee = self . parse_expr_res ( Restrictions :: NO_STRUCT_LITERAL , None ) ?;
2897
+
2898
+ self . parse_match_block ( match_span, match_span, scrutinee)
2899
+ }
2900
+
2901
+ /// Parses a `match expr { ... }` or a `expr.match { ... }` expression.
2902
+ /// This is after the match token and scrutinee are eaten
2903
+ fn parse_match_block (
2904
+ & mut self ,
2905
+ lo : Span ,
2906
+ match_span : Span ,
2907
+ scrutinee : P < Expr > ,
2908
+ ) -> PResult < ' a , P < Expr > > {
2892
2909
if let Err ( mut e) = self . expect ( & token:: OpenDelim ( Delimiter :: Brace ) ) {
2893
2910
if self . token == token:: Semi {
2894
2911
e. span_suggestion_short (
0 commit comments