summary refs log tree commit diff
path: root/src/test/codegen/box-maybe-uninit.rs
blob: a7fb74c04731d877ea36b9e28a8ce9f1d7140527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// compile-flags: -O
#![crate_type="lib"]
#![feature(maybe_uninit)]

use std::mem::MaybeUninit;

// Boxing a `MaybeUninit` value should not copy junk from the stack
#[no_mangle]
pub fn box_uninitialized() -> Box<MaybeUninit<usize>> {
    // CHECK-LABEL: @box_uninitialized
    // CHECK-NOT: store
    Box::new(MaybeUninit::uninitialized())
}