diff --git a/src/lib.rs b/src/lib.rs index 9bed20b..3ea6a64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -132,6 +132,10 @@ unsafe impl Alloc for Heap { unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) { self.deallocate(ptr, layout) } + + fn oom(&mut self, _: AllocErr) -> ! { + panic!("Out of memory"); + } } pub struct LockedHeap(Mutex); @@ -171,6 +175,10 @@ unsafe impl<'a> Alloc for &'a LockedHeap { unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) { self.0.lock().deallocate(ptr, layout) } + + fn oom(&mut self, _: AllocErr) -> ! { + panic!("Out of memory"); + } } /// Align downwards. Returns the greatest x with alignment `align`