Skip to content

Commit 6b90c0f

Browse files
committed
Fix copy-paste error in String::as_mut_vec() docs
1 parent 17e13b5 commit 6b90c0f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

library/alloc/src/string.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1500,10 +1500,11 @@ impl String {
15001500
///
15011501
/// # Safety
15021502
///
1503-
/// This function is unsafe because it does not check that the bytes passed
1504-
/// to it are valid UTF-8. If this constraint is violated, it may cause
1505-
/// memory unsafety issues with future users of the `String`, as the rest of
1506-
/// the standard library assumes that `String`s are valid UTF-8.
1503+
/// This function is unsafe because the returned `&mut Vec` allows writing
1504+
/// bytes which are not valid UTF-8. If this constraint is violated, using
1505+
/// the original `String` after dropping the `&mut Vec` may violate memory
1506+
/// safety, as the rest of the standard library assumes that `String`s are
1507+
/// valid UTF-8.
15071508
///
15081509
/// # Examples
15091510
///

0 commit comments

Comments
 (0)