summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate.rs
blob: 54e42917f52d2357acf8c18c7313df514067a85d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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",
    };
}