mirror of https://github.com/rust-lang/rust
19 lines
351 B
Rust
19 lines
351 B
Rust
//@ run-pass
|
|
|
|
#[non_exhaustive]
|
|
pub enum NonExhaustiveEnum {
|
|
Unit,
|
|
Tuple(u32),
|
|
Struct { field: u32 }
|
|
}
|
|
|
|
fn main() {
|
|
let enum_unit = NonExhaustiveEnum::Unit;
|
|
|
|
match enum_unit {
|
|
NonExhaustiveEnum::Unit => "first",
|
|
NonExhaustiveEnum::Tuple(_) => "second",
|
|
NonExhaustiveEnum::Struct { .. } => "third",
|
|
};
|
|
}
|