]> git.lizzy.rs Git - rust.git/commitdiff
libcollections: Vec<T> + &[T]
authorJorge Aparicio <japaricious@gmail.com>
Mon, 1 Dec 2014 19:01:15 +0000 (14:01 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sun, 14 Dec 2014 01:15:39 +0000 (20:15 -0500)
src/libcollections/vec.rs

index 2ed8686394c01d4aeebe65edb10d2a8b328ae007..56cfa19e887ad8861f82cbe9da8c66c007a51ebb 100644 (file)
@@ -1273,6 +1273,8 @@ fn as_slice<'a>(&'a self) -> &'a [T] {
     }
 }
 
+// NOTE(stage0): Remove impl after a snapshot
+#[cfg(stage0)]
 impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
     #[inline]
     fn add(&self, rhs: &V) -> Vec<T> {
@@ -1283,6 +1285,16 @@ fn add(&self, rhs: &V) -> Vec<T> {
     }
 }
 
+
+#[cfg(not(stage0))]  // NOTE(stage0): Remove impl after a snapshot
+impl<'a, T: Clone> Add<&'a [T], Vec<T>> for Vec<T> {
+    #[inline]
+    fn add(mut self, rhs: &[T]) -> Vec<T> {
+        self.push_all(rhs);
+        self
+    }
+}
+
 #[unsafe_destructor]
 impl<T> Drop for Vec<T> {
     fn drop(&mut self) {