From 4e8199b572f2035b7749cba276ece3a26630d23e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:21 +0200 Subject: Adding upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- src/test/mir-opt/issue_72181.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/mir-opt/issue_72181.rs (limited to 'src/test/mir-opt/issue_72181.rs') diff --git a/src/test/mir-opt/issue_72181.rs b/src/test/mir-opt/issue_72181.rs new file mode 100644 index 000000000..6a32d4bbe --- /dev/null +++ b/src/test/mir-opt/issue_72181.rs @@ -0,0 +1,28 @@ +// 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 +} + + +// EMIT_MIR issue_72181.foo.built.after.mir +fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } + +// EMIT_MIR issue_72181.bar.built.after.mir +fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } + + +// EMIT_MIR issue_72181.main.built.after.mir +fn main() { + let _ = mem::size_of::(); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + let _ = unsafe { f[0].a }; +} -- cgit v1.2.3