about summary refs log tree commit diff
path: root/tests/ui/mir/enum/niche_option_tuple_break.rs
blob: 0a933afa1535bdf6ae0fd696c008226ab4ac627b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ run-crash
//@ compile-flags: -C debug-assertions
//@ error-pattern: trying to construct an enum from an invalid value

#[allow(dead_code)]
#[repr(u32)]
enum Foo {
    A,
    B,
}

#[allow(dead_code)]
struct Bar {
    a: u32,
    b: u32,
}

fn main() {
    let _val: Option<(u32, Foo)> =
        unsafe { std::mem::transmute::<_, Option<(u32, Foo)>>(Bar { a: 3, b: 3 }) };
}