rust/src/test/mir-opt/issue-72181.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
562 B
Rust
Raw Normal View History

// 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,
b: Never
}
2020-07-27 19:22:43 +00:00
// EMIT_MIR issue_72181.foo.mir_map.0.mir
fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 }
2020-07-27 19:22:43 +00:00
// EMIT_MIR issue_72181.bar.mir_map.0.mir
fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x }
2020-07-27 19:22:43 +00:00
// EMIT_MIR issue_72181.main.mir_map.0.mir
fn main() {
let _ = mem::size_of::<Foo>();
let f = [Foo { a: 42 }, Foo { a: 10 }];
let _ = unsafe { f[0].a };
}