about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-21 09:14:39 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-21 09:14:39 -0800
commit9227db398aa6ec4a538fc2d5a9d4f53e9ae7b9da (patch)
tree0d7c55ee7a31fd538ecd591d6551fa43762d9583 /src/libcore
parentad2c3e8dbc53eee30bbbcfa1a0927f58d5ad8536 (diff)
parent00cddb068c4cb17a91cca646103e0fba8c0a8077 (diff)
rollup merge of #21392: japaric/iter
closes #20953
closes #21361

---

In the future, we will likely derive these `impl`s via syntax extensions or using compiler magic (see #20617). For the time being we can use these manual `impl`s.

r? @aturon
cc @burntsushi @Kroisse
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs14
-rw-r--r--src/libcore/lib.rs2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 0005db36c27..2a21ceef7a1 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -99,6 +99,20 @@ pub trait Iterator {
     fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
 }
 
+// FIXME(#21363) remove `old_impl_check` when bug is fixed
+#[old_impl_check]
+impl<'a, T> Iterator for &'a mut (Iterator<Item=T> + 'a) {
+    type Item = T;
+
+    fn next(&mut self) -> Option<T> {
+        (**self).next()
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (**self).size_hint()
+    }
+}
+
 /// Conversion from an `Iterator`
 #[stable]
 #[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 0b150d1ecf9..f7ba07fd2a6 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -63,6 +63,8 @@
 #![feature(unboxed_closures)]
 #![allow(unknown_features)] #![feature(int_uint)]
 #![feature(on_unimplemented)]
+// FIXME(#21363) remove `old_impl_check` when bug is fixed
+#![feature(old_impl_check)]
 #![deny(missing_docs)]
 
 #[macro_use]