Fixed transmute argument
This commit is contained in:
parent
1767c8bdf0
commit
18377082f1
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user