Skip to content
This repository was archived by the owner on Aug 9, 2022. It is now read-only.

Commit e8dd426

Browse files
authored
Merge pull request #54 from kelnos/rust-1.50
Updates for rust 1.50
2 parents 66c964c + dcc0ea7 commit e8dd426

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ esp32 = "0.10.0"
4444
bare-metal = "0.2"
4545
nb = "0.1.2"
4646
embedded-hal = { version = "0.2.3", features = ["unproven"] }
47-
linked_list_allocator = { version = "=0.8.6", optional = true, default-features = false, features = ["alloc_ref"] }
47+
linked_list_allocator = { version = "=0.8.11", optional = true, default-features = false, features = ["alloc_ref"] }
4848
void = { version = "1.0.2", default-features = false }
4949

5050
[dev-dependencies]

src/alloc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,20 @@ unsafe impl GlobalAlloc for Allocator {
149149
}
150150

151151
extern crate alloc;
152-
use alloc::alloc::{AllocErr, AllocRef};
152+
use alloc::alloc::{AllocError, Allocator as AllocAllocator};
153153

154-
unsafe impl AllocRef for Allocator {
155-
fn alloc(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> {
154+
unsafe impl AllocAllocator for Allocator {
155+
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
156156
if layout.size() == 0 {
157157
return Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0));
158158
}
159159
let ptr = unsafe { GlobalAlloc::alloc(self, layout) };
160160
match NonNull::new(ptr) {
161161
Some(ptr) => Ok(NonNull::slice_from_raw_parts(ptr, layout.size())),
162-
None => Err(AllocErr)
162+
None => Err(AllocError)
163163
}
164164
}
165-
unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout) {
165+
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
166166
if layout.size() != 0 {
167167
GlobalAlloc::dealloc(self, ptr.as_ptr(), layout);
168168
}
@@ -252,14 +252,14 @@ unsafe impl GlobalAlloc for GeneralAllocator {
252252
&& layout.size() >= core::mem::size_of::<usize>()
253253
&& layout.align() >= core::mem::size_of::<usize>()
254254
{
255-
let res = IRAM_ALLOCATOR.alloc(layout);
255+
let res = GlobalAlloc::alloc(&IRAM_ALLOCATOR, layout);
256256
if res != 0 as *mut u8 {
257257
return res;
258258
}
259259
}
260260

261261
// if not external or IRAM then place in DRAM
262-
let res = DRAM_ALLOCATOR.alloc(layout);
262+
let res = GlobalAlloc::alloc(&DRAM_ALLOCATOR, layout);
263263
if res != 0 as *mut u8 {
264264
return res;
265265
}

0 commit comments

Comments
 (0)