We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1767c8b commit 1837708Copy full SHA for 1837708
library/core/src/str/mod.rs
@@ -420,7 +420,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
420
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
421
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
422
// Also relies on `&str` and `&[u8]` having the same layout.
423
- unsafe { mem::transmute(self) }
+ unsafe { mem::transmute(v) }
424
}
425
426
/// Converts a slice of bytes to a string slice without checking
0 commit comments