Skip to content

Commit 612356a

Browse files
committed
Auto merge of #90290 - nyanpasu64:fix-string-as-mut-vec, r=m-ou-se
Fix copy-paste error in String::as_mut_vec() docs Did not expect the comments to be perfectly justified... can't wait to be told to change it to `Vec<u8>`, which destroys the justification 😼
2 parents 3c8f001 + 6b90c0f commit 612356a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: 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)