about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-06-07 14:45:31 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-06-07 14:50:06 -0400
commit07e4d69baa5b1bd3d4cc4a6c9e17c90168d6f058 (patch)
tree3b1c0b1e7c7fe4f3ca5acd55c354845a5f38e41b
parentd945543ebf446913a44375169aa23686ffaa6205 (diff)
downloadrust-07e4d69baa5b1bd3d4cc4a6c9e17c90168d6f058.tar.gz
rust-07e4d69baa5b1bd3d4cc4a6c9e17c90168d6f058.zip
iterator: work around method resolve bug (#5898)
-rw-r--r--src/libstd/iterator.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index 4bc545f607d..4ed82f63b39 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -285,7 +285,8 @@ pub trait IteratorUtil<A> {
     /// let a = [1, 2, 3, 4, 5];
     /// assert!(a.iter().last().get() == &5);
     /// ~~~
-    fn last(&mut self) -> Option<A>;
+    // FIXME: #5898: should be called `last`
+    fn last_(&mut self) -> Option<A>;
 
     /// Performs a fold operation over the entire iterator, returning the
     /// eventual state at the end of the iteration.
@@ -437,7 +438,7 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
 
     /// Return the last item yielded by an iterator.
     #[inline(always)]
-    fn last(&mut self) -> Option<A> {
+    fn last_(&mut self) -> Option<A> {
         let mut last = None;
         for self.advance |x| { last = Some(x); }
         last
@@ -1025,8 +1026,8 @@ mod tests {
     #[test]
     fn test_iterator_last() {
         let v = &[0, 1, 2, 3, 4];
-        assert_eq!(v.iter().last().unwrap(), &4);
-        assert_eq!(v.slice(0, 1).iter().last().unwrap(), &0);
+        assert_eq!(v.iter().last_().unwrap(), &4);
+        assert_eq!(v.slice(0, 1).iter().last_().unwrap(), &0);
     }
 
     #[test]