Panic on alloc::oom instead of calling intrinsics::abort (#375)

This commit is contained in:
Rob Gries
2017-12-15 03:20:50 -05:00
committed by Philipp Oppermann
parent 2e8da22b32
commit 5e937e6e20

View File

@@ -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`