Skip to content

Commit 1837708

Browse files
Fixed transmute argument
1 parent 1767c8b commit 1837708

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
420420
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
421421
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
422422
// Also relies on `&str` and `&[u8]` having the same layout.
423-
unsafe { mem::transmute(self) }
423+
unsafe { mem::transmute(v) }
424424
}
425425

426426
/// Converts a slice of bytes to a string slice without checking

0 commit comments

Comments
 (0)