Skip to content

Commit 52cc6fd

Browse files
committed
Stabilize slice::rchunks(), rchunks_mut(), rchunks_exact(), rchunk_exact_mut()
Fixes #55177
1 parent b08ca29 commit 52cc6fd

File tree

5 files changed

+33
-44
lines changed

5 files changed

+33
-44
lines changed

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
#![feature(const_vec_new)]
120120
#![feature(slice_partition_dedup)]
121121
#![feature(maybe_uninit)]
122-
#![feature(rchunks)]
123122

124123
// Allow testing this library
125124

src/liballoc/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub use core::slice::{from_ref, from_mut};
125125
pub use core::slice::SliceIndex;
126126
#[stable(feature = "chunks_exact", since = "1.31.0")]
127127
pub use core::slice::{ChunksExact, ChunksExactMut};
128-
#[unstable(feature = "rchunks", issue = "55177")]
128+
#[stable(feature = "rchunks", since = "1.31.0")]
129129
pub use core::slice::{RChunks, RChunksMut, RChunksExact, RChunksExactMut};
130130

131131
////////////////////////////////////////////////////////////////////////////////

src/liballoc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(str_escape)]
2020
#![feature(try_reserve)]
2121
#![feature(unboxed_closures)]
22-
#![feature(rchunks)]
2322
#![feature(repeat_generic_slice)]
2423

2524
extern crate alloc_system;

src/libcore/slice/mod.rs

+32-40
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,6 @@ impl<T> [T] {
795795
/// # Examples
796796
///
797797
/// ```
798-
/// #![feature(rchunks)]
799-
///
800798
/// let slice = ['l', 'o', 'r', 'e', 'm'];
801799
/// let mut iter = slice.rchunks(2);
802800
/// assert_eq!(iter.next().unwrap(), &['e', 'm']);
@@ -807,7 +805,7 @@ impl<T> [T] {
807805
///
808806
/// [`rchunks_exact`]: #method.rchunks_exact
809807
/// [`chunks`]: #method.chunks
810-
#[unstable(feature = "rchunks", issue = "55177")]
808+
#[stable(feature = "rchunks", since = "1.31.0")]
811809
#[inline]
812810
pub fn rchunks(&self, chunk_size: usize) -> RChunks<T> {
813811
assert!(chunk_size != 0);
@@ -831,8 +829,6 @@ impl<T> [T] {
831829
/// # Examples
832830
///
833831
/// ```
834-
/// #![feature(rchunks)]
835-
///
836832
/// let v = &mut [0, 0, 0, 0, 0];
837833
/// let mut count = 1;
838834
///
@@ -847,7 +843,7 @@ impl<T> [T] {
847843
///
848844
/// [`rchunks_exact_mut`]: #method.rchunks_exact_mut
849845
/// [`chunks_mut`]: #method.chunks_mut
850-
#[unstable(feature = "rchunks", issue = "55177")]
846+
#[stable(feature = "rchunks", since = "1.31.0")]
851847
#[inline]
852848
pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<T> {
853849
assert!(chunk_size != 0);
@@ -875,8 +871,6 @@ impl<T> [T] {
875871
/// # Examples
876872
///
877873
/// ```
878-
/// #![feature(rchunks)]
879-
///
880874
/// let slice = ['l', 'o', 'r', 'e', 'm'];
881875
/// let mut iter = slice.rchunks_exact(2);
882876
/// assert_eq!(iter.next().unwrap(), &['e', 'm']);
@@ -887,7 +881,7 @@ impl<T> [T] {
887881
///
888882
/// [`rchunks`]: #method.rchunks
889883
/// [`chunks_exact`]: #method.chunks_exact
890-
#[unstable(feature = "rchunks", issue = "55177")]
884+
#[stable(feature = "rchunks", since = "1.31.0")]
891885
#[inline]
892886
pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<T> {
893887
assert!(chunk_size != 0);
@@ -917,8 +911,6 @@ impl<T> [T] {
917911
/// # Examples
918912
///
919913
/// ```
920-
/// #![feature(rchunks)]
921-
///
922914
/// let v = &mut [0, 0, 0, 0, 0];
923915
/// let mut count = 1;
924916
///
@@ -933,7 +925,7 @@ impl<T> [T] {
933925
///
934926
/// [`rchunks_mut`]: #method.rchunks_mut
935927
/// [`chunks_exact_mut`]: #method.chunks_exact_mut
936-
#[unstable(feature = "rchunks", issue = "55177")]
928+
#[stable(feature = "rchunks", since = "1.31.0")]
937929
#[inline]
938930
pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<T> {
939931
assert!(chunk_size != 0);
@@ -4256,14 +4248,14 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> {
42564248
/// [`rchunks`]: ../../std/primitive.slice.html#method.rchunks
42574249
/// [slices]: ../../std/primitive.slice.html
42584250
#[derive(Debug)]
4259-
#[unstable(feature = "rchunks", issue = "55177")]
4251+
#[stable(feature = "rchunks", since = "1.31.0")]
42604252
pub struct RChunks<'a, T:'a> {
42614253
v: &'a [T],
42624254
chunk_size: usize
42634255
}
42644256

42654257
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
4266-
#[unstable(feature = "rchunks", issue = "55177")]
4258+
#[stable(feature = "rchunks", since = "1.31.0")]
42674259
impl<'a, T> Clone for RChunks<'a, T> {
42684260
fn clone(&self) -> RChunks<'a, T> {
42694261
RChunks {
@@ -4273,7 +4265,7 @@ impl<'a, T> Clone for RChunks<'a, T> {
42734265
}
42744266
}
42754267

4276-
#[unstable(feature = "rchunks", issue = "55177")]
4268+
#[stable(feature = "rchunks", since = "1.31.0")]
42774269
impl<'a, T> Iterator for RChunks<'a, T> {
42784270
type Item = &'a [T];
42794271

@@ -4337,7 +4329,7 @@ impl<'a, T> Iterator for RChunks<'a, T> {
43374329
}
43384330
}
43394331

4340-
#[unstable(feature = "rchunks", issue = "55177")]
4332+
#[stable(feature = "rchunks", since = "1.31.0")]
43414333
impl<'a, T> DoubleEndedIterator for RChunks<'a, T> {
43424334
#[inline]
43434335
fn next_back(&mut self) -> Option<&'a [T]> {
@@ -4353,17 +4345,17 @@ impl<'a, T> DoubleEndedIterator for RChunks<'a, T> {
43534345
}
43544346
}
43554347

4356-
#[unstable(feature = "rchunks", issue = "55177")]
4348+
#[stable(feature = "rchunks", since = "1.31.0")]
43574349
impl<'a, T> ExactSizeIterator for RChunks<'a, T> {}
43584350

43594351
#[unstable(feature = "trusted_len", issue = "37572")]
43604352
unsafe impl<'a, T> TrustedLen for RChunks<'a, T> {}
43614353

4362-
#[unstable(feature = "rchunks", issue = "55177")]
4354+
#[stable(feature = "rchunks", since = "1.31.0")]
43634355
impl<'a, T> FusedIterator for RChunks<'a, T> {}
43644356

43654357
#[doc(hidden)]
4366-
#[unstable(feature = "rchunks", issue = "55177")]
4358+
#[stable(feature = "rchunks", since = "1.31.0")]
43674359
unsafe impl<'a, T> TrustedRandomAccess for RChunks<'a, T> {
43684360
unsafe fn get_unchecked(&mut self, i: usize) -> &'a [T] {
43694361
let end = self.v.len() - i * self.chunk_size;
@@ -4387,13 +4379,13 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunks<'a, T> {
43874379
/// [`rchunks_mut`]: ../../std/primitive.slice.html#method.rchunks_mut
43884380
/// [slices]: ../../std/primitive.slice.html
43894381
#[derive(Debug)]
4390-
#[unstable(feature = "rchunks", issue = "55177")]
4382+
#[stable(feature = "rchunks", since = "1.31.0")]
43914383
pub struct RChunksMut<'a, T:'a> {
43924384
v: &'a mut [T],
43934385
chunk_size: usize
43944386
}
43954387

4396-
#[unstable(feature = "rchunks", issue = "55177")]
4388+
#[stable(feature = "rchunks", since = "1.31.0")]
43974389
impl<'a, T> Iterator for RChunksMut<'a, T> {
43984390
type Item = &'a mut [T];
43994391

@@ -4461,7 +4453,7 @@ impl<'a, T> Iterator for RChunksMut<'a, T> {
44614453
}
44624454
}
44634455

4464-
#[unstable(feature = "rchunks", issue = "55177")]
4456+
#[stable(feature = "rchunks", since = "1.31.0")]
44654457
impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T> {
44664458
#[inline]
44674459
fn next_back(&mut self) -> Option<&'a mut [T]> {
@@ -4478,17 +4470,17 @@ impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T> {
44784470
}
44794471
}
44804472

4481-
#[unstable(feature = "rchunks", issue = "55177")]
4473+
#[stable(feature = "rchunks", since = "1.31.0")]
44824474
impl<'a, T> ExactSizeIterator for RChunksMut<'a, T> {}
44834475

44844476
#[unstable(feature = "trusted_len", issue = "37572")]
44854477
unsafe impl<'a, T> TrustedLen for RChunksMut<'a, T> {}
44864478

4487-
#[unstable(feature = "rchunks", issue = "55177")]
4479+
#[stable(feature = "rchunks", since = "1.31.0")]
44884480
impl<'a, T> FusedIterator for RChunksMut<'a, T> {}
44894481

44904482
#[doc(hidden)]
4491-
#[unstable(feature = "rchunks", issue = "55177")]
4483+
#[stable(feature = "rchunks", since = "1.31.0")]
44924484
unsafe impl<'a, T> TrustedRandomAccess for RChunksMut<'a, T> {
44934485
unsafe fn get_unchecked(&mut self, i: usize) -> &'a mut [T] {
44944486
let end = self.v.len() - i * self.chunk_size;
@@ -4514,25 +4506,25 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksMut<'a, T> {
45144506
/// [`remainder`]: ../../std/slice/struct.ChunksExact.html#method.remainder
45154507
/// [slices]: ../../std/primitive.slice.html
45164508
#[derive(Debug)]
4517-
#[unstable(feature = "rchunks", issue = "55177")]
4509+
#[stable(feature = "rchunks", since = "1.31.0")]
45184510
pub struct RChunksExact<'a, T:'a> {
45194511
v: &'a [T],
45204512
rem: &'a [T],
45214513
chunk_size: usize
45224514
}
45234515

4524-
#[unstable(feature = "rchunks", issue = "55177")]
45254516
impl<'a, T> RChunksExact<'a, T> {
45264517
/// Return the remainder of the original slice that is not going to be
45274518
/// returned by the iterator. The returned slice has at most `chunk_size-1`
45284519
/// elements.
4520+
#[stable(feature = "rchunks", since = "1.31.0")]
45294521
pub fn remainder(&self) -> &'a [T] {
45304522
self.rem
45314523
}
45324524
}
45334525

45344526
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
4535-
#[unstable(feature = "rchunks", issue = "55177")]
4527+
#[stable(feature = "rchunks", since = "1.31.0")]
45364528
impl<'a, T> Clone for RChunksExact<'a, T> {
45374529
fn clone(&self) -> RChunksExact<'a, T> {
45384530
RChunksExact {
@@ -4543,7 +4535,7 @@ impl<'a, T> Clone for RChunksExact<'a, T> {
45434535
}
45444536
}
45454537

4546-
#[unstable(feature = "rchunks", issue = "55177")]
4538+
#[stable(feature = "rchunks", since = "1.31.0")]
45474539
impl<'a, T> Iterator for RChunksExact<'a, T> {
45484540
type Item = &'a [T];
45494541

@@ -4588,7 +4580,7 @@ impl<'a, T> Iterator for RChunksExact<'a, T> {
45884580
}
45894581
}
45904582

4591-
#[unstable(feature = "rchunks", issue = "55177")]
4583+
#[stable(feature = "rchunks", since = "1.31.0")]
45924584
impl<'a, T> DoubleEndedIterator for RChunksExact<'a, T> {
45934585
#[inline]
45944586
fn next_back(&mut self) -> Option<&'a [T]> {
@@ -4602,7 +4594,7 @@ impl<'a, T> DoubleEndedIterator for RChunksExact<'a, T> {
46024594
}
46034595
}
46044596

4605-
#[unstable(feature = "rchunks", issue = "55177")]
4597+
#[stable(feature = "rchunks", since = "1.31.0")]
46064598
impl<'a, T> ExactSizeIterator for RChunksExact<'a, T> {
46074599
fn is_empty(&self) -> bool {
46084600
self.v.is_empty()
@@ -4612,11 +4604,11 @@ impl<'a, T> ExactSizeIterator for RChunksExact<'a, T> {
46124604
#[unstable(feature = "trusted_len", issue = "37572")]
46134605
unsafe impl<'a, T> TrustedLen for RChunksExact<'a, T> {}
46144606

4615-
#[unstable(feature = "rchunks", issue = "55177")]
4607+
#[stable(feature = "rchunks", since = "1.31.0")]
46164608
impl<'a, T> FusedIterator for RChunksExact<'a, T> {}
46174609

46184610
#[doc(hidden)]
4619-
#[unstable(feature = "rchunks", issue = "55177")]
4611+
#[stable(feature = "rchunks", since = "1.31.0")]
46204612
unsafe impl<'a, T> TrustedRandomAccess for RChunksExact<'a, T> {
46214613
unsafe fn get_unchecked(&mut self, i: usize) -> &'a [T] {
46224614
let end = self.v.len() - i * self.chunk_size;
@@ -4639,24 +4631,24 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExact<'a, T> {
46394631
/// [`into_remainder`]: ../../std/slice/struct.ChunksExactMut.html#method.into_remainder
46404632
/// [slices]: ../../std/primitive.slice.html
46414633
#[derive(Debug)]
4642-
#[unstable(feature = "rchunks", issue = "55177")]
4634+
#[stable(feature = "rchunks", since = "1.31.0")]
46434635
pub struct RChunksExactMut<'a, T:'a> {
46444636
v: &'a mut [T],
46454637
rem: &'a mut [T],
46464638
chunk_size: usize
46474639
}
46484640

4649-
#[unstable(feature = "rchunks", issue = "55177")]
46504641
impl<'a, T> RChunksExactMut<'a, T> {
46514642
/// Return the remainder of the original slice that is not going to be
46524643
/// returned by the iterator. The returned slice has at most `chunk_size-1`
46534644
/// elements.
4645+
#[stable(feature = "rchunks", since = "1.31.0")]
46544646
pub fn into_remainder(self) -> &'a mut [T] {
46554647
self.rem
46564648
}
46574649
}
46584650

4659-
#[unstable(feature = "rchunks", issue = "55177")]
4651+
#[stable(feature = "rchunks", since = "1.31.0")]
46604652
impl<'a, T> Iterator for RChunksExactMut<'a, T> {
46614653
type Item = &'a mut [T];
46624654

@@ -4705,7 +4697,7 @@ impl<'a, T> Iterator for RChunksExactMut<'a, T> {
47054697
}
47064698
}
47074699

4708-
#[unstable(feature = "rchunks", issue = "55177")]
4700+
#[stable(feature = "rchunks", since = "1.31.0")]
47094701
impl<'a, T> DoubleEndedIterator for RChunksExactMut<'a, T> {
47104702
#[inline]
47114703
fn next_back(&mut self) -> Option<&'a mut [T]> {
@@ -4720,7 +4712,7 @@ impl<'a, T> DoubleEndedIterator for RChunksExactMut<'a, T> {
47204712
}
47214713
}
47224714

4723-
#[unstable(feature = "rchunks", issue = "55177")]
4715+
#[stable(feature = "rchunks", since = "1.31.0")]
47244716
impl<'a, T> ExactSizeIterator for RChunksExactMut<'a, T> {
47254717
fn is_empty(&self) -> bool {
47264718
self.v.is_empty()
@@ -4730,11 +4722,11 @@ impl<'a, T> ExactSizeIterator for RChunksExactMut<'a, T> {
47304722
#[unstable(feature = "trusted_len", issue = "37572")]
47314723
unsafe impl<'a, T> TrustedLen for RChunksExactMut<'a, T> {}
47324724

4733-
#[unstable(feature = "rchunks", issue = "55177")]
4725+
#[stable(feature = "rchunks", since = "1.31.0")]
47344726
impl<'a, T> FusedIterator for RChunksExactMut<'a, T> {}
47354727

47364728
#[doc(hidden)]
4737-
#[unstable(feature = "rchunks", issue = "55177")]
4729+
#[stable(feature = "rchunks", since = "1.31.0")]
47384730
unsafe impl<'a, T> TrustedRandomAccess for RChunksExactMut<'a, T> {
47394731
unsafe fn get_unchecked(&mut self, i: usize) -> &'a mut [T] {
47404732
let end = self.v.len() - i * self.chunk_size;

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#![feature(trusted_len)]
3535
#![feature(try_from)]
3636
#![feature(try_trait)]
37-
#![feature(rchunks)]
3837
#![feature(align_offset)]
3938
#![feature(reverse_bits)]
4039
#![feature(inner_deref)]

0 commit comments

Comments
 (0)