about summary refs log tree commit diff
path: root/src/liballoc_jemalloc
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-04-04 18:57:48 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-04-12 22:53:21 +0200
commiteae0d468932660ca383e35bb9d8b0cb4943a82ae (patch)
tree818c14771c58c3fe97bd5d6c18bb94e30fe2064e /src/liballoc_jemalloc
parent96c9d225a9667bc5ffcbc1594d44c29b201e999c (diff)
downloadrust-eae0d468932660ca383e35bb9d8b0cb4943a82ae.tar.gz
rust-eae0d468932660ca383e35bb9d8b0cb4943a82ae.zip
Restore Global.oom() functionality
… now that #[global_allocator] does not define a symbol for it
Diffstat (limited to 'src/liballoc_jemalloc')
-rw-r--r--src/liballoc_jemalloc/Cargo.toml1
-rw-r--r--src/liballoc_jemalloc/lib.rs10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/liballoc_jemalloc/Cargo.toml b/src/liballoc_jemalloc/Cargo.toml
index 7986d5dd2eb..02435170374 100644
--- a/src/liballoc_jemalloc/Cargo.toml
+++ b/src/liballoc_jemalloc/Cargo.toml
@@ -12,6 +12,7 @@ test = false
 doc = false
 
 [dependencies]
+alloc_system = { path = "../liballoc_system" }
 core = { path = "../libcore" }
 libc = { path = "../rustc/libc_shim" }
 compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index 661d7ab78da..2b66c293f21 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -14,6 +14,7 @@
             reason = "this library is unlikely to be stabilized in its current \
                       form or name",
             issue = "27783")]
+#![feature(alloc_system)]
 #![feature(libc)]
 #![feature(linkage)]
 #![feature(staged_api)]
@@ -22,12 +23,15 @@
 #![cfg_attr(not(dummy_jemalloc), feature(allocator_api))]
 #![rustc_alloc_kind = "exe"]
 
+extern crate alloc_system;
 extern crate libc;
 
 #[cfg(not(dummy_jemalloc))]
 pub use contents::*;
 #[cfg(not(dummy_jemalloc))]
 mod contents {
+    use core::alloc::GlobalAlloc;
+    use alloc_system::System;
     use libc::{c_int, c_void, size_t};
 
     // Note that the symbols here are prefixed by default on macOS and Windows (we
@@ -98,6 +102,12 @@ mod contents {
 
     #[no_mangle]
     #[rustc_std_internal_symbol]
+    pub unsafe extern fn __rde_oom() -> ! {
+        System.oom()
+    }
+
+    #[no_mangle]
+    #[rustc_std_internal_symbol]
     pub unsafe extern fn __rde_dealloc(ptr: *mut u8,
                                        size: usize,
                                        align: usize) {