2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2019-03-22 11:19:12 -05:00
|
|
|
|
2017-11-03 14:15:15 -05:00
|
|
|
#[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",
|
|
|
|
};
|
|
|
|
}
|