Skip to content

Commit

Permalink
Unrolled build for rust-lang#124100
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#124100 - dev-ardi:master, r=workingjubilee

fix: make `str::from_raw_parts_mut` `mut`

`str::from_raw_parts_mut` wasn't actually `mut`
rust-lang#119206
  • Loading branch information
rust-timer authored Apr 18, 2024
2 parents b1248bc + 9cc9ba5 commit 25e437e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/str/converts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}

0 comments on commit 25e437e

Please sign in to comment.