Skip to content

Commit

Permalink
use AllocRef
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Lee <[email protected]>
  • Loading branch information
BusyJay committed Mar 10, 2020
1 parent 9cba053 commit 18ee69f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern crate jemalloc_sys;
extern crate libc;

#[cfg(feature = "alloc_trait")]
use core::alloc::{Alloc, AllocErr, CannotReallocInPlace, Excess};
use core::alloc::{AllocRef, AllocErr, CannotReallocInPlace, Excess};
use core::alloc::{GlobalAlloc, Layout};
#[cfg(feature = "alloc_trait")]
use core::ptr::NonNull;
Expand Down Expand Up @@ -143,7 +143,7 @@ unsafe impl GlobalAlloc for Jemalloc {
}

#[cfg(feature = "alloc_trait")]
unsafe impl Alloc for Jemalloc {
unsafe impl AllocRef for Jemalloc {
#[inline]
unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
NonNull::new(GlobalAlloc::alloc(self, layout)).ok_or(AllocErr)
Expand Down
2 changes: 1 addition & 1 deletion tests/grow_in_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static A: Jemalloc = Jemalloc;
#[cfg(feature = "alloc_trait")]
fn shrink_in_place() {
unsafe {
use std::alloc::{Alloc, Layout};
use std::alloc::{AllocRef, Layout};

// allocate 7 bytes which end up in the 8 byte size-class as long as
// jemalloc's default size classes are used:
Expand Down
2 changes: 1 addition & 1 deletion tests/shrink_in_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static A: Jemalloc = Jemalloc;
#[cfg(feature = "alloc_trait")]
fn shrink_in_place() {
unsafe {
use std::alloc::{Alloc, Layout};
use std::alloc::{AllocRef, Layout};

// allocate a "large" block of memory:
let orig_sz = 10 * 4096;
Expand Down

0 comments on commit 18ee69f

Please sign in to comment.