about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-03-03 14:13:01 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-03-03 17:02:22 +0530
commite9ca8acb0fbe0217e63f888da7ddc37e6a79b079 (patch)
treeae608a1f2385090f9b0fff2fae6ac58cf75c2785 /src/libcore
parent393ce1820e3f639b43d6058d2681b9757123ac1b (diff)
parent25ad3ba3cb0e6f2efd14ff5199d29542e125a667 (diff)
Rollup merge of #22951 - huonw:weak-chuck-slice, r=alexcrichton
 `#[derive(Clone)]` unnecessarily requires the element type to also be
`Clone`.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/slice.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 5b78da34edd..f99cfbaab5d 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -1167,13 +1167,23 @@ forward_iterator! { SplitNMut: T, &'a mut [T] }
 forward_iterator! { RSplitNMut: T, &'a mut [T] }
 
 /// An iterator over overlapping subslices of length `size`.
-#[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Windows<'a, T:'a> {
     v: &'a [T],
     size: usize
 }
 
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a, T> Clone for Windows<'a, T> {
+    fn clone(&self) -> Windows<'a, T> {
+        Windows {
+            v: self.v,
+            size: self.size,
+        }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Iterator for Windows<'a, T> {
     type Item = &'a [T];
@@ -1239,13 +1249,23 @@ impl<'a, T> RandomAccessIterator for Windows<'a, T> {
 ///
 /// When the slice len is not evenly divided by the chunk size, the last slice
 /// of the iteration will be the remainder.
-#[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Chunks<'a, T:'a> {
     v: &'a [T],
     size: usize
 }
 
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a, T> Clone for Chunks<'a, T> {
+    fn clone(&self) -> Chunks<'a, T> {
+        Chunks {
+            v: self.v,
+            size: self.size,
+        }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Iterator for Chunks<'a, T> {
     type Item = &'a [T];