Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAlloc
This commit is contained in:
parent
0b7c9e756e
commit
f6ab74b8e7
17 changed files with 130 additions and 175 deletions
|
@ -74,7 +74,7 @@ pub extern fn rust_oom(layout: Layout) -> ! {
|
|||
#[doc(hidden)]
|
||||
#[allow(unused_attributes)]
|
||||
pub mod __default_lib_allocator {
|
||||
use super::{System, Layout, GlobalAlloc, Opaque};
|
||||
use super::{System, Layout, GlobalAlloc};
|
||||
// for symbol names src/librustc/middle/allocator.rs
|
||||
// for signatures src/librustc_allocator/lib.rs
|
||||
|
||||
|
@ -85,7 +85,7 @@ pub mod __default_lib_allocator {
|
|||
#[rustc_std_internal_symbol]
|
||||
pub unsafe extern fn __rdl_alloc(size: usize, align: usize) -> *mut u8 {
|
||||
let layout = Layout::from_size_align_unchecked(size, align);
|
||||
System.alloc(layout) as *mut u8
|
||||
System.alloc(layout)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -93,7 +93,7 @@ pub mod __default_lib_allocator {
|
|||
pub unsafe extern fn __rdl_dealloc(ptr: *mut u8,
|
||||
size: usize,
|
||||
align: usize) {
|
||||
System.dealloc(ptr as *mut Opaque, Layout::from_size_align_unchecked(size, align))
|
||||
System.dealloc(ptr, Layout::from_size_align_unchecked(size, align))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -103,13 +103,13 @@ pub mod __default_lib_allocator {
|
|||
align: usize,
|
||||
new_size: usize) -> *mut u8 {
|
||||
let old_layout = Layout::from_size_align_unchecked(old_size, align);
|
||||
System.realloc(ptr as *mut Opaque, old_layout, new_size) as *mut u8
|
||||
System.realloc(ptr, old_layout, new_size)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[rustc_std_internal_symbol]
|
||||
pub unsafe extern fn __rdl_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
|
||||
let layout = Layout::from_size_align_unchecked(size, align);
|
||||
System.alloc_zeroed(layout) as *mut u8
|
||||
System.alloc_zeroed(layout)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue