2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2020-06-18 04:37:59 -05:00
|
|
|
//@ compile-flags: -Z mir-opt-level=1
|
|
|
|
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
|
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
enum Never {}
|
|
|
|
|
|
|
|
union Foo {
|
|
|
|
a: u64,
|
2024-06-02 19:18:33 -05:00
|
|
|
b: Never,
|
2020-06-18 04:37:59 -05:00
|
|
|
}
|
|
|
|
|
2022-09-04 22:00:31 -05:00
|
|
|
// EMIT_MIR issue_72181.foo.built.after.mir
|
2024-06-02 19:18:33 -05:00
|
|
|
fn foo(xs: [(Never, u32); 1]) -> u32 {
|
|
|
|
xs[0].1
|
|
|
|
}
|
2020-06-18 04:37:59 -05:00
|
|
|
|
2022-09-04 22:00:31 -05:00
|
|
|
// EMIT_MIR issue_72181.bar.built.after.mir
|
2024-06-02 19:18:33 -05:00
|
|
|
fn bar([(_, x)]: [(Never, u32); 1]) -> u32 {
|
|
|
|
x
|
|
|
|
}
|
2022-09-05 00:35:47 -05:00
|
|
|
|
2022-09-04 22:00:31 -05:00
|
|
|
// EMIT_MIR issue_72181.main.built.after.mir
|
2020-06-18 04:37:59 -05:00
|
|
|
fn main() {
|
|
|
|
let _ = mem::size_of::<Foo>();
|
|
|
|
|
|
|
|
let f = [Foo { a: 42 }, Foo { a: 10 }];
|
|
|
|
let _ = unsafe { f[0].a };
|
|
|
|
}
|