@@ -149,20 +149,20 @@ unsafe impl GlobalAlloc for Allocator {
149
149
}
150
150
151
151
extern crate alloc;
152
- use alloc:: alloc:: { AllocErr , AllocRef } ;
152
+ use alloc:: alloc:: { AllocError , Allocator as AllocAllocator } ;
153
153
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 > {
156
156
if layout. size ( ) == 0 {
157
157
return Ok ( NonNull :: slice_from_raw_parts ( layout. dangling ( ) , 0 ) ) ;
158
158
}
159
159
let ptr = unsafe { GlobalAlloc :: alloc ( self , layout) } ;
160
160
match NonNull :: new ( ptr) {
161
161
Some ( ptr) => Ok ( NonNull :: slice_from_raw_parts ( ptr, layout. size ( ) ) ) ,
162
- None => Err ( AllocErr )
162
+ None => Err ( AllocError )
163
163
}
164
164
}
165
- unsafe fn dealloc ( & mut self , ptr : NonNull < u8 > , layout : Layout ) {
165
+ unsafe fn deallocate ( & self , ptr : NonNull < u8 > , layout : Layout ) {
166
166
if layout. size ( ) != 0 {
167
167
GlobalAlloc :: dealloc ( self , ptr. as_ptr ( ) , layout) ;
168
168
}
@@ -252,14 +252,14 @@ unsafe impl GlobalAlloc for GeneralAllocator {
252
252
&& layout. size ( ) >= core:: mem:: size_of :: < usize > ( )
253
253
&& layout. align ( ) >= core:: mem:: size_of :: < usize > ( )
254
254
{
255
- let res = IRAM_ALLOCATOR . alloc ( layout) ;
255
+ let res = GlobalAlloc :: alloc ( & IRAM_ALLOCATOR , layout) ;
256
256
if res != 0 as * mut u8 {
257
257
return res;
258
258
}
259
259
}
260
260
261
261
// if not external or IRAM then place in DRAM
262
- let res = DRAM_ALLOCATOR . alloc ( layout) ;
262
+ let res = GlobalAlloc :: alloc ( & DRAM_ALLOCATOR , layout) ;
263
263
if res != 0 as * mut u8 {
264
264
return res;
265
265
}
0 commit comments