]> git.lizzy.rs Git - rust.git/blob - tests/ui/codegen/init-large-type.rs
Rollup merge of #103236 - tspiteri:redoc-int-adc-sbb, r=m-ou-se
[rust.git] / tests / ui / codegen / init-large-type.rs
1 // compile-flags: -O
2 // run-pass
3
4 #![allow(unused_must_use)]
5 // Makes sure that zero-initializing large types is reasonably fast,
6 // Doing it incorrectly causes massive slowdown in LLVM during
7 // optimisation.
8
9 // pretty-expanded FIXME #23616
10 // ignore-emscripten no threads support
11
12 #![feature(intrinsics)]
13
14 use std::{mem, thread};
15
16 const SIZE: usize = 1024 * 1024;
17
18 fn main() {
19     // do the test in a new thread to avoid (spurious?) stack overflows
20     thread::spawn(|| {
21         let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
22     }).join();
23 }