rust/src/test/ui/rfc-2008-non-exhaustive/enum.rs

16 lines
376 B
Rust
Raw Normal View History

2017-11-03 14:15:15 -05:00
// aux-build:enums.rs
extern crate enums;
use enums::NonExhaustiveEnum;
fn main() {
let enum_unit = NonExhaustiveEnum::Unit;
match enum_unit {
//~^ ERROR non-exhaustive patterns: `_` not covered [E0004]
NonExhaustiveEnum::Unit => "first",
NonExhaustiveEnum::Tuple(_) => "second",
NonExhaustiveEnum::Struct { .. } => "third"
};
}