stabilize `Option::as_`(`mut_`)`slice` · rust-lang/rust@702da3b

@@ -743,8 +743,6 @@ impl<T> Option<T> {

743743

/// # Examples

744744

///

745745

/// ```rust

746-

/// #![feature(option_as_slice)]

747-

///

748746

/// assert_eq!(

749747

/// [Some(1234).as_slice(), None.as_slice()],

750748

/// [&[1234][..], &[][..]],

@@ -755,15 +753,13 @@ impl<T> Option<T> {

755753

/// borrowing) [`[_]::first`](slice::first):

756754

///

757755

/// ```rust

758-

/// #![feature(option_as_slice)]

759-

///

760756

/// for i in [Some(1234_u16), None] {

761757

/// assert_eq!(i.as_ref(), i.as_slice().first());

762758

/// }

763759

/// ```

764760

#[inline]

765761

#[must_use]

766-

#[unstable(feature = "option_as_slice", issue = "108545")]

762+

#[stable(feature = "option_as_slice", since = "CURRENT_RUSTC_VERSION")]

767763

pub fn as_slice(&self) -> &[T] {

768764

// SAFETY: When the `Option` is `Some`, we're using the actual pointer

769765

// to the payload, with a length of 1, so this is equivalent to

@@ -794,8 +790,6 @@ impl<T> Option<T> {

794790

/// # Examples

795791

///

796792

/// ```rust

797-

/// #![feature(option_as_slice)]

798-

///

799793

/// assert_eq!(

800794

/// [Some(1234).as_mut_slice(), None.as_mut_slice()],

801795

/// [&mut [1234][..], &mut [][..]],

@@ -806,8 +800,6 @@ impl<T> Option<T> {

806800

/// our original `Option`:

807801

///

808802

/// ```rust

809-

/// #![feature(option_as_slice)]

810-

///

811803

/// let mut x = Some(1234);

812804

/// x.as_mut_slice()[0] += 1;

813805

/// assert_eq!(x, Some(1235));

@@ -817,13 +809,11 @@ impl<T> Option<T> {

817809

/// is [`[_]::first_mut`](slice::first_mut):

818810

///

819811

/// ```rust

820-

/// #![feature(option_as_slice)]

821-

///

822812

/// assert_eq!(Some(123).as_mut_slice().first_mut(), Some(&mut 123))

823813

/// ```

824814

#[inline]

825815

#[must_use]

826-

#[unstable(feature = "option_as_slice", issue = "108545")]

816+

#[stable(feature = "option_as_slice", since = "CURRENT_RUSTC_VERSION")]

827817

pub fn as_mut_slice(&mut self) -> &mut [T] {

828818

// SAFETY: When the `Option` is `Some`, we're using the actual pointer

829819

// to the payload, with a length of 1, so this is equivalent to