Skip to content

Commit

Permalink
Update string.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian authored Feb 9, 2025
1 parent a26e97b commit 65a5d8b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,8 @@ impl String {
/// This is highly unsafe, due to the number of invariants that aren't
/// checked:
///
/// * The memory at `buf` needs to have been previously allocated by the
/// same allocator the standard library uses, with a required alignment of exactly 1.
/// * `length` needs to be less than or equal to `capacity`.
/// * `capacity` needs to be the correct value.
/// * The first `length` bytes at `buf` need to be valid UTF-8.
/// * all safety requirements for [`Vec::<u8>::from_raw_parts`]
/// * all safety requirements for [`String::from_utf8_unchecked`]
///
/// Violating these may cause problems like corrupting the allocator's
/// internal data structures. For example, it is normally **not** safe to
Expand Down

0 comments on commit 65a5d8b

Please sign in to comment.