From 1c8d10bce503bdd66921005dbd0b86a31745e5a7 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 2 Apr 2018 16:33:09 -0700 Subject: [PATCH 1/3] Stabilize iter_rfold in 1.27.0 --- src/liballoc/lib.rs | 1 - src/libcore/iter/traits.rs | 4 +--- src/libcore/tests/lib.rs | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index e6a311041f544..cbdb135c78c1c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -100,7 +100,6 @@ #![feature(fundamental)] #![feature(generic_param_attrs)] #![cfg_attr(stage0, feature(i128_type))] -#![feature(iter_rfold)] #![feature(lang_items)] #![feature(needs_allocator)] #![feature(nonzero)] diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index c3aebc4fb23ce..f84dc98912f62 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -491,7 +491,6 @@ pub trait DoubleEndedIterator: Iterator { /// Basic usage: /// /// ``` - /// #![feature(iter_rfold)] /// let a = [1, 2, 3]; /// /// // the sum of all of the elements of a @@ -505,7 +504,6 @@ pub trait DoubleEndedIterator: Iterator { /// and continuing with each element from the back until the front: /// /// ``` - /// #![feature(iter_rfold)] /// let numbers = [1, 2, 3, 4, 5]; /// /// let zero = "0".to_string(); @@ -517,7 +515,7 @@ pub trait DoubleEndedIterator: Iterator { /// assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))"); /// ``` #[inline] - #[unstable(feature = "iter_rfold", issue = "44705")] + #[stable(feature = "iter_rfold", since = "1.27.0")] fn rfold(mut self, accum: B, mut f: F) -> B where Self: Sized, F: FnMut(B, Self::Item) -> B, { diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 1a68f04532d20..e04968a635993 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -29,7 +29,6 @@ #![feature(iterator_flatten)] #![cfg_attr(stage0, feature(conservative_impl_trait))] #![feature(iter_rfind)] -#![feature(iter_rfold)] #![feature(iterator_repeat_with)] #![feature(nonzero)] #![feature(pattern)] From d8c4c83dadb3a8d539bf0f4ad8260bc87420ca37 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 2 Apr 2018 16:37:06 -0700 Subject: [PATCH 2/3] Stabilize iter_rfind in 1.27.0 --- src/libcore/iter/traits.rs | 8 ++------ src/libcore/tests/lib.rs | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index f84dc98912f62..ee278651c8d12 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -522,7 +522,7 @@ pub trait DoubleEndedIterator: Iterator { self.try_rfold(accum, move |acc, x| AlwaysOk(f(acc, x))).0 } - /// Searches for an element of an iterator from the right that satisfies a predicate. + /// Searches for an element of an iterator from the back that satisfies a predicate. /// /// `rfind()` takes a closure that returns `true` or `false`. It applies /// this closure to each element of the iterator, starting at the end, and if any @@ -545,8 +545,6 @@ pub trait DoubleEndedIterator: Iterator { /// Basic usage: /// /// ``` - /// #![feature(iter_rfind)] - /// /// let a = [1, 2, 3]; /// /// assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2)); @@ -557,8 +555,6 @@ pub trait DoubleEndedIterator: Iterator { /// Stopping at the first `true`: /// /// ``` - /// #![feature(iter_rfind)] - /// /// let a = [1, 2, 3]; /// /// let mut iter = a.iter(); @@ -569,7 +565,7 @@ pub trait DoubleEndedIterator: Iterator { /// assert_eq!(iter.next_back(), Some(&1)); /// ``` #[inline] - #[unstable(feature = "iter_rfind", issue = "39480")] + #[stable(feature = "iter_rfind", since = "1.27.0")] fn rfind

(&mut self, mut predicate: P) -> Option where Self: Sized, P: FnMut(&Self::Item) -> bool diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index e04968a635993..8a34660d556bf 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -28,7 +28,6 @@ #![feature(iterator_try_fold)] #![feature(iterator_flatten)] #![cfg_attr(stage0, feature(conservative_impl_trait))] -#![feature(iter_rfind)] #![feature(iterator_repeat_with)] #![feature(nonzero)] #![feature(pattern)] From 9db63bb033271c7b9c9f4315eb6db3314758a33e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 2 Apr 2018 16:40:53 -0700 Subject: [PATCH 3/3] Stabilize iterator_try_fold in 1.27.0 --- src/libcore/iter/iterator.rs | 7 ++----- src/libcore/iter/traits.rs | 4 +--- src/libcore/tests/lib.rs | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 31f77f92435d8..a54e0e0065565 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -1446,7 +1446,6 @@ pub trait Iterator { /// Basic usage: /// /// ``` - /// #![feature(iterator_try_fold)] /// let a = [1, 2, 3]; /// /// // the checked sum of all of the elements of the array @@ -1458,7 +1457,6 @@ pub trait Iterator { /// Short-circuiting: /// /// ``` - /// #![feature(iterator_try_fold)] /// let a = [10, 20, 30, 100, 40, 50]; /// let mut it = a.iter(); /// @@ -1472,7 +1470,7 @@ pub trait Iterator { /// assert_eq!(it.next(), Some(&40)); /// ``` #[inline] - #[unstable(feature = "iterator_try_fold", issue = "45594")] + #[stable(feature = "iterator_try_fold", since = "1.27.0")] fn try_fold(&mut self, init: B, mut f: F) -> R where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { @@ -1495,7 +1493,6 @@ pub trait Iterator { /// # Examples /// /// ``` - /// #![feature(iterator_try_fold)] /// use std::fs::rename; /// use std::io::{stdout, Write}; /// use std::path::Path; @@ -1512,7 +1509,7 @@ pub trait Iterator { /// assert_eq!(it.next(), Some("stale_bread.json")); /// ``` #[inline] - #[unstable(feature = "iterator_try_fold", issue = "45594")] + #[stable(feature = "iterator_try_fold", since = "1.27.0")] fn try_for_each(&mut self, mut f: F) -> R where Self: Sized, F: FnMut(Self::Item) -> R, R: Try { diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index ee278651c8d12..ddbb59989424f 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -427,7 +427,6 @@ pub trait DoubleEndedIterator: Iterator { /// Basic usage: /// /// ``` - /// #![feature(iterator_try_fold)] /// let a = ["1", "2", "3"]; /// let sum = a.iter() /// .map(|&s| s.parse::()) @@ -438,7 +437,6 @@ pub trait DoubleEndedIterator: Iterator { /// Short-circuiting: /// /// ``` - /// #![feature(iterator_try_fold)] /// let a = ["1", "rust", "3"]; /// let mut it = a.iter(); /// let sum = it @@ -452,7 +450,7 @@ pub trait DoubleEndedIterator: Iterator { /// assert_eq!(it.next_back(), Some(&"1")); /// ``` #[inline] - #[unstable(feature = "iterator_try_fold", issue = "45594")] + #[stable(feature = "iterator_try_fold", since = "1.27.0")] fn try_rfold(&mut self, init: B, mut f: F) -> R where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 8a34660d556bf..16150cd82beb1 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -25,7 +25,6 @@ #![feature(iterator_step_by)] #![cfg_attr(stage0, feature(i128_type))] #![cfg_attr(stage0, feature(inclusive_range_syntax))] -#![feature(iterator_try_fold)] #![feature(iterator_flatten)] #![cfg_attr(stage0, feature(conservative_impl_trait))] #![feature(iterator_repeat_with)]