Skip to content

Commit dda2826

Browse files
committed
Reapply "Rollup merge of rust-lang#147540 - bjoernager:slice-as-array, r=Amanieu"
This reverts commit 0b5107f.
1 parent 751cb0c commit dda2826

9 files changed

Lines changed: 16 additions & 14 deletions

File tree

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(iter_intersperse)]
1212
#![feature(macro_derive)]
1313
#![feature(once_cell_try)]
14-
#![feature(slice_as_array)]
1514
#![feature(trim_prefix_suffix)]
1615
#![feature(try_blocks)]
1716
// tidy-alphabetical-end

library/alloc/src/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,12 +1149,12 @@ impl<T, A: Allocator> Box<[T], A> {
11491149
/// # Examples
11501150
///
11511151
/// ```
1152-
/// #![feature(slice_as_array)]
1152+
/// #![feature(alloc_slice_into_array)]
11531153
/// let box_slice: Box<[i32]> = Box::new([1, 2, 3]);
11541154
///
11551155
/// let box_array: Box<[i32; 3]> = box_slice.into_array().unwrap();
11561156
/// ```
1157-
#[unstable(feature = "slice_as_array", issue = "133508")]
1157+
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
11581158
#[inline]
11591159
#[must_use]
11601160
pub fn into_array<const N: usize>(self) -> Result<Box<[T; N], A>, Self> {

library/alloc/src/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,14 +1246,14 @@ impl<T, A: Allocator> Rc<[T], A> {
12461246
/// # Examples
12471247
///
12481248
/// ```
1249-
/// #![feature(slice_as_array)]
1249+
/// #![feature(alloc_slice_into_array)]
12501250
/// use std::rc::Rc;
12511251
///
12521252
/// let rc_slice: Rc<[i32]> = Rc::new([1, 2, 3]);
12531253
///
12541254
/// let rc_array: Rc<[i32; 3]> = rc_slice.into_array().unwrap();
12551255
/// ```
1256-
#[unstable(feature = "slice_as_array", issue = "133508")]
1256+
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
12571257
#[inline]
12581258
#[must_use]
12591259
pub fn into_array<const N: usize>(self) -> Result<Rc<[T; N], A>, Self> {

library/alloc/src/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,14 +1397,14 @@ impl<T, A: Allocator> Arc<[T], A> {
13971397
/// # Examples
13981398
///
13991399
/// ```
1400-
/// #![feature(slice_as_array)]
1400+
/// #![feature(alloc_slice_into_array)]
14011401
/// use std::sync::Arc;
14021402
///
14031403
/// let arc_slice: Arc<[i32]> = Arc::new([1, 2, 3]);
14041404
///
14051405
/// let arc_array: Arc<[i32; 3]> = arc_slice.into_array().unwrap();
14061406
/// ```
1407-
#[unstable(feature = "slice_as_array", issue = "133508")]
1407+
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
14081408
#[inline]
14091409
#[must_use]
14101410
pub fn into_array<const N: usize>(self) -> Result<Arc<[T; N], A>, Self> {

library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,14 +1749,14 @@ impl<T, A: Allocator> Vec<T, A> {
17491749
/// # Examples
17501750
///
17511751
/// ```
1752-
/// #![feature(slice_as_array)]
1752+
/// #![feature(alloc_slice_into_array)]
17531753
/// let vec: Vec<i32> = vec![1, 2, 3];
17541754
/// let box_array: Box<[i32; 3]> = vec.clone().into_array().unwrap();
17551755
/// let not_enough_elements: Result<Box<[i32; 4]>, Vec<i32>> = vec.into_array::<4>();
17561756
/// assert_eq!(not_enough_elements, Err(vec![1, 2, 3]));
17571757
/// ```
17581758
#[cfg(not(no_global_oom_handling))]
1759-
#[unstable(feature = "slice_as_array", issue = "133508")]
1759+
#[unstable(feature = "alloc_slice_into_array", issue = "148082")]
17601760
#[must_use]
17611761
pub fn into_array<const N: usize>(self) -> Result<Box<[T; N], A>, Self> {
17621762
if self.len() == N {

library/core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
#![feature(offset_of_enum)]
112112
#![feature(panic_internals)]
113113
#![feature(pattern_type_macro)]
114-
#![feature(slice_as_array)]
115114
#![feature(ub_checks)]
116115
// tidy-alphabetical-end
117116
//

library/core/src/ptr/const_ptr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,8 @@ impl<T> *const [T] {
14811481
/// Gets a raw pointer to the underlying array.
14821482
///
14831483
/// If `N` is not exactly equal to the length of `self`, then this method returns `None`.
1484-
#[unstable(feature = "slice_as_array", issue = "133508")]
1484+
#[stable(feature = "core_slice_as_array", since = "1.93.0")]
1485+
#[rustc_const_stable(feature = "core_slice_as_array", since = "1.93.0")]
14851486
#[inline]
14861487
#[must_use]
14871488
pub const fn as_array<const N: usize>(self) -> Option<*const [T; N]> {

library/core/src/ptr/mut_ptr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,8 @@ impl<T> *mut [T] {
17401740
/// Gets a raw, mutable pointer to the underlying array.
17411741
///
17421742
/// If `N` is not exactly equal to the length of `self`, then this method returns `None`.
1743-
#[unstable(feature = "slice_as_array", issue = "133508")]
1743+
#[stable(feature = "core_slice_as_array", since = "1.93.0")]
1744+
#[rustc_const_stable(feature = "core_slice_as_array", since = "1.93.0")]
17441745
#[inline]
17451746
#[must_use]
17461747
pub const fn as_mut_array<const N: usize>(self) -> Option<*mut [T; N]> {

library/core/src/slice/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,8 @@ impl<T> [T] {
846846
/// Gets a reference to the underlying array.
847847
///
848848
/// If `N` is not exactly equal to the length of `self`, then this method returns `None`.
849-
#[unstable(feature = "slice_as_array", issue = "133508")]
849+
#[stable(feature = "core_slice_as_array", since = "1.93.0")]
850+
#[rustc_const_stable(feature = "core_slice_as_array", since = "1.93.0")]
850851
#[inline]
851852
#[must_use]
852853
pub const fn as_array<const N: usize>(&self) -> Option<&[T; N]> {
@@ -864,7 +865,8 @@ impl<T> [T] {
864865
/// Gets a mutable reference to the slice's underlying array.
865866
///
866867
/// If `N` is not exactly equal to the length of `self`, then this method returns `None`.
867-
#[unstable(feature = "slice_as_array", issue = "133508")]
868+
#[stable(feature = "core_slice_as_array", since = "1.93.0")]
869+
#[rustc_const_stable(feature = "core_slice_as_array", since = "1.93.0")]
868870
#[inline]
869871
#[must_use]
870872
pub const fn as_mut_array<const N: usize>(&mut self) -> Option<&mut [T; N]> {

0 commit comments

Comments
 (0)