File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -383,11 +383,13 @@ impl<'a> Parser<'a> {
383383 // `|` is excluded as it is used in pattern alternatives and lambdas,
384384 // `?` is included for error propagation,
385385 // `[` is included for indexing operations,
386- // `[]` is excluded as `a[]` isn't an expression and should be recovered as `a, []` (cf. `tests/ui/parser/pat-lt-bracket-7.rs`)
386+ // `[]` is excluded as `a[]` isn't an expression and should be recovered as `a, []` (cf. `tests/ui/parser/pat-lt-bracket-7.rs`),
387+ // `as` is included for type casts
387388 let has_trailing_operator = matches ! ( self . token. kind, token:: BinOp ( op) if op != BinOpToken :: Or )
388389 || self . token . kind == token:: Question
389390 || ( self . token . kind == token:: OpenDelim ( Delimiter :: Bracket )
390- && self . look_ahead ( 1 , |tok| tok. kind != token:: CloseDelim ( Delimiter :: Bracket ) ) ) ;
391+ && self . look_ahead ( 1 , |tok| tok. kind != token:: CloseDelim ( Delimiter :: Bracket ) ) )
392+ || self . token . is_keyword ( kw:: As ) ;
391393
392394 if !has_dot_expr && !has_trailing_operator {
393395 // Nothing to recover here.
You can’t perform that action at this time.
0 commit comments