From 18377082f1a1ba2f07193f12b9d571d25b670ff7 Mon Sep 17 00:00:00 2001 From: rodrimati1992 Date: Thu, 13 Aug 2020 16:08:22 -0300 Subject: [PATCH] Fixed transmute argument --- library/core/src/str/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 80f01dcdf02..e58babc8100 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -420,7 +420,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> { pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { // SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8. // Also relies on `&str` and `&[u8]` having the same layout. - unsafe { mem::transmute(self) } + unsafe { mem::transmute(v) } } /// Converts a slice of bytes to a string slice without checking