Skip to content

Commit f85c4f6

Browse files
committed
std: Deprecate all permutation-related slice methods
These methods have been unstable for quite some time, and it's not clear that these should remain in the standard library.
1 parent cdb69e2 commit f85c4f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libcollections/slice.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ impl<T> [T] {
872872
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
873873
/// ```
874874
#[unstable(feature = "permutations")]
875+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
875876
#[inline]
876877
pub fn permutations(&self) -> Permutations<T> where T: Clone {
877878
// NB see hack module in this file
@@ -897,6 +898,7 @@ impl<T> [T] {
897898
/// ```
898899
#[unstable(feature = "permutations",
899900
reason = "uncertain if this merits inclusion in std")]
901+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
900902
pub fn next_permutation(&mut self) -> bool where T: Ord {
901903
core_slice::SliceExt::next_permutation(self)
902904
}
@@ -920,6 +922,7 @@ impl<T> [T] {
920922
/// ```
921923
#[unstable(feature = "permutations",
922924
reason = "uncertain if this merits inclusion in std")]
925+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
923926
pub fn prev_permutation(&mut self) -> bool where T: Ord {
924927
core_slice::SliceExt::prev_permutation(self)
925928
}
@@ -1066,6 +1069,7 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
10661069
/// sequence to its initial order.
10671070
#[unstable(feature = "permutations")]
10681071
#[derive(Clone)]
1072+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
10691073
pub struct ElementSwaps {
10701074
sdir: Vec<SizeDirection>,
10711075
/// If `true`, emit the last swap that returns the sequence to initial
@@ -1077,6 +1081,7 @@ pub struct ElementSwaps {
10771081
impl ElementSwaps {
10781082
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
10791083
#[unstable(feature = "permutations")]
1084+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
10801085
pub fn new(length: usize) -> ElementSwaps {
10811086
// Initialize `sdir` with a direction that position should move in
10821087
// (all negative at the beginning) and the `size` of the
@@ -1199,6 +1204,7 @@ impl Iterator for ElementSwaps {
11991204
///
12001205
/// Generates even and odd permutations alternately.
12011206
#[unstable(feature = "permutations")]
1207+
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
12021208
pub struct Permutations<T> {
12031209
swaps: ElementSwaps,
12041210
v: Vec<T>,

0 commit comments

Comments
 (0)