Don't expect bodyless arms if the pattern can never be a never pattern
This commit is contained in:
parent
f4d794ea0b
commit
7d6cd6bf1f
12 changed files with 32 additions and 26 deletions
|
@ -17,7 +17,7 @@ fn main() {
|
|||
}
|
||||
match x as i32 {
|
||||
0..5+1 => errors_only.push(x),
|
||||
//~^ error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `+`
|
||||
//~^ error: expected one of `=>`, `if`, or `|`, found `+`
|
||||
1 | -3..0 => first_or.push(x),
|
||||
y @ (0..5 | 6) => or_two.push(y),
|
||||
y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `+`
|
||||
error: expected one of `=>`, `if`, or `|`, found `+`
|
||||
--> $DIR/range_pat_interactions1.rs:19:17
|
||||
|
|
||||
LL | 0..5+1 => errors_only.push(x),
|
||||
| ^ expected one of `,`, `=>`, `if`, `|`, or `}`
|
||||
| ^ expected one of `=>`, `if`, or `|`
|
||||
|
||||
error[E0408]: variable `n` is not bound in all patterns
|
||||
--> $DIR/range_pat_interactions1.rs:10:25
|
||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
|||
match x as i32 {
|
||||
0..=(5+1) => errors_only.push(x),
|
||||
//~^ error: inclusive range with no end
|
||||
//~| error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `(`
|
||||
//~| error: expected one of `=>`, `if`, or `|`, found `(`
|
||||
1 | -3..0 => first_or.push(x),
|
||||
y @ (0..5 | 6) => or_two.push(y),
|
||||
y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
|
||||
|
|
|
@ -6,11 +6,11 @@ LL | 0..=(5+1) => errors_only.push(x),
|
|||
|
|
||||
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
|
||||
|
||||
error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `(`
|
||||
error: expected one of `=>`, `if`, or `|`, found `(`
|
||||
--> $DIR/range_pat_interactions2.rs:10:17
|
||||
|
|
||||
LL | 0..=(5+1) => errors_only.push(x),
|
||||
| ^ expected one of `,`, `=>`, `if`, `|`, or `}`
|
||||
| ^ expected one of `=>`, `if`, or `|`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue