]> git.lizzy.rs Git - rust.git/blob - src/test/ui/init-large-type.rs
Update const_forget.rs
[rust.git] / src / test / ui / init-large-type.rs
1 // run-pass
2
3 #![allow(unused_must_use)]
4 // Makes sure that zero-initializing large types is reasonably fast,
5 // Doing it incorrectly causes massive slowdown in LLVM during
6 // optimisation.
7
8 // pretty-expanded FIXME #23616
9 // ignore-emscripten no threads support
10
11 #![feature(intrinsics)]
12
13 use std::thread;
14
15 extern "rust-intrinsic" {
16     pub fn init<T>() -> T;
17 }
18
19 const SIZE: usize = 1024 * 1024;
20
21 fn main() {
22     // do the test in a new thread to avoid (spurious?) stack overflows
23     thread::spawn(|| {
24         let _memory: [u8; SIZE] = unsafe { init() };
25     }).join();
26 }