about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-09-05 01:07:51 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-09-06 13:50:58 -0400
commit5aa2da013356e814204a0bd5751dbabb71307213 (patch)
tree34450b6e62412311048d3551c1d24d1cf1fcd8c6 /src/liballoc
parent395e453c06cce045d2e0613a1c6edab2dcfdeceb (diff)
downloadrust-5aa2da013356e814204a0bd5751dbabb71307213.tar.gz
rust-5aa2da013356e814204a0bd5751dbabb71307213.zip
fix sized deallocation for proc
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/heap.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 38216fa5b59..c72a77702af 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -14,7 +14,7 @@
 
 use core::ptr::RawPtr;
 #[cfg(not(test))] use core::raw;
-#[cfg(not(test))] use util;
+#[cfg(stage0, not(test))] use util;
 
 /// Returns a pointer to `size` bytes of memory.
 ///
@@ -119,7 +119,7 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
 }
 
 // FIXME: #7496
-#[cfg(not(test))]
+#[cfg(stage0, not(test))]
 #[lang="closure_exchange_malloc"]
 #[inline]
 #[allow(deprecated)]
@@ -134,6 +134,21 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
     alloc as *mut u8
 }
 
+// FIXME: #7496
+#[cfg(not(stage0), not(test))]
+#[lang="closure_exchange_malloc"]
+#[inline]
+#[allow(deprecated)]
+unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
+                                  align: uint) -> *mut u8 {
+    let p = allocate(size, align);
+
+    let alloc = p as *mut raw::Box<()>;
+    (*alloc).drop_glue = drop_glue;
+
+    alloc as *mut u8
+}
+
 #[cfg(jemalloc)]
 mod imp {
     use core::option::{None, Option};