diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-11-14 00:46:37 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-11-14 00:46:37 +0000 |
| commit | f830fe313ba8b23fe882589ba8dcbbd5739137e8 (patch) | |
| tree | 09f6d1be033df9054ef2678b07939cf429845be0 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 85b84504669c6c779fab7b96fbe5b26635067cd1 (diff) | |
| download | rust-f830fe313ba8b23fe882589ba8dcbbd5739137e8.tar.gz rust-f830fe313ba8b23fe882589ba8dcbbd5739137e8.zip | |
Detect more `=>` typos
Handle and recover `match expr { pat >= { arm } }`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 235b28b6e26..bfd7e8ef4d0 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2904,15 +2904,16 @@ impl<'a> Parser<'a> { "=>", Applicability::MachineApplicable, ); - err.emit(); - this.bump(); - } else if matches!( - (&this.prev_token.kind, &this.token.kind), - (token::DotDotEq, token::Gt) - ) { - // `error_inclusive_range_match_arrow` handles cases like `0..=> {}`, - // so we suppress the error here - err.delay_as_bug(); + if matches!( + (&this.prev_token.kind, &this.token.kind), + (token::DotDotEq, token::Gt) + ) { + // `error_inclusive_range_match_arrow` handles cases like `0..=> {}`, + // so we suppress the error here + err.delay_as_bug(); + } else { + err.emit(); + } this.bump(); } else { return Err(err); |
