Rollup merge of #107493 - clubby789:range-fat-arrow-followup, r=estebank
Improve diagnostic for missing space in range pattern Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue. r? `@compiler-errors`
This commit is contained in:
commit
e9c4e291c4
6 changed files with 24 additions and 21 deletions
|
|
@ -2,7 +2,8 @@ fn main() {
|
|||
let x = 42;
|
||||
match x {
|
||||
0..=73 => {},
|
||||
74..=> {}, //~ ERROR unexpected `=>` after open range
|
||||
//~^ ERROR expected one of `=>`, `if`, or `|`, found `>`
|
||||
74..=> {},
|
||||
//~^ ERROR unexpected `>` after inclusive range
|
||||
//~| NOTE this is parsed as an inclusive range `..=`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,15 @@
|
|||
error: unexpected `=>` after open range
|
||||
--> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:11
|
||||
error: unexpected `>` after inclusive range
|
||||
--> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14
|
||||
|
|
||||
LL | 74..=> {},
|
||||
| ^^^
|
||||
| ---^
|
||||
| |
|
||||
| this is parsed as an inclusive range `..=`
|
||||
|
|
||||
help: add a space between the pattern and `=>`
|
||||
|
|
||||
LL | 74.. => {},
|
||||
| +
|
||||
|
||||
error: expected one of `=>`, `if`, or `|`, found `>`
|
||||
--> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14
|
||||
|
|
||||
LL | 74..=> {},
|
||||
| ^ expected one of `=>`, `if`, or `|`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue