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