Improve diagnostic for missing space in range pattern
This commit is contained in:
parent
a9985cf172
commit
4ab75de934
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