about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-18 08:37:50 +0200
committerGitHub <noreply@github.com>2024-04-18 08:37:50 +0200
commit5543da9aec9088931786431025c3d10f56e07727 (patch)
tree88d08dc833506ba5a0aba37d7dd5ced98acc134d
parent90013ff5ad7c73c7f417f633e91eebfba75e8caa (diff)
parent9cc9ba5caea6cf292f23bd7d119369716ba0e10b (diff)
Rollup merge of #124100 - dev-ardi:master, r=workingjubilee
fix: make `str::from_raw_parts_mut` `mut`

`str::from_raw_parts_mut` wasn't actually `mut`
#119206
-rw-r--r--library/core/src/str/converts.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/str/converts.rs b/library/core/src/str/converts.rs
index ba282f09d20..b6ffb0a608d 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) }
 }