From 5e937e6e209a426199576959f058e9b4948e56a0 Mon Sep 17 00:00:00 2001 From: Rob Gries Date: Fri, 15 Dec 2017 03:20:50 -0500 Subject: [PATCH] Panic on alloc::oom instead of calling intrinsics::abort (#375) --- src/memory/heap_allocator.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/memory/heap_allocator.rs b/src/memory/heap_allocator.rs index 0a232f92..cf8e6d20 100644 --- a/src/memory/heap_allocator.rs +++ b/src/memory/heap_allocator.rs @@ -41,6 +41,10 @@ unsafe impl<'a> Alloc for &'a BumpAllocator { unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) { // do nothing, leak memory } + + fn oom(&mut self, _: AllocErr) -> ! { + panic!("Out of memory"); + } } /// Align downwards. Returns the greatest x with alignment `align`