about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs
blob: f4130319eea5d06828af0934e4599a97ecb630a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//@ run-pass
#![allow(unreachable_patterns)]
#![allow(dead_code)]

enum Empty {}
enum Test1 {
    A(u8),
    B(Empty),
}
enum Test2 {
    A(u8),
    B(Empty),
    C,
}

fn bar() -> Option<Empty> {
    None
}

fn main() {
    if let Some(x) = bar() {
        Test1::B(x);
    }

    if let Some(x) = bar() {
        Test2::B(x);
    }
}