1 // compile-flags: -Z oom=panic
7 #![feature(bench_black_box)]
9 use std::hint::black_box;
11 use std::panic::catch_unwind;
14 let panic = catch_unwind(|| {
15 // This is guaranteed to exceed even the size of the address space
17 // Truncates to a suitable value for both 32-bit and 64-bit targets.
18 let alloc_size = 0x1000_0000_1000_0000u64 as usize;
19 forget(black_box(vec![0u8; alloc_size]));
22 assert!(panic.is_err());