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_ref)]
#![feature(const_slice_split_at_mut)]
#![feature(const_str_as_mut)]
#![feature(const_strict_overflow_ops)]
#![feature(const_swap)]
#![feature(const_try)]

View File

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

View File

@ -339,7 +339,8 @@ pub const fn as_bytes(&self) -> &[u8] {
/// assert_eq!("🍔∈🌏", s);
/// ```
#[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]
#[inline(always)]
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
/// modified in a way that it remains valid UTF-8.
#[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]
#[must_use]
#[inline(always)]