Skip to content

Commit 8adf50d

Browse files
committed
Remove Invalid UTF-8 from str::from_utf8_unchecked_mut
1 parent 18ef0de commit 8adf50d

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/libcore/str/mod.rs

-15
Original file line numberDiff line numberDiff line change
@@ -395,21 +395,6 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
395395
///
396396
/// assert_eq!("💖", heart);
397397
/// ```
398-
///
399-
/// Invalid UTF-8:
400-
///
401-
/// ```
402-
/// use std::str;
403-
///
404-
/// // Invalid bytes.
405-
/// let mut bytes = vec![240, 40, 140, 188];
406-
///
407-
/// // Returns a str:
408-
/// unsafe { str::from_utf8_unchecked_mut(&mut bytes) };
409-
///
410-
/// // from_utf8 returns an error instead:
411-
/// assert!(str::from_utf8(&bytes).is_err());
412-
/// ```
413398
#[inline]
414399
#[stable(feature = "str_mut_extras", since = "1.20.0")]
415400
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {

0 commit comments

Comments
 (0)