Skip to content

Commit 6cfdd53

Browse files
committed
Stabilize slice_as_chunks library feature
1 parent 56c08d9 commit 6cfdd53

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

compiler/rustc_span/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(round_char_boundary)]
3232
#![feature(rustc_attrs)]
3333
#![feature(rustdoc_internals)]
34-
#![feature(slice_as_chunks)]
3534
// tidy-alphabetical-end
3635

3736
// The code produced by the `Encodable`/`Decodable` derive macros refer to

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
#![feature(ptr_metadata)]
120120
#![feature(set_ptr_value)]
121121
#![feature(slice_as_array)]
122-
#![feature(slice_as_chunks)]
123122
#![feature(slice_ptr_get)]
124123
#![feature(str_internals)]
125124
#![feature(str_split_inclusive_remainder)]

library/core/src/slice/iter.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,6 @@ pub struct ArrayChunks<'a, T: 'a, const N: usize> {
23352335

23362336
impl<'a, T, const N: usize> ArrayChunks<'a, T, N> {
23372337
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
2338-
// #[rustc_const_unstable(feature = "slice_as_chunks", issue = "74985")]
23392338
#[inline]
23402339
pub(super) const fn new(slice: &'a [T]) -> Self {
23412340
let (array_slice, rem) = slice.as_chunks();

library/core/src/slice/mod.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,6 @@ impl<T> [T] {
12711271
/// # Examples
12721272
///
12731273
/// ```
1274-
/// #![feature(slice_as_chunks)]
12751274
/// let slice: &[char] = &['l', 'o', 'r', 'e', 'm', '!'];
12761275
/// let chunks: &[[char; 1]] =
12771276
/// // SAFETY: 1-element chunks never have remainder
@@ -1286,7 +1285,8 @@ impl<T> [T] {
12861285
/// // let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
12871286
/// // let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed
12881287
/// ```
1289-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1288+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1289+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
12901290
#[inline]
12911291
#[must_use]
12921292
pub const unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]] {
@@ -1314,7 +1314,6 @@ impl<T> [T] {
13141314
/// # Examples
13151315
///
13161316
/// ```
1317-
/// #![feature(slice_as_chunks)]
13181317
/// let slice = ['l', 'o', 'r', 'e', 'm'];
13191318
/// let (chunks, remainder) = slice.as_chunks();
13201319
/// assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
@@ -1324,14 +1323,14 @@ impl<T> [T] {
13241323
/// If you expect the slice to be an exact multiple, you can combine
13251324
/// `let`-`else` with an empty slice pattern:
13261325
/// ```
1327-
/// #![feature(slice_as_chunks)]
13281326
/// let slice = ['R', 'u', 's', 't'];
13291327
/// let (chunks, []) = slice.as_chunks::<2>() else {
13301328
/// panic!("slice didn't have even length")
13311329
/// };
13321330
/// assert_eq!(chunks, &[['R', 'u'], ['s', 't']]);
13331331
/// ```
1334-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1332+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1333+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
13351334
#[inline]
13361335
#[track_caller]
13371336
#[must_use]
@@ -1359,13 +1358,13 @@ impl<T> [T] {
13591358
/// # Examples
13601359
///
13611360
/// ```
1362-
/// #![feature(slice_as_chunks)]
13631361
/// let slice = ['l', 'o', 'r', 'e', 'm'];
13641362
/// let (remainder, chunks) = slice.as_rchunks();
13651363
/// assert_eq!(remainder, &['l']);
13661364
/// assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);
13671365
/// ```
1368-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1366+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1367+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
13691368
#[inline]
13701369
#[track_caller]
13711370
#[must_use]
@@ -1427,7 +1426,6 @@ impl<T> [T] {
14271426
/// # Examples
14281427
///
14291428
/// ```
1430-
/// #![feature(slice_as_chunks)]
14311429
/// let slice: &mut [char] = &mut ['l', 'o', 'r', 'e', 'm', '!'];
14321430
/// let chunks: &mut [[char; 1]] =
14331431
/// // SAFETY: 1-element chunks never have remainder
@@ -1444,7 +1442,8 @@ impl<T> [T] {
14441442
/// // let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
14451443
/// // let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed
14461444
/// ```
1447-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1445+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1446+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
14481447
#[inline]
14491448
#[must_use]
14501449
pub const unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]] {
@@ -1472,7 +1471,6 @@ impl<T> [T] {
14721471
/// # Examples
14731472
///
14741473
/// ```
1475-
/// #![feature(slice_as_chunks)]
14761474
/// let v = &mut [0, 0, 0, 0, 0];
14771475
/// let mut count = 1;
14781476
///
@@ -1484,7 +1482,8 @@ impl<T> [T] {
14841482
/// }
14851483
/// assert_eq!(v, &[1, 1, 2, 2, 9]);
14861484
/// ```
1487-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1485+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1486+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
14881487
#[inline]
14891488
#[track_caller]
14901489
#[must_use]
@@ -1512,7 +1511,6 @@ impl<T> [T] {
15121511
/// # Examples
15131512
///
15141513
/// ```
1515-
/// #![feature(slice_as_chunks)]
15161514
/// let v = &mut [0, 0, 0, 0, 0];
15171515
/// let mut count = 1;
15181516
///
@@ -1524,7 +1522,8 @@ impl<T> [T] {
15241522
/// }
15251523
/// assert_eq!(v, &[9, 1, 1, 2, 2]);
15261524
/// ```
1527-
#[unstable(feature = "slice_as_chunks", issue = "74985")]
1525+
#[stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
1526+
#[rustc_const_stable(feature = "slice_as_chunks", since = "CURRENT_RUSTC_VERSION")]
15281527
#[inline]
15291528
#[track_caller]
15301529
#[must_use]

src/tools/miri/tests/pass/slices.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
33
//@compile-flags: -Zmiri-strict-provenance
4-
#![feature(slice_as_chunks)]
54
#![feature(slice_partition_dedup)]
65
#![feature(layout_for_ptr)]
76

@@ -227,7 +226,7 @@ fn test_for_invalidated_pointers() {
227226

228227
buffer.reverse();
229228

230-
// Calls `fn as_chunks_unchecked_mut` internally (requires unstable `#![feature(slice_as_chunks)]`):
229+
// Calls `fn as_chunks_unchecked_mut` internally:
231230
assert_eq!(2, buffer.as_chunks_mut::<32>().0.len());
232231
for chunk in buffer.as_chunks_mut::<32>().0 {
233232
for elem in chunk {

tests/codegen/slice-as_chunks.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ only-64bit (because the LLVM type of i64 for usize shows up)
33

44
#![crate_type = "lib"]
5-
#![feature(slice_as_chunks)]
65

76
// CHECK-LABEL: @chunks4
87
#[no_mangle]

0 commit comments

Comments
 (0)