library: Stabilize const_str_as_mut

Const-stabilizes:
- `str::as_bytes_mut`
- `str::as_mut_ptr`
This commit is contained in:
Jubilee Young 2024-09-27 13:30:21 -07:00
parent a0228686d1
commit bcc78bdc29
3 changed files with 5 additions and 3 deletions

View File

@ -151,7 +151,6 @@
#![feature(const_slice_from_raw_parts_mut)] #![feature(const_slice_from_raw_parts_mut)]
#![feature(const_slice_from_ref)] #![feature(const_slice_from_ref)]
#![feature(const_slice_split_at_mut)] #![feature(const_slice_split_at_mut)]
#![feature(const_str_as_mut)]
#![feature(const_strict_overflow_ops)] #![feature(const_strict_overflow_ops)]
#![feature(const_swap)] #![feature(const_swap)]
#![feature(const_try)] #![feature(const_try)]

View File

@ -195,6 +195,7 @@ pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "str_mut_extras", since = "1.20.0")] #[stable(feature = "str_mut_extras", since = "1.20.0")]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable( #[rustc_const_stable(
feature = "const_str_from_utf8_unchecked_mut", feature = "const_str_from_utf8_unchecked_mut",
since = "CURRENT_RUSTC_VERSION" since = "CURRENT_RUSTC_VERSION"

View File

@ -339,7 +339,8 @@ pub const fn as_bytes(&self) -> &[u8] {
/// assert_eq!("🍔∈🌏", s); /// assert_eq!("🍔∈🌏", s);
/// ``` /// ```
#[stable(feature = "str_mut_extras", since = "1.20.0")] #[stable(feature = "str_mut_extras", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_str_as_mut", issue = "130086")] #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_str_as_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use] #[must_use]
#[inline(always)] #[inline(always)]
pub const unsafe fn as_bytes_mut(&mut self) -> &mut [u8] { pub const unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
@ -385,7 +386,8 @@ pub const fn as_ptr(&self) -> *const u8 {
/// It is your responsibility to make sure that the string slice only gets /// It is your responsibility to make sure that the string slice only gets
/// modified in a way that it remains valid UTF-8. /// modified in a way that it remains valid UTF-8.
#[stable(feature = "str_as_mut_ptr", since = "1.36.0")] #[stable(feature = "str_as_mut_ptr", since = "1.36.0")]
#[rustc_const_unstable(feature = "const_str_as_mut", issue = "130086")] #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[rustc_const_stable(feature = "const_str_as_mut", since = "CURRENT_RUSTC_VERSION")]
#[rustc_never_returns_null_ptr] #[rustc_never_returns_null_ptr]
#[must_use] #[must_use]
#[inline(always)] #[inline(always)]