about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-05-21 00:18:10 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-05-21 16:16:17 -0400
commitf1ce693e618dbf4273e0e1af8fd101e15964f5f0 (patch)
treeebbb78b661056004f9842b56bca77948f7cf17b3 /src/liballoc
parent945019830b45316005982853a54c6b74f057d314 (diff)
downloadrust-f1ce693e618dbf4273e0e1af8fd101e15964f5f0.tar.gz
rust-f1ce693e618dbf4273e0e1af8fd101e15964f5f0.zip
alter `exchange_free` for sized deallocation
The support for sized deallocation is nearly complete. The only known
missing pieces are `Box<str>`, `Box<[T]>` and `proc`.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/heap.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 40f60c365d2..631b72cb897 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // FIXME: #13994: port to the sized deallocation API when available
-// FIXME: #13996: need a way to mark the `allocate` and `reallocate` return values as `noalias`
+// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` and `nonnull`
 
 use core::intrinsics::{abort, cttz32};
 use core::option::{None, Option};
@@ -133,14 +133,20 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
     }
 }
 
-#[cfg(not(test))]
+#[cfg(not(test), stage0)]
 #[lang="exchange_free"]
 #[inline]
-// FIXME: #13994 (rustc should pass align and size here)
 unsafe fn exchange_free(ptr: *mut u8) {
     deallocate(ptr, 0, 8);
 }
 
+#[cfg(not(test), not(stage0))]
+#[lang="exchange_free"]
+#[inline]
+unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
+    deallocate(ptr, size, align);
+}
+
 // FIXME: #7496
 #[cfg(not(test))]
 #[lang="closure_exchange_malloc"]