From 2f667a88158abf4333018c40bfd03d5bcd20e660 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 27 Apr 2019 20:55:24 -0400 Subject: [PATCH 1/2] Update the API we for setting the alloc error handler --- src/allocator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/allocator.rs b/src/allocator.rs index ddb06533..ee17f353 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -1,4 +1,4 @@ -use core::alloc::{AllocErr, GlobalAlloc, Layout}; +use core::alloc::{GlobalAlloc, Layout}; use bindings; use c_types; @@ -21,7 +21,7 @@ unsafe impl GlobalAlloc for KernelAllocator { } } -#[lang = "oom"] -extern "C" fn oom(_err: AllocErr) -> ! { +#[alloc_error_handler] +extern "C" fn oom(_layout: Layout) -> ! { panic!("Out of memory!"); } From 11011c82e48a711aecbf3ba9b11ed8b10a095737 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 27 Apr 2019 20:59:56 -0400 Subject: [PATCH 2/2] Added missing feature decl --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0c540aeb..589bf1c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![feature(alloc, allocator_api, const_fn, lang_items, panic_handler)] +#![feature(alloc, allocator_api, const_fn, lang_items, panic_handler, alloc_error_handler)] #[macro_use] extern crate alloc;