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