about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2012-07-09 17:23:13 -0700
committerMichael Sullivan <sully@msully.net>2012-07-11 11:42:49 -0700
commit120773b2a7b6a1ca8ba859528f3e3cd9e574bf3d (patch)
tree2e36c29b5326b0338da02c0c323f42e6b8b9030c /src/libstd
parenta7897b3ef3a75852f0494d45887c45587317ed8c (diff)
Change the interface of placement new to take a tydesc as part of Issue #2831.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arena.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index fed358d9388..65fcd0a59ca 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -31,11 +31,11 @@ impl arena for arena {
         head = chunk(uint::next_power_of_two(new_min_chunk_size + 1u));
         self.chunks = @cons(head, self.chunks);
 
-        ret self.alloc(n_bytes, align);
+        ret self.alloc_inner(n_bytes, align);
     }
 
     #[inline(always)]
-    fn alloc(n_bytes: uint, align: uint) -> *() {
+    fn alloc_inner(n_bytes: uint, align: uint) -> *() {
         let alignm1 = align - 1u;
         let mut head = list::head(self.chunks);
 
@@ -52,5 +52,13 @@ impl arena for arena {
             ret unsafe::reinterpret_cast(p);
         }
     }
+
+    #[inline(always)]
+    fn alloc(tydesc: *()) -> *() {
+        unsafe {
+            let tydesc = tydesc as *sys::type_desc;
+            self.alloc_inner((*tydesc).size, (*tydesc).align)
+        }
+    }
 }