Skip to content

Commit

Permalink
Fixed transmute argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrimati1992 authored Aug 13, 2020
1 parent 1767c8b commit 1837708
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1837708

Please sign in to comment.