I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b57dd6cc254167f09d1a51f753ddebb6
fn main() {
match 42u32 {
x if x >= 0 => dbg!(x)
};
}
Gives error:
error[E0004]: non-exhaustive patterns: `_` not covered
--> src/main.rs:2:11
|
2 | match 42u32 {
| ^^^^^ pattern `_` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
However this one with ranges compiles fine:
fn main() {
match 42u32 {
x @ 0..=std::u32::MAX => dbg!(x)
};
}
I would expect x @ 0..=std::u32::MAX and x if x >= 0 be equal in match arms.
I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b57dd6cc254167f09d1a51f753ddebb6
Gives error:
However this one with ranges compiles fine:
I would expect
x @ 0..=std::u32::MAXandx if x >= 0be equal in match arms.