Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Commit 9ac0479

Browse files
alexreaperhulk
authored andcommitted
Update the API we for setting the alloc error handler (#71)
* Update the API we for setting the alloc error handler * Added missing feature decl
1 parent 4e99b4f commit 9ac0479

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/allocator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::alloc::{AllocErr, GlobalAlloc, Layout};
1+
use core::alloc::{GlobalAlloc, Layout};
22

33
use bindings;
44
use c_types;
@@ -21,7 +21,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
2121
}
2222
}
2323

24-
#[lang = "oom"]
25-
extern "C" fn oom(_err: AllocErr) -> ! {
24+
#[alloc_error_handler]
25+
extern "C" fn oom(_layout: Layout) -> ! {
2626
panic!("Out of memory!");
2727
}

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![no_std]
2-
#![feature(alloc, allocator_api, const_fn, lang_items, panic_handler)]
2+
#![feature(alloc, allocator_api, const_fn, lang_items, panic_handler, alloc_error_handler)]
33

44
#[macro_use]
55
extern crate alloc;

0 commit comments

Comments
 (0)