]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/box-maybe-uninit.rs
Rollup merge of #69609 - TimDiekmann:excess, r=Amanieu
[rust.git] / src / test / codegen / box-maybe-uninit.rs
1 // compile-flags: -O
2 #![crate_type="lib"]
3
4 use std::mem::MaybeUninit;
5
6 // Boxing a `MaybeUninit` value should not copy junk from the stack
7 #[no_mangle]
8 pub fn box_uninitialized() -> Box<MaybeUninit<usize>> {
9     // CHECK-LABEL: @box_uninitialized
10     // CHECK-NOT: store
11     // CHECK-NOT: alloca
12     // CHECK-NOT: memcpy
13     // CHECK-NOT: memset
14     Box::new(MaybeUninit::uninit())
15 }
16
17 // FIXME: add a test for a bigger box. Currently broken, see
18 // https://github.com/rust-lang/rust/issues/58201.