struct FakeAllocator; unsafe impl core::alloc::GlobalAlloc for FakeAllocator { unsafe fn alloc(&self, layout: core::alloc::Layout) -> *mut u8 { extern "Rust" { fn fake_alloc_this_doesnt_exist(layout: core::alloc::Layout) -> *mut u8; } fake_alloc_this_doesnt_exist(layout) } unsafe fn dealloc(&self, ptr: *mut u8, layout: core::alloc::Layout) { extern "Rust" { fn fake_dealloc_this_doesnt_exist(ptr: *mut u8, layout: core::alloc::Layout); } fake_dealloc_this_doesnt_exist(ptr, layout) } } #[global_allocator] static ALLOCATOR: FakeAllocator = FakeAllocator;