about summary refs log tree commit diff
path: root/src/libstd/slice.rs
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2014-05-07 21:53:11 -0700
committerKevin Ballard <kevin@sb.org>2014-05-08 12:08:01 -0700
commit9fb8741b2ec6cf44256b7241123fcb81a4b21a68 (patch)
tree3d156d330710162c23b7e02924746daf2c2efc97 /src/libstd/slice.rs
parent300d865fa4642f0a76b2676539efa3155ceaeddf (diff)
downloadrust-9fb8741b2ec6cf44256b7241123fcb81a4b21a68.tar.gz
rust-9fb8741b2ec6cf44256b7241123fcb81a4b21a68.zip
Handle breakage after libcore split
API Changes:

- &[T] and ~[T] no longer support the addition operator (+)
Diffstat (limited to 'src/libstd/slice.rs')
-rw-r--r--src/libstd/slice.rs34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs
index f769ce5b319..2650c39bdb8 100644
--- a/src/libstd/slice.rs
+++ b/src/libstd/slice.rs
@@ -279,26 +279,6 @@ impl<T: Clone> Iterator<~[T]> for Permutations<T> {
     }
 }
 
-#[cfg(not(test))]
-impl<'a,T:Clone, V: Vector<T>> Add<V, Vec<T>> for &'a [T] {
-    #[inline]
-    fn add(&self, rhs: &V) -> Vec<T> {
-        let rhs = rhs.as_slice();
-        let mut res = Vec::with_capacity(self.len() + rhs.len());
-        res.push_all(*self);
-        res.push_all(rhs);
-        res
-    }
-}
-
-#[cfg(not(test))]
-impl<T:Clone, V: Vector<T>> Add<V, Vec<T>> for ~[T] {
-    #[inline]
-    fn add(&self, rhs: &V) -> Vec<T> {
-        self.as_slice() + rhs.as_slice()
-    }
-}
-
 /// Extension methods for vector slices with cloneable elements
 pub trait CloneableVector<T> {
     /// Copy `self` into a new owned vector
@@ -313,6 +293,11 @@ impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
     /// Returns a copy of `v`.
     #[inline]
     fn to_owned(&self) -> ~[T] {
+        use RawVec = core::raw::Vec;
+        use rt::global_heap::{malloc_raw, exchange_free};
+        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()");
@@ -2143,15 +2128,6 @@ mod bench {
     }
 
     #[bench]
-    fn add(b: &mut Bencher) {
-        let xs: &[int] = [5, ..10];
-        let ys: &[int] = [5, ..10];
-        b.iter(|| {
-            xs + ys;
-        });
-    }
-
-    #[bench]
     fn concat(b: &mut Bencher) {
         let xss: Vec<Vec<uint>> = Vec::from_fn(100, |i| range(0, i).collect());
         b.iter(|| {