about summary refs log tree commit diff
path: root/tests/mir-opt/gvn_uninhabited.rs
blob: 015949c5d20b95e68f097520fe822a09634e809b (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
//@ test-mir-pass: GVN
//@ compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// skip-filecheck

#![feature(never_type)]

#[derive(Copy, Clone)]
pub enum E {
    A(!, u32),
}

pub union U {
    i: u32,
    e: E,
}

// EMIT_MIR gvn_uninhabited.f.GVN.diff
pub const fn f() -> u32 {
    let E::A(_, i) = unsafe { (&U { i: 0 }).e };
    i
}

fn main() {}