about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorXiang Fan <sfanxiang@gmail.com>2019-08-30 21:17:36 +0800
committerXiang Fan <sfanxiang@gmail.com>2019-08-30 21:17:36 +0800
commit0e597d4c479b4533e38016b1adbe565b44aab922 (patch)
tree64f6c60519cdd2707fa158eee5a9c1ecc7bfe3c4 /src/libcore/tests
parent19a38de68a8de14fe49e96b315db026bd57b9696 (diff)
Rev::rposition counts from the wrong end
Because of a compiler bug that adding `Self: ExactSizeIterator` makes
the compiler forget `Self::Item` is `<I as Iterator>::Item`, we remove
this specialization for now.
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/iter.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs
index 3a4f76852a0..8e0658d87c1 100644
--- a/src/libcore/tests/iter.rs
+++ b/src/libcore/tests/iter.rs
@@ -1689,6 +1689,12 @@ fn test_rposition() {
 }
 
 #[test]
+fn test_rev_rposition() {
+    let v = [0, 0, 1, 1];
+    assert_eq!(v.iter().rev().rposition(|&x| x == 1), Some(1));
+}
+
+#[test]
 #[should_panic]
 fn test_rposition_panic() {
     let v: [(Box<_>, Box<_>); 4] =