about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-06-28 18:21:34 +0000
committerbors <bors@rust-lang.org>2014-06-28 18:21:34 +0000
commitde337f3ddfbef800a8cf731e0b593e341af1e3e5 (patch)
tree7f35eb443f0b58d81dc39f6d19da42bac4645d7e /src/libcore
parentb47f2226a25654c5b781d27a91f2fa5274b3a347 (diff)
parent05e3248a7974f55b64f75a2483b37ff8c001a4ff (diff)
downloadrust-de337f3ddfbef800a8cf731e0b593e341af1e3e5.tar.gz
rust-de337f3ddfbef800a8cf731e0b593e341af1e3e5.zip
auto merge of #15191 : pcwalton/rust/variance-in-trait-matching, r=huonw
I believe that #5781 got fixed by the DST work. It duplicated the
variance inference work in #12828. Therefore, all that is left in #5781
is adding a test.

Closes #5781.

r? @huonw
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 3f4d3020815..ec53ef93dc1 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -135,7 +135,8 @@ pub trait Iterator<A> {
     /// let a = [0i];
     /// let b = [1i];
     /// let mut it = a.iter().zip(b.iter());
-    /// assert_eq!(it.next().unwrap(), (&0, &1));
+    /// let (x0, x1) = (0i, 1i);
+    /// assert_eq!(it.next().unwrap(), (&x0, &x1));
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
@@ -202,8 +203,9 @@ pub trait Iterator<A> {
     /// ```rust
     /// let a = [100i, 200];
     /// let mut it = a.iter().enumerate();
-    /// assert_eq!(it.next().unwrap(), (0, &100));
-    /// assert_eq!(it.next().unwrap(), (1, &200));
+    /// let (x100, x200) = (100i, 200i);
+    /// assert_eq!(it.next().unwrap(), (0, &x100));
+    /// assert_eq!(it.next().unwrap(), (1, &x200));
     /// assert!(it.next().is_none());
     /// ```
     #[inline]
@@ -220,11 +222,11 @@ pub trait Iterator<A> {
     /// ```rust
     /// let xs = [100i, 200, 300];
     /// let mut it = xs.iter().map(|x| *x).peekable();
-    /// assert_eq!(it.peek().unwrap(), &100);
+    /// assert_eq!(*it.peek().unwrap(), 100);
     /// assert_eq!(it.next().unwrap(), 100);
     /// assert_eq!(it.next().unwrap(), 200);
-    /// assert_eq!(it.peek().unwrap(), &300);
-    /// assert_eq!(it.peek().unwrap(), &300);
+    /// assert_eq!(*it.peek().unwrap(), 300);
+    /// assert_eq!(*it.peek().unwrap(), 300);
     /// assert_eq!(it.next().unwrap(), 300);
     /// assert!(it.peek().is_none());
     /// assert!(it.next().is_none());