mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00
20 lines
397 B
Rust
20 lines
397 B
Rust
//! 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");
|
|
}
|
|
}
|
|
}
|