diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-03 14:09:16 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-03 17:11:26 -0700 |
| commit | 487fa9568b69753fecb74a8460109239f4bf3631 (patch) | |
| tree | 825968a6d9424674217c04ff35cc6f5daf42be43 /src/libstd/rt | |
| parent | 57e0908af395af1c10e28600b785b5366a43660c (diff) | |
| download | rust-487fa9568b69753fecb74a8460109239f4bf3631.tar.gz rust-487fa9568b69753fecb74a8460109239f4bf3631.zip | |
Test fixes from the rollup
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/global_heap.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs index 3917857e1af..5c1b6cd4791 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/global_heap.rs @@ -64,16 +64,16 @@ pub unsafe fn realloc_raw(ptr: *mut u8, size: 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: () = (); - /// The allocator for unique pointers without contained managed pointers. #[cfg(not(test))] #[lang="exchange_malloc"] #[inline] pub unsafe fn exchange_malloc(size: 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 } else { |
