Skip to content

Commit

Permalink
Auto merge of rust-lang#90290 - nyanpasu64:fix-string-as-mut-vec, r=m…
Browse files Browse the repository at this point in the history
…-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 😼
  • Loading branch information
bors committed Oct 26, 2021
2 parents 3c8f001 + 6b90c0f commit 612356a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,10 +1500,11 @@ impl String {
///
/// # Safety
///
/// This function is unsafe because it does not check that the bytes passed
/// to it are valid UTF-8. If this constraint is violated, it may cause
/// memory unsafety issues with future users of the `String`, as the rest of
/// the standard library assumes that `String`s are valid UTF-8.
/// This function is unsafe because the returned `&mut Vec` allows writing
/// bytes which are not valid UTF-8. If this constraint is violated, using
/// the original `String` after dropping the `&mut Vec` may violate memory
/// safety, as the rest of the standard library assumes that `String`s are
/// valid UTF-8.
///
/// # Examples
///
Expand Down

0 comments on commit 612356a

Please sign in to comment.