From 9cc9ba5caea6cf292f23bd7d119369716ba0e10b Mon Sep 17 00:00:00 2001 From: ardi Date: Thu, 18 Apr 2024 01:46:49 +0200 Subject: [PATCH] fix: make `str::from_raw_parts_mut` mut --- library/core/src/str/converts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/str/converts.rs b/library/core/src/str/converts.rs index ba282f09d2067..b6ffb0a608d05 100644 --- a/library/core/src/str/converts.rs +++ b/library/core/src/str/converts.rs @@ -239,7 +239,7 @@ pub const unsafe fn from_raw_parts<'a>(ptr: *const u8, len: usize) -> &'a str { #[must_use] #[unstable(feature = "str_from_raw_parts", issue = "119206")] #[rustc_const_unstable(feature = "const_str_from_raw_parts_mut", issue = "119206")] -pub const unsafe fn from_raw_parts_mut<'a>(ptr: *mut u8, len: usize) -> &'a str { +pub const unsafe fn from_raw_parts_mut<'a>(ptr: *mut u8, len: usize) -> &'a mut str { // SAFETY: the caller must uphold the safety contract for `from_raw_parts_mut`. unsafe { &mut *ptr::from_raw_parts_mut(ptr.cast(), len) } }