@@ -1441,7 +1441,7 @@ impl<'a> Parser<'a> {
1441
1441
} else if this. token . uninterpolated_span ( ) . at_least_rust_2018 ( ) {
1442
1442
// `Span:.at_least_rust_2018()` is somewhat expensive; don't get it repeatedly.
1443
1443
if this. check_keyword ( kw:: Async ) {
1444
- if this. is_async_block ( ) {
1444
+ if this. is_gen_block ( kw :: Async ) {
1445
1445
// Check for `async {` and `async move {`.
1446
1446
this. parse_gen_block ( )
1447
1447
} else {
@@ -1450,7 +1450,11 @@ impl<'a> Parser<'a> {
1450
1450
} else if this. eat_keyword ( kw:: Await ) {
1451
1451
this. recover_incorrect_await_syntax ( lo, this. prev_token . span )
1452
1452
} 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
+ }
1454
1458
} else {
1455
1459
this. parse_expr_lit ( )
1456
1460
}
@@ -3061,13 +3065,6 @@ impl<'a> Parser<'a> {
3061
3065
&& self . token . uninterpolated_span ( ) . at_least_rust_2018 ( )
3062
3066
}
3063
3067
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
-
3071
3068
/// Parses an `async move? {...}` or `gen move? {...}` expression.
3072
3069
fn parse_gen_block ( & mut self ) -> PResult < ' a , P < Expr > > {
3073
3070
let lo = self . token . span ;
@@ -3084,8 +3081,8 @@ impl<'a> Parser<'a> {
3084
3081
Ok ( self . mk_expr_with_attrs ( lo. to ( self . prev_token . span ) , kind, attrs) )
3085
3082
}
3086
3083
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)
3089
3086
&& ( (
3090
3087
// `async move {`
3091
3088
self . is_keyword_ahead ( 1 , & [ kw:: Move ] )
0 commit comments