about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-12 00:31:52 -0700
committerbors <bors@rust-lang.org>2014-05-12 00:31:52 -0700
commit0550b79f73996b69e7f3540fc365b7e49455ca75 (patch)
treeea9d583a587975c086342c3dfe5717a94d4d602f /src/libstd
parente031ba1028a1705708401a04f5823bcc3e4a439c (diff)
parent8b912bc56be35149a405752f134b8b659366a35c (diff)
downloadrust-0550b79f73996b69e7f3540fc365b7e49455ca75.tar.gz
rust-0550b79f73996b69e7f3540fc365b7e49455ca75.zip
auto merge of #14127 : thestinger/rust/snapshot, r=huonw
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/heap.rs38
-rw-r--r--src/libstd/slice.rs48
2 files changed, 2 insertions, 84 deletions
diff --git a/src/libstd/rt/heap.rs b/src/libstd/rt/heap.rs
index b729fb38035..e616b9b8beb 100644
--- a/src/libstd/rt/heap.rs
+++ b/src/libstd/rt/heap.rs
@@ -114,15 +114,7 @@ pub fn stats_print() {
 }
 
 /// The allocator for unique pointers.
-#[cfg(stage0)]
-#[lang="exchange_malloc"]
-#[inline(always)]
-pub unsafe fn exchange_malloc_(size: uint) -> *mut u8 {
-    exchange_malloc(size)
-}
-
-/// The allocator for unique pointers.
-#[cfg(not(test), not(stage0))]
+#[cfg(not(test))]
 #[lang="exchange_malloc"]
 #[inline(always)]
 pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 {
@@ -130,23 +122,6 @@ pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 {
 }
 
 /// The allocator for unique pointers.
-#[cfg(stage0)]
-#[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 {
-        allocate(size, 8)
-    }
-}
-
-/// The allocator for unique pointers.
-#[cfg(not(stage0))]
 #[inline]
 pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
     // The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
@@ -187,16 +162,7 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin
 #[no_mangle]
 #[doc(hidden)]
 #[deprecated]
-#[cfg(stage0, not(test))]
-pub unsafe extern "C" fn rust_malloc(size: uint) -> *mut u8 {
-    exchange_malloc(size)
-}
-
-// hack for libcore
-#[no_mangle]
-#[doc(hidden)]
-#[deprecated]
-#[cfg(not(stage0), not(test))]
+#[cfg(not(test))]
 pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 {
     exchange_malloc(size, align)
 }
diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs
index 3c0d0efa766..66471ee3923 100644
--- a/src/libstd/slice.rs
+++ b/src/libstd/slice.rs
@@ -291,54 +291,6 @@ pub trait CloneableVector<T> {
 impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
     /// Returns a copy of `v`.
     #[inline]
-    #[cfg(stage0)]
-    fn to_owned(&self) -> ~[T] {
-        use RawVec = core::raw::Vec;
-        use num::{CheckedAdd, CheckedMul};
-        use option::Expect;
-
-        let len = self.len();
-        let data_size = len.checked_mul(&mem::size_of::<T>());
-        let data_size = data_size.expect("overflow in to_owned()");
-        let size = mem::size_of::<RawVec<()>>().checked_add(&data_size);
-        let size = size.expect("overflow in to_owned()");
-
-        unsafe {
-            // this should pass the real required alignment
-            let ret = exchange_malloc(size) as *mut RawVec<()>;
-
-            (*ret).fill = len * mem::nonzero_size_of::<T>();
-            (*ret).alloc = len * mem::nonzero_size_of::<T>();
-
-            // Be careful with the following loop. We want it to be optimized
-            // to a memcpy (or something similarly fast) when T is Copy. LLVM
-            // is easily confused, so any extra operations during the loop can
-            // prevent this optimization.
-            let mut i = 0;
-            let p = &mut (*ret).data as *mut _ as *mut T;
-            try_finally(
-                &mut i, (),
-                |i, ()| while *i < len {
-                    mem::move_val_init(
-                        &mut(*p.offset(*i as int)),
-                        self.unsafe_ref(*i).clone());
-                    *i += 1;
-                },
-                |i| if *i < len {
-                    // we must be failing, clean up after ourselves
-                    for j in range(0, *i as int) {
-                        ptr::read(&*p.offset(j));
-                    }
-                    // FIXME: #13994 (should pass align and size here)
-                    deallocate(ret as *mut u8, 0, 8);
-                });
-            mem::transmute(ret)
-        }
-    }
-
-    /// Returns a copy of `v`.
-    #[inline]
-    #[cfg(not(stage0))]
     fn to_owned(&self) -> ~[T] {
         use RawVec = core::raw::Vec;
         use num::{CheckedAdd, CheckedMul};