Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0602: Invalid match type

CodeCategoryStability
E0602MatchPermanent

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,
    }
}

References