Update to new dependencies

This commit is contained in:
Jeremy Soller
2018-06-19 18:17:16 -06:00
parent fc0db71dd4
commit c28c147add
16 changed files with 139 additions and 140 deletions

View File

@@ -1,4 +1,4 @@
use alloc::heap::{AllocErr, GlobalAlloc, Layout, Opaque};
use core::alloc::{AllocErr, GlobalAlloc, Layout};
use core::ptr::NonNull;
use linked_list_allocator::Heap;
use spin::Mutex;
@@ -16,7 +16,7 @@ impl Allocator {
}
unsafe impl GlobalAlloc for Allocator {
unsafe fn alloc(&self, layout: Layout) -> *mut Opaque {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
loop {
let res = if let Some(ref mut heap) = *HEAP.lock() {
heap.allocate_first_fit(layout)
@@ -40,12 +40,12 @@ unsafe impl GlobalAlloc for Allocator {
panic!("__rust_allocate: heap not initialized");
}
},
other => return other.ok().map_or(0 as *mut Opaque, |allocation| allocation.as_ptr()),
other => return other.ok().map_or(0 as *mut u8, |allocation| allocation.as_ptr()),
}
}
}
unsafe fn dealloc(&self, ptr: *mut Opaque, layout: Layout) {
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
if let Some(ref mut heap) = *HEAP.lock() {
heap.deallocate(NonNull::new_unchecked(ptr), layout)
} else {

View File

@@ -1,4 +1,4 @@
use alloc::heap::{Alloc, AllocErr, Layout};
use core::alloc::{Alloc, AllocErr, Layout};
use spin::Mutex;
use slab_allocator::Heap;