about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-08-26 10:31:06 +0000
committerbors <bors@rust-lang.org>2014-08-26 10:31:06 +0000
commit7932b719ec2b65acfa8c3e74aad29346d47ee992 (patch)
treea2326fb40572a4484189cd92e1cce26e616ad959 /src/liballoc
parent1cad4089ba0dc46248da2459af904e38243f294d (diff)
parent08364a4cacdcd6f161e0fb0ab573ae825e22447b (diff)
downloadrust-7932b719ec2b65acfa8c3e74aad29346d47ee992.tar.gz
rust-7932b719ec2b65acfa8c3e74aad29346d47ee992.zip
auto merge of #14397 : nick29581/rust/coerce, r=pnkfelix
DST coercions and DST fields in structs

The commits are not quite stand alone, I should probably squash them together before landing. In particular if you review the individual commits, then you'll see some scrappy stuff that gets fixed in later commits. But reading the commits in order might be easier to get an overall idea of what is going on.

The first commit includes putting back time zone into our time library - @pcwalton removed that as part of his de-~str'ing, but I had already converted it to use StrBuf, so we may as well leave it in. Update: no longer, this is removed in a later commit.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/heap.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index ab686cb01d6..38216fa5b59 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -12,6 +12,7 @@
 // FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
 //                and `nonnull`
 
+use core::ptr::RawPtr;
 #[cfg(not(test))] use core::raw;
 #[cfg(not(test))] use util;
 
@@ -69,6 +70,11 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
 /// the value returned by `usable_size` for the requested size.
 #[inline]
 pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
+    // FIXME(14395) This is only required for DST ~[T], it should be removed once
+    // we fix that representation to not use null pointers.
+    if ptr.is_null() {
+        return;
+    }
     imp::deallocate(ptr, size, align)
 }