diff options
| author | bors <bors@rust-lang.org> | 2014-09-06 21:46:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-09-06 21:46:25 +0000 |
| commit | 38eb0e551411ba0d175a55ed6d01bb529d1c8684 (patch) | |
| tree | 2fa3fb56ae2926d90b30bec0d9555f034fa7d627 /src/liballoc | |
| parent | d8a26184dc103025e7ad457ffd8deb391019dbfe (diff) | |
| parent | c76e3caf104e3166c322cbce2e7ac547eb040ad4 (diff) | |
| download | rust-38eb0e551411ba0d175a55ed6d01bb529d1c8684.tar.gz rust-38eb0e551411ba0d175a55ed6d01bb529d1c8684.zip | |
auto merge of #17012 : thestinger/rust/sized, r=nikomatsakis
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/heap.rs | 19 |
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}; |
