Skip to content

Commit

Permalink
Remove Invalid UTF-8 from str::from_utf8_unchecked_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
napen123 committed Sep 12, 2017
1 parent 18ef0de commit 8adf50d
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/libcore/str/mod.rs
Expand Up @@ -395,21 +395,6 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
///
/// assert_eq!("💖", heart);
/// ```
///
/// Invalid UTF-8:
///
/// ```
/// use std::str;
///
/// // Invalid bytes.
/// let mut bytes = vec![240, 40, 140, 188];
///
/// // Returns a str:
/// unsafe { str::from_utf8_unchecked_mut(&mut bytes) };
///
/// // from_utf8 returns an error instead:
/// assert!(str::from_utf8(&bytes).is_err());
/// ```
#[inline]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
Expand Down

0 comments on commit 8adf50d

Please sign in to comment.