diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-01-30 23:47:10 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-02-02 13:18:12 +0000 |
| commit | 4ab75de934935f59f243ab64a641e28aa89e6fcd (patch) | |
| tree | fe7cc1e8e0c9235e7452a46165c5b4b14713cc2b /compiler/rustc_parse/src/parser/expr.rs | |
| parent | a9985cf172e7cb8ab5c58ce2818752c3572754fc (diff) | |
| download | rust-4ab75de934935f59f243ab64a641e28aa89e6fcd.tar.gz rust-4ab75de934935f59f243ab64a641e28aa89e6fcd.zip | |
Improve diagnostic for missing space in range pattern
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b7a023868fc..3d42a9dcbbe 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2717,6 +2717,14 @@ impl<'a> Parser<'a> { ); 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 supress the error here + err.delay_as_bug(); + this.bump(); } else { return Err(err); } |
