about summary refs log tree commit diff
diff options
context:
space:
mode:
authorrodrimati1992 <rodrimatt1985@gmail.com>2020-08-13 16:08:22 -0300
committerGitHub <noreply@github.com>2020-08-13 16:08:22 -0300
commit18377082f1a1ba2f07193f12b9d571d25b670ff7 (patch)
treea5634baebc2ff8a544552c1a014db2401d72c035
parent1767c8bdf0c57ca10862dae98a4955044ccc1cbf (diff)
downloadrust-18377082f1a1ba2f07193f12b9d571d25b670ff7.tar.gz
rust-18377082f1a1ba2f07193f12b9d571d25b670ff7.zip
Fixed transmute argument
-rw-r--r--library/core/src/str/mod.rs2
1 files changed, 1 insertions, 1 deletions
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