- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Description
I tried this code:
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.
Metadata
Metadata
Assignees
Labels
No labels