]> git.proxmox.com Git - rustc.git/blame - src/test/ui/init-large-type.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / ui / init-large-type.rs
CommitLineData
ba9703b0 1// compile-flags: -O
416331ca
XL
2// run-pass
3
0bf4aa26 4#![allow(unused_must_use)]
85aaf69f
SL
5// Makes sure that zero-initializing large types is reasonably fast,
6// Doing it incorrectly causes massive slowdown in LLVM during
7// optimisation.
223e47cc 8
c34b1796 9// pretty-expanded FIXME #23616
7453a54e 10// ignore-emscripten no threads support
85aaf69f 11
b7449926 12#![feature(intrinsics)]
c34b1796 13
ba9703b0 14use std::{mem, thread};
223e47cc 15
85aaf69f
SL
16const SIZE: usize = 1024 * 1024;
17
18fn main() {
19 // do the test in a new thread to avoid (spurious?) stack overflows
9346a6ac 20 thread::spawn(|| {
ba9703b0 21 let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
85aaf69f 22 }).join();
223e47cc 23}