E0602: Invalid match type
| Code | Category | Stability |
|---|---|---|
E0602 | Match | Permanent |
Explanation
Rue supports match scrutinees whose type is an integer, bool, or an enum. A value of any other type has no supported pattern domain, so the match is rejected before its arms are analyzed.
Likely cause
Code tries to match a string, struct, array, pointer, or another unsupported value directly. Match a supported field or discriminating value instead, or express the condition with another construct.
Examples
Match a string value
fn main() -> i32 {
match "hello" {
_ => 0,
}
}
Match a supported integer value
fn main() -> i32 {
match 1 {
_ => 0,
}
}