Skip to content

Commit be226e4

Browse files
committed
Stabilize split_inclusive
Closes #72360. Signed-off-by: Ian Jackson <[email protected]>
1 parent ab5b9ae commit be226e4

File tree

5 files changed

+22
-32
lines changed

5 files changed

+22
-32
lines changed

library/alloc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(binary_heap_into_iter_sorted)]
1515
#![feature(binary_heap_drain_sorted)]
1616
#![feature(slice_ptr_get)]
17-
#![feature(split_inclusive)]
1817
#![feature(binary_heap_retain)]
1918
#![feature(inplace_iteration)]
2019
#![feature(iter_map_while)]

library/core/src/slice/iter.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,13 @@ impl<T, P> FusedIterator for Split<'_, T, P> where P: FnMut(&T) -> bool {}
446446
/// # Example
447447
///
448448
/// ```
449-
/// #![feature(split_inclusive)]
450-
///
451449
/// let slice = [10, 40, 33, 20];
452450
/// let mut iter = slice.split_inclusive(|num| num % 3 == 0);
453451
/// ```
454452
///
455453
/// [`split_inclusive`]: ../../std/primitive.slice.html#method.split_inclusive
456454
/// [slices]: ../../std/primitive.slice.html
457-
#[unstable(feature = "split_inclusive", issue = "72360")]
455+
#[stable(feature = "split_inclusive", since = "1.49.0")]
458456
pub struct SplitInclusive<'a, T: 'a, P>
459457
where
460458
P: FnMut(&T) -> bool,
@@ -471,7 +469,7 @@ impl<'a, T: 'a, P: FnMut(&T) -> bool> SplitInclusive<'a, T, P> {
471469
}
472470
}
473471

474-
#[unstable(feature = "split_inclusive", issue = "72360")]
472+
#[stable(feature = "split_inclusive", since = "1.49.0")]
475473
impl<T: fmt::Debug, P> fmt::Debug for SplitInclusive<'_, T, P>
476474
where
477475
P: FnMut(&T) -> bool,
@@ -485,7 +483,7 @@ where
485483
}
486484

487485
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
488-
#[unstable(feature = "split_inclusive", issue = "72360")]
486+
#[stable(feature = "split_inclusive", since = "1.49.0")]
489487
impl<T, P> Clone for SplitInclusive<'_, T, P>
490488
where
491489
P: Clone + FnMut(&T) -> bool,
@@ -495,7 +493,7 @@ where
495493
}
496494
}
497495

498-
#[unstable(feature = "split_inclusive", issue = "72360")]
496+
#[stable(feature = "split_inclusive", since = "1.49.0")]
499497
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>
500498
where
501499
P: FnMut(&T) -> bool,
@@ -524,7 +522,7 @@ where
524522
}
525523
}
526524

527-
#[unstable(feature = "split_inclusive", issue = "72360")]
525+
#[stable(feature = "split_inclusive", since = "1.49.0")]
528526
impl<'a, T, P> DoubleEndedIterator for SplitInclusive<'a, T, P>
529527
where
530528
P: FnMut(&T) -> bool,
@@ -549,7 +547,7 @@ where
549547
}
550548
}
551549

552-
#[unstable(feature = "split_inclusive", issue = "72360")]
550+
#[stable(feature = "split_inclusive", since = "1.49.0")]
553551
impl<T, P> FusedIterator for SplitInclusive<'_, T, P> where P: FnMut(&T) -> bool {}
554552

555553
/// An iterator over the mutable subslices of the vector which are separated
@@ -689,15 +687,13 @@ impl<T, P> FusedIterator for SplitMut<'_, T, P> where P: FnMut(&T) -> bool {}
689687
/// # Example
690688
///
691689
/// ```
692-
/// #![feature(split_inclusive)]
693-
///
694690
/// let mut v = [10, 40, 30, 20, 60, 50];
695691
/// let iter = v.split_inclusive_mut(|num| *num % 3 == 0);
696692
/// ```
697693
///
698694
/// [`split_inclusive_mut`]: ../../std/primitive.slice.html#method.split_inclusive_mut
699695
/// [slices]: ../../std/primitive.slice.html
700-
#[unstable(feature = "split_inclusive", issue = "72360")]
696+
#[stable(feature = "split_inclusive", since = "1.49.0")]
701697
pub struct SplitInclusiveMut<'a, T: 'a, P>
702698
where
703699
P: FnMut(&T) -> bool,
@@ -714,7 +710,7 @@ impl<'a, T: 'a, P: FnMut(&T) -> bool> SplitInclusiveMut<'a, T, P> {
714710
}
715711
}
716712

717-
#[unstable(feature = "split_inclusive", issue = "72360")]
713+
#[stable(feature = "split_inclusive", since = "1.49.0")]
718714
impl<T: fmt::Debug, P> fmt::Debug for SplitInclusiveMut<'_, T, P>
719715
where
720716
P: FnMut(&T) -> bool,
@@ -727,7 +723,7 @@ where
727723
}
728724
}
729725

730-
#[unstable(feature = "split_inclusive", issue = "72360")]
726+
#[stable(feature = "split_inclusive", since = "1.49.0")]
731727
impl<'a, T, P> Iterator for SplitInclusiveMut<'a, T, P>
732728
where
733729
P: FnMut(&T) -> bool,
@@ -767,7 +763,7 @@ where
767763
}
768764
}
769765

770-
#[unstable(feature = "split_inclusive", issue = "72360")]
766+
#[stable(feature = "split_inclusive", since = "1.49.0")]
771767
impl<'a, T, P> DoubleEndedIterator for SplitInclusiveMut<'a, T, P>
772768
where
773769
P: FnMut(&T) -> bool,
@@ -801,7 +797,7 @@ where
801797
}
802798
}
803799

804-
#[unstable(feature = "split_inclusive", issue = "72360")]
800+
#[stable(feature = "split_inclusive", since = "1.49.0")]
805801
impl<T, P> FusedIterator for SplitInclusiveMut<'_, T, P> where P: FnMut(&T) -> bool {}
806802

807803
/// An iterator over subslices separated by elements that match a predicate

library/core/src/slice/mod.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub use iter::ArrayWindows;
6060
#[unstable(feature = "slice_group_by", issue = "80552")]
6161
pub use iter::{GroupBy, GroupByMut};
6262

63-
#[unstable(feature = "split_inclusive", issue = "72360")]
63+
#[stable(feature = "split_inclusive", since = "1.49.0")]
6464
pub use iter::{SplitInclusive, SplitInclusiveMut};
6565

6666
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1549,7 +1549,6 @@ impl<T> [T] {
15491549
/// # Examples
15501550
///
15511551
/// ```
1552-
/// #![feature(split_inclusive)]
15531552
/// let slice = [10, 40, 33, 20];
15541553
/// let mut iter = slice.split_inclusive(|num| num % 3 == 0);
15551554
///
@@ -1563,15 +1562,14 @@ impl<T> [T] {
15631562
/// That slice will be the last item returned by the iterator.
15641563
///
15651564
/// ```
1566-
/// #![feature(split_inclusive)]
15671565
/// let slice = [3, 10, 40, 33];
15681566
/// let mut iter = slice.split_inclusive(|num| num % 3 == 0);
15691567
///
15701568
/// assert_eq!(iter.next().unwrap(), &[3]);
15711569
/// assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
15721570
/// assert!(iter.next().is_none());
15731571
/// ```
1574-
#[unstable(feature = "split_inclusive", issue = "72360")]
1572+
#[stable(feature = "split_inclusive", since = "1.49.0")]
15751573
#[inline]
15761574
pub fn split_inclusive<F>(&self, pred: F) -> SplitInclusive<'_, T, F>
15771575
where
@@ -1587,7 +1585,6 @@ impl<T> [T] {
15871585
/// # Examples
15881586
///
15891587
/// ```
1590-
/// #![feature(split_inclusive)]
15911588
/// let mut v = [10, 40, 30, 20, 60, 50];
15921589
///
15931590
/// for group in v.split_inclusive_mut(|num| *num % 3 == 0) {
@@ -1596,7 +1593,7 @@ impl<T> [T] {
15961593
/// }
15971594
/// assert_eq!(v, [10, 40, 1, 20, 1, 1]);
15981595
/// ```
1599-
#[unstable(feature = "split_inclusive", issue = "72360")]
1596+
#[stable(feature = "split_inclusive", since = "1.49.0")]
16001597
#[inline]
16011598
pub fn split_inclusive_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>
16021599
where

library/core/src/str/iter.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ pub struct SplitAsciiWhitespace<'a> {
11741174
/// See its documentation for more.
11751175
///
11761176
/// [`split_inclusive`]: str::split_inclusive
1177-
#[unstable(feature = "split_inclusive", issue = "72360")]
1177+
#[stable(feature = "split_inclusive", since = "1.49.0")]
11781178
pub struct SplitInclusive<'a, P: Pattern<'a>>(pub(super) SplitInternal<'a, P>);
11791179

11801180
#[stable(feature = "split_whitespace", since = "1.1.0")]
@@ -1239,7 +1239,7 @@ impl<'a> DoubleEndedIterator for SplitAsciiWhitespace<'a> {
12391239
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
12401240
impl FusedIterator for SplitAsciiWhitespace<'_> {}
12411241

1242-
#[unstable(feature = "split_inclusive", issue = "72360")]
1242+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12431243
impl<'a, P: Pattern<'a>> Iterator for SplitInclusive<'a, P> {
12441244
type Item = &'a str;
12451245

@@ -1249,22 +1249,22 @@ impl<'a, P: Pattern<'a>> Iterator for SplitInclusive<'a, P> {
12491249
}
12501250
}
12511251

1252-
#[unstable(feature = "split_inclusive", issue = "72360")]
1252+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12531253
impl<'a, P: Pattern<'a, Searcher: fmt::Debug>> fmt::Debug for SplitInclusive<'a, P> {
12541254
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12551255
f.debug_struct("SplitInclusive").field("0", &self.0).finish()
12561256
}
12571257
}
12581258

12591259
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
1260-
#[unstable(feature = "split_inclusive", issue = "72360")]
1260+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12611261
impl<'a, P: Pattern<'a, Searcher: Clone>> Clone for SplitInclusive<'a, P> {
12621262
fn clone(&self) -> Self {
12631263
SplitInclusive(self.0.clone())
12641264
}
12651265
}
12661266

1267-
#[unstable(feature = "split_inclusive", issue = "72360")]
1267+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12681268
impl<'a, P: Pattern<'a, Searcher: ReverseSearcher<'a>>> DoubleEndedIterator
12691269
for SplitInclusive<'a, P>
12701270
{
@@ -1274,7 +1274,7 @@ impl<'a, P: Pattern<'a, Searcher: ReverseSearcher<'a>>> DoubleEndedIterator
12741274
}
12751275
}
12761276

1277-
#[unstable(feature = "split_inclusive", issue = "72360")]
1277+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12781278
impl<'a, P: Pattern<'a>> FusedIterator for SplitInclusive<'a, P> {}
12791279

12801280
impl<'a, P: Pattern<'a>> SplitInclusive<'a, P> {

library/core/src/str/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub use iter::{EscapeDebug, EscapeDefault, EscapeUnicode};
6565
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
6666
pub use iter::SplitAsciiWhitespace;
6767

68-
#[unstable(feature = "split_inclusive", issue = "72360")]
68+
#[stable(feature = "split_inclusive", since = "1.49.0")]
6969
use iter::SplitInclusive;
7070

7171
#[unstable(feature = "str_internals", issue = "none")]
@@ -1227,7 +1227,6 @@ impl str {
12271227
/// # Examples
12281228
///
12291229
/// ```
1230-
/// #![feature(split_inclusive)]
12311230
/// let v: Vec<&str> = "Mary had a little lamb\nlittle lamb\nlittle lamb."
12321231
/// .split_inclusive('\n').collect();
12331232
/// assert_eq!(v, ["Mary had a little lamb\n", "little lamb\n", "little lamb."]);
@@ -1238,12 +1237,11 @@ impl str {
12381237
/// That substring will be the last item returned by the iterator.
12391238
///
12401239
/// ```
1241-
/// #![feature(split_inclusive)]
12421240
/// let v: Vec<&str> = "Mary had a little lamb\nlittle lamb\nlittle lamb.\n"
12431241
/// .split_inclusive('\n').collect();
12441242
/// assert_eq!(v, ["Mary had a little lamb\n", "little lamb\n", "little lamb.\n"]);
12451243
/// ```
1246-
#[unstable(feature = "split_inclusive", issue = "72360")]
1244+
#[stable(feature = "split_inclusive", since = "1.49.0")]
12471245
#[inline]
12481246
pub fn split_inclusive<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitInclusive<'a, P> {
12491247
SplitInclusive(SplitInternal {

0 commit comments

Comments
 (0)