diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-19 23:19:56 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-22 14:42:02 -0700 |
| commit | e878721d70349e2055f0ef854085de92e9498fde (patch) | |
| tree | 35940d52f145bca81dcf73e5e7da7f3847ceb413 /src/liballoc/heap.rs | |
| parent | 5633d4641f7d63805e3c12c899f8401410bd825f (diff) | |
| download | rust-e878721d70349e2055f0ef854085de92e9498fde.tar.gz rust-e878721d70349e2055f0ef854085de92e9498fde.zip | |
libcore: Remove all uses of `~str` from `libcore`.
[breaking-change]
Diffstat (limited to 'src/liballoc/heap.rs')
| -rw-r--r-- | src/liballoc/heap.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 631b72cb897..8376fc578db 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -116,18 +116,18 @@ pub fn stats_print() { } } +// The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size +// allocations can point to this `static`. It would be incorrect to use a null +// pointer, due to enums assuming types like unique pointers are never null. +pub static mut EMPTY: uint = 12345; + /// The allocator for unique pointers. #[cfg(not(test))] #[lang="exchange_malloc"] #[inline] unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 { - // The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size - // allocations can point to this `static`. It would be incorrect to use a null - // pointer, due to enums assuming types like unique pointers are never null. - static EMPTY: () = (); - if size == 0 { - &EMPTY as *() as *mut u8 + &EMPTY as *uint as *mut u8 } else { allocate(size, align) } |
