3 #![allow(stable_features)]
5 #![feature(allocator_api, nonnull)]
7 use std::alloc::{Alloc, Global, Layout, handle_alloc_error};
11 let ptr = Global.alloc_one::<i32>().unwrap_or_else(|_| {
12 handle_alloc_error(Layout::new::<i32>())
15 assert_eq!(*ptr.as_ptr(), 4);
16 Global.dealloc_one(ptr);