@@ -1441,7 +1441,7 @@ impl<'a> Parser<'a> {
14411441 } else if this. token . uninterpolated_span ( ) . at_least_rust_2018 ( ) {
14421442 // `Span:.at_least_rust_2018()` is somewhat expensive; don't get it repeatedly.
14431443 if this. check_keyword ( kw:: Async ) {
1444- if this. is_async_block ( ) {
1444+ if this. is_gen_block ( kw :: Async ) {
14451445 // Check for `async {` and `async move {`.
14461446 this. parse_gen_block ( )
14471447 } else {
@@ -1450,7 +1450,11 @@ impl<'a> Parser<'a> {
14501450 } else if this. eat_keyword ( kw:: Await ) {
14511451 this. recover_incorrect_await_syntax ( lo, this. prev_token . span )
14521452 } else if this. token . uninterpolated_span ( ) . at_least_rust_2024 ( ) {
1453- if this. is_gen_block ( ) { this. parse_gen_block ( ) } else { this. parse_expr_lit ( ) }
1453+ if this. is_gen_block ( kw:: Gen ) {
1454+ this. parse_gen_block ( )
1455+ } else {
1456+ this. parse_expr_lit ( )
1457+ }
14541458 } else {
14551459 this. parse_expr_lit ( )
14561460 }
@@ -3061,13 +3065,6 @@ impl<'a> Parser<'a> {
30613065 && self . token . uninterpolated_span ( ) . at_least_rust_2018 ( )
30623066 }
30633067
3064- fn is_gen_block ( & self ) -> bool {
3065- self . token . is_keyword ( kw:: Gen )
3066- && self
3067- . look_ahead ( 1 , |t| * t == token:: OpenDelim ( Delimiter :: Brace ) || t. is_whole_block ( ) )
3068- && self . token . uninterpolated_span ( ) . at_least_rust_2024 ( )
3069- }
3070-
30713068 /// Parses an `async move? {...}` or `gen move? {...}` expression.
30723069 fn parse_gen_block ( & mut self ) -> PResult < ' a , P < Expr > > {
30733070 let lo = self . token . span ;
@@ -3084,8 +3081,8 @@ impl<'a> Parser<'a> {
30843081 Ok ( self . mk_expr_with_attrs ( lo. to ( self . prev_token . span ) , kind, attrs) )
30853082 }
30863083
3087- fn is_async_block ( & self ) -> bool {
3088- self . token . is_keyword ( kw:: Async )
3084+ fn is_gen_block ( & self , kw : Symbol ) -> bool {
3085+ self . token . is_keyword ( kw)
30893086 && ( (
30903087 // `async move {`
30913088 self . is_keyword_ahead ( 1 , & [ kw:: Move ] )
0 commit comments