Skip to content

Commit b08ca29

Browse files
committed
Stabilize slice::chunks_exact() and slice::chunks_exact_mut()
Fixes rust-lang#47115
1 parent 121320d commit b08ca29

File tree

5 files changed

+18
-25
lines changed

5 files changed

+18
-25
lines changed

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
#![feature(unsize)]
116116
#![feature(allocator_internals)]
117117
#![feature(on_unimplemented)]
118-
#![feature(chunks_exact)]
119118
#![feature(rustc_const_unstable)]
120119
#![feature(const_vec_new)]
121120
#![feature(slice_partition_dedup)]

src/liballoc/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub use core::slice::{from_raw_parts, from_raw_parts_mut};
123123
pub use core::slice::{from_ref, from_mut};
124124
#[stable(feature = "slice_get_slice", since = "1.28.0")]
125125
pub use core::slice::SliceIndex;
126-
#[unstable(feature = "chunks_exact", issue = "47115")]
126+
#[stable(feature = "chunks_exact", since = "1.31.0")]
127127
pub use core::slice::{ChunksExact, ChunksExactMut};
128128
#[unstable(feature = "rchunks", issue = "55177")]
129129
pub use core::slice::{RChunks, RChunksMut, RChunksExact, RChunksExactMut};

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(chunks_exact)]
2322
#![feature(rchunks)]
2423
#![feature(repeat_generic_slice)]
2524

src/libcore/slice/mod.rs

+17-21
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,6 @@ impl<T> [T] {
713713
/// # Examples
714714
///
715715
/// ```
716-
/// #![feature(chunks_exact)]
717-
///
718716
/// let slice = ['l', 'o', 'r', 'e', 'm'];
719717
/// let mut iter = slice.chunks_exact(2);
720718
/// assert_eq!(iter.next().unwrap(), &['l', 'o']);
@@ -725,7 +723,7 @@ impl<T> [T] {
725723
///
726724
/// [`chunks`]: #method.chunks
727725
/// [`rchunks_exact`]: #method.rchunks_exact
728-
#[unstable(feature = "chunks_exact", issue = "47115")]
726+
#[stable(feature = "chunks_exact", since = "1.31.0")]
729727
#[inline]
730728
pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<T> {
731729
assert!(chunk_size != 0);
@@ -756,8 +754,6 @@ impl<T> [T] {
756754
/// # Examples
757755
///
758756
/// ```
759-
/// #![feature(chunks_exact)]
760-
///
761757
/// let v = &mut [0, 0, 0, 0, 0];
762758
/// let mut count = 1;
763759
///
@@ -772,7 +768,7 @@ impl<T> [T] {
772768
///
773769
/// [`chunks_mut`]: #method.chunks_mut
774770
/// [`rchunks_exact_mut`]: #method.rchunks_exact_mut
775-
#[unstable(feature = "chunks_exact", issue = "47115")]
771+
#[stable(feature = "chunks_exact", since = "1.31.0")]
776772
#[inline]
777773
pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<T> {
778774
assert!(chunk_size != 0);
@@ -4022,25 +4018,25 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksMut<'a, T> {
40224018
/// [`remainder`]: ../../std/slice/struct.ChunksExact.html#method.remainder
40234019
/// [slices]: ../../std/primitive.slice.html
40244020
#[derive(Debug)]
4025-
#[unstable(feature = "chunks_exact", issue = "47115")]
4021+
#[stable(feature = "chunks_exact", since = "1.31.0")]
40264022
pub struct ChunksExact<'a, T:'a> {
40274023
v: &'a [T],
40284024
rem: &'a [T],
40294025
chunk_size: usize
40304026
}
40314027

4032-
#[unstable(feature = "chunks_exact", issue = "47115")]
40334028
impl<'a, T> ChunksExact<'a, T> {
40344029
/// Return the remainder of the original slice that is not going to be
40354030
/// returned by the iterator. The returned slice has at most `chunk_size-1`
40364031
/// elements.
4032+
#[stable(feature = "chunks_exact", since = "1.31.0")]
40374033
pub fn remainder(&self) -> &'a [T] {
40384034
self.rem
40394035
}
40404036
}
40414037

40424038
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
4043-
#[unstable(feature = "chunks_exact", issue = "47115")]
4039+
#[stable(feature = "chunks_exact", since = "1.31.0")]
40444040
impl<T> Clone for ChunksExact<'_, T> {
40454041
fn clone(&self) -> Self {
40464042
ChunksExact {
@@ -4051,7 +4047,7 @@ impl<T> Clone for ChunksExact<'_, T> {
40514047
}
40524048
}
40534049

4054-
#[unstable(feature = "chunks_exact", issue = "47115")]
4050+
#[stable(feature = "chunks_exact", since = "1.31.0")]
40554051
impl<'a, T> Iterator for ChunksExact<'a, T> {
40564052
type Item = &'a [T];
40574053

@@ -4096,7 +4092,7 @@ impl<'a, T> Iterator for ChunksExact<'a, T> {
40964092
}
40974093
}
40984094

4099-
#[unstable(feature = "chunks_exact", issue = "47115")]
4095+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41004096
impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T> {
41014097
#[inline]
41024098
fn next_back(&mut self) -> Option<&'a [T]> {
@@ -4110,7 +4106,7 @@ impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T> {
41104106
}
41114107
}
41124108

4113-
#[unstable(feature = "chunks_exact", issue = "47115")]
4109+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41144110
impl<T> ExactSizeIterator for ChunksExact<'_, T> {
41154111
fn is_empty(&self) -> bool {
41164112
self.v.is_empty()
@@ -4120,11 +4116,11 @@ impl<T> ExactSizeIterator for ChunksExact<'_, T> {
41204116
#[unstable(feature = "trusted_len", issue = "37572")]
41214117
unsafe impl<T> TrustedLen for ChunksExact<'_, T> {}
41224118

4123-
#[unstable(feature = "chunks_exact", issue = "47115")]
4119+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41244120
impl<T> FusedIterator for ChunksExact<'_, T> {}
41254121

41264122
#[doc(hidden)]
4127-
#[unstable(feature = "chunks_exact", issue = "47115")]
4123+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41284124
unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> {
41294125
unsafe fn get_unchecked(&mut self, i: usize) -> &'a [T] {
41304126
let start = i * self.chunk_size;
@@ -4146,24 +4142,24 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> {
41464142
/// [`into_remainder`]: ../../std/slice/struct.ChunksExactMut.html#method.into_remainder
41474143
/// [slices]: ../../std/primitive.slice.html
41484144
#[derive(Debug)]
4149-
#[unstable(feature = "chunks_exact", issue = "47115")]
4145+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41504146
pub struct ChunksExactMut<'a, T:'a> {
41514147
v: &'a mut [T],
41524148
rem: &'a mut [T],
41534149
chunk_size: usize
41544150
}
41554151

4156-
#[unstable(feature = "chunks_exact", issue = "47115")]
41574152
impl<'a, T> ChunksExactMut<'a, T> {
41584153
/// Return the remainder of the original slice that is not going to be
41594154
/// returned by the iterator. The returned slice has at most `chunk_size-1`
41604155
/// elements.
4156+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41614157
pub fn into_remainder(self) -> &'a mut [T] {
41624158
self.rem
41634159
}
41644160
}
41654161

4166-
#[unstable(feature = "chunks_exact", issue = "47115")]
4162+
#[stable(feature = "chunks_exact", since = "1.31.0")]
41674163
impl<'a, T> Iterator for ChunksExactMut<'a, T> {
41684164
type Item = &'a mut [T];
41694165

@@ -4210,7 +4206,7 @@ impl<'a, T> Iterator for ChunksExactMut<'a, T> {
42104206
}
42114207
}
42124208

4213-
#[unstable(feature = "chunks_exact", issue = "47115")]
4209+
#[stable(feature = "chunks_exact", since = "1.31.0")]
42144210
impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T> {
42154211
#[inline]
42164212
fn next_back(&mut self) -> Option<&'a mut [T]> {
@@ -4226,7 +4222,7 @@ impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T> {
42264222
}
42274223
}
42284224

4229-
#[unstable(feature = "chunks_exact", issue = "47115")]
4225+
#[stable(feature = "chunks_exact", since = "1.31.0")]
42304226
impl<T> ExactSizeIterator for ChunksExactMut<'_, T> {
42314227
fn is_empty(&self) -> bool {
42324228
self.v.is_empty()
@@ -4236,11 +4232,11 @@ impl<T> ExactSizeIterator for ChunksExactMut<'_, T> {
42364232
#[unstable(feature = "trusted_len", issue = "37572")]
42374233
unsafe impl<T> TrustedLen for ChunksExactMut<'_, T> {}
42384234

4239-
#[unstable(feature = "chunks_exact", issue = "47115")]
4235+
#[stable(feature = "chunks_exact", since = "1.31.0")]
42404236
impl<T> FusedIterator for ChunksExactMut<'_, T> {}
42414237

42424238
#[doc(hidden)]
4243-
#[unstable(feature = "chunks_exact", issue = "47115")]
4239+
#[stable(feature = "chunks_exact", since = "1.31.0")]
42444240
unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> {
42454241
unsafe fn get_unchecked(&mut self, i: usize) -> &'a mut [T] {
42464242
let start = 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(chunks_exact)]
3837
#![feature(rchunks)]
3938
#![feature(align_offset)]
4039
#![feature(reverse_bits)]

0 commit comments

Comments
 (0)