E0600: Non exhaustive match
| Code | Category | Stability |
|---|---|---|
E0600 | Match | Permanent |
Explanation
A match must cover every possible value of its scrutinee type. Boolean matches need both literal cases, enum matches need every variant, and integer matches need an irrefutable wildcard arm; a wildcard also makes a boolean or enum match exhaustive.
Likely cause
One boolean literal or enum variant is missing, an integer match lists only specific values, or a match on an externally non-exhaustive enum omits the wildcard needed to cover variants that may be added outside the current module.
Examples
Omit one boolean case
fn main() -> i32 {
match true {
true => 1,
}
}
Cover both boolean cases
fn main() -> i32 {
match true {
true => 1,
false => 0,
}
}