From 9a56412a581c64d31970973a1276d1332f006b20 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 27 Apr 2018 13:03:27 +0200 Subject: [PATCH 1/2] Upgrade to rustc 1.27.0-nightly (7f3444e1b 2018-04-26) --- Cargo.toml | 2 +- src/lib.rs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b5180ebd3a..f9766f9467 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jemallocator" -version = "0.1.6" +version = "0.1.7" authors = ["Alex Crichton "] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 2ee8158bbf..f67bf9ddd9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ extern crate libc; use std::mem; use std::ptr::{self, NonNull}; -use std::heap::{GlobalAlloc, Alloc, Layout, Opaque, Excess, CannotReallocInPlace, AllocErr, System}; +use std::heap::{GlobalAlloc, Alloc, Layout, Opaque, Excess, CannotReallocInPlace, AllocErr}; use libc::{c_int, c_void}; @@ -100,11 +100,6 @@ unsafe impl GlobalAlloc for Jemalloc { let ptr = ffi::rallocx(ptr as *mut c_void, new_size, flags); ptr as *mut Opaque } - - #[inline] - fn oom(&self) -> ! { - System.oom() - } } unsafe impl Alloc for Jemalloc { @@ -158,11 +153,6 @@ unsafe impl Alloc for Jemalloc { } } - #[inline] - fn oom(&mut self) -> ! { - System.oom() - } - #[inline] fn usable_size(&self, layout: &Layout) -> (usize, usize) { let flags = layout_to_flags(layout.align(), layout.size()); From de7ab8adf3fc898b3c5fb7d5c98311b3a8a5fddd Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 27 Apr 2018 13:04:44 +0200 Subject: [PATCH 2/2] Make jemallocator no_std --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f67bf9ddd9..cac1cea222 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,13 +17,14 @@ #![feature(allocator_api, nonnull_cast)] #![deny(missing_docs)] +#![no_std] extern crate jemalloc_sys; extern crate libc; -use std::mem; -use std::ptr::{self, NonNull}; -use std::heap::{GlobalAlloc, Alloc, Layout, Opaque, Excess, CannotReallocInPlace, AllocErr}; +use core::mem; +use core::ptr::{self, NonNull}; +use core::heap::{GlobalAlloc, Alloc, Layout, Opaque, Excess, CannotReallocInPlace, AllocErr}; use libc::{c_int, c_void};