This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -338,9 +338,10 @@ impl str {
338338 /// assert_eq!("🍔∈🌏", s);
339339 /// ```
340340 #[ stable( feature = "str_mut_extras" , since = "1.20.0" ) ]
341+ #[ rustc_const_unstable( feature = "const_str_as_mut" , issue = "130086" ) ]
341342 #[ must_use]
342343 #[ inline( always) ]
343- pub unsafe fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
344+ pub const unsafe fn as_bytes_mut ( & mut self ) -> & mut [ u8 ] {
344345 // SAFETY: the cast from `&str` to `&[u8]` is safe since `str`
345346 // has the same layout as `&[u8]` (only std can make this guarantee).
346347 // The pointer dereference is safe since it comes from a mutable reference which
@@ -383,10 +384,11 @@ impl str {
383384 /// It is your responsibility to make sure that the string slice only gets
384385 /// modified in a way that it remains valid UTF-8.
385386 #[ stable( feature = "str_as_mut_ptr" , since = "1.36.0" ) ]
387+ #[ rustc_const_unstable( feature = "const_str_as_mut" , issue = "130086" ) ]
386388 #[ rustc_never_returns_null_ptr]
387389 #[ must_use]
388390 #[ inline( always) ]
389- pub fn as_mut_ptr ( & mut self ) -> * mut u8 {
391+ pub const fn as_mut_ptr ( & mut self ) -> * mut u8 {
390392 self as * mut str as * mut u8
391393 }
392394
You can’t perform that action at this time.
0 commit comments