Skip to content

Commit cd87b03

Browse files
compiler-errorscuviper
authored andcommitted
Add a test
(cherry picked from commit 5f575bc)
1 parent 6be2e1e commit cd87b03

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/codegen/slice-init.rs

+14
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ pub fn option_none_init() -> [Option<u8>; N] {
8989
[None; N]
9090
}
9191

92+
use std::mem::MaybeUninit;
93+
94+
// FIXME: This could be optimized into a memset.
95+
// Regression test for <https://github.com/rust-lang/rust/issues/137892>.
96+
#[no_mangle]
97+
pub fn half_uninit() -> [(u128, MaybeUninit<u128>); N] {
98+
// CHECK-NOT: select
99+
// CHECK: br label %repeat_loop_header{{.*}}
100+
// CHECK-NOT: switch
101+
// CHECK: icmp
102+
// CHECK-NOT: call void @llvm.memset.p0
103+
[const { (0, MaybeUninit::uninit()) }; N]
104+
}
105+
92106
// Use an opaque function to prevent rustc from removing useless drops.
93107
#[inline(never)]
94108
pub fn opaque(_: impl Sized) {}

0 commit comments

Comments
 (0)