Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
(cherry picked from commit 5f575bc)
  • Loading branch information
compiler-errors authored and cuviper committed Mar 7, 2025
1 parent 6be2e1e commit cd87b03
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/codegen/slice-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ pub fn option_none_init() -> [Option<u8>; N] {
[None; N]
}

use std::mem::MaybeUninit;

// FIXME: This could be optimized into a memset.
// Regression test for <https://github.com/rust-lang/rust/issues/137892>.
#[no_mangle]
pub fn half_uninit() -> [(u128, MaybeUninit<u128>); N] {
// CHECK-NOT: select
// CHECK: br label %repeat_loop_header{{.*}}
// CHECK-NOT: switch
// CHECK: icmp
// CHECK-NOT: call void @llvm.memset.p0
[const { (0, MaybeUninit::uninit()) }; N]
}

// Use an opaque function to prevent rustc from removing useless drops.
#[inline(never)]
pub fn opaque(_: impl Sized) {}

0 comments on commit cd87b03

Please sign in to comment.