diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-09-27 13:30:21 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-10-02 14:09:19 -0700 |
| commit | bcc78bdc29ed8183f60b3275ce8ac292bd771ab4 (patch) | |
| tree | d37b5b39254b9737e01e8e49c52f566967e32289 | |
| parent | a0228686d16baea8880320905a484cfbfe36d8bc (diff) | |
| download | rust-bcc78bdc29ed8183f60b3275ce8ac292bd771ab4.tar.gz rust-bcc78bdc29ed8183f60b3275ce8ac292bd771ab4.zip | |
library: Stabilize `const_str_as_mut`
Const-stabilizes: - `str::as_bytes_mut` - `str::as_mut_ptr`
| -rw-r--r-- | library/core/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/core/src/str/converts.rs | 1 | ||||
| -rw-r--r-- | library/core/src/str/mod.rs | 6 |
3 files changed, 5 insertions, 3 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 9edc1a8c1f5..ba30c4eab11 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -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)] diff --git a/library/core/src/str/converts.rs b/library/core/src/str/converts.rs index e932b652e2d..194db56fdaf 100644 --- a/library/core/src/str/converts.rs +++ b/library/core/src/str/converts.rs @@ -195,6 +195,7 @@ pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { #[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" diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 3d535214637..e93c52f2799 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -339,7 +339,8 @@ impl str { /// 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 @@ impl str { /// 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)] |
