Se eu tentar construir o seguinte código:
fn main () {
let my_val: u32 = 42;
match my_val % 2 {
0 => println!("We're even now"),
1 => println!("Well, that's odd"),
}
}
Terei a seguinte mensagem de erro:
error[E0004]: non-exhaustive patterns: `2_u32..=u32::MAX` not covered
--> src/main.rs:4:11
|
4 | match my_val % 2 {
| ^^^^^^^^^^ pattern `2_u32..=u32::MAX` not covered
|
= note: the matched value is of type `u32`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
6 ~ 1 => println!("Well, that's odd"),
7 ~ 2_u32..=u32::MAX => todo!(),
|
Eu realmente não entendi. Qual é o caso representado por 2_u32..=u32::MAX
?