Merge pull request #947 from fitzgen/use-global-allocator-not-system

Use the global allocator, not the system allocator
This commit is contained in:
Alex Crichton 2018-10-10 08:43:23 -07:00 committed by GitHub
commit 35eeb711ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -809,7 +809,7 @@ pub mod __rt {
}
if_std! {
use std::alloc::{System, GlobalAlloc, Layout};
use std::alloc::{alloc, dealloc, Layout};
use std::mem;
#[no_mangle]
@ -817,7 +817,7 @@ pub mod __rt {
let align = mem::align_of::<usize>();
if let Ok(layout) = Layout::from_size_align(size, align) {
unsafe {
let ptr = System.alloc(layout);
let ptr = alloc(layout);
if !ptr.is_null() {
return ptr
}
@ -836,7 +836,7 @@ pub mod __rt {
}
let align = mem::align_of::<usize>();
let layout = Layout::from_size_align_unchecked(size, align);
System.dealloc(ptr, layout);
dealloc(ptr, layout);
}
}