about summary refs log tree commit diff
path: root/tests/ui/pattern/pattern-match-invalid-variant.rs
blob: 183031553c043dc407eaffd9dad44e19a6799800 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Tests invalid enum variant in a match expression.

enum Color {
    Rgb(isize, isize, isize),
    Rgba(isize, isize, isize, isize),
}

fn main() {
    let red: Color = Color::Rgb(255, 0, 0);
    match red {
        Color::Rgb(r, g, b) => {
            println!("rgb");
        }
        Color::Hsl(h, s, l) => {
            //~^ ERROR no variant
            println!("hsl");
        }
    }
}