diff options
| author | Robert Bastian <4706271+robertbastian@users.noreply.github.com> | 2025-02-09 17:08:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-09 17:08:39 +0100 |
| commit | 65a5d8bf6c5caf5b7084cdc70ce184f3d505638d (patch) | |
| tree | 578a142be98d5e4ccbad76cf7331e9c2779239d5 /library/alloc/src | |
| parent | a26e97be8826d408309fffbd8168362365719f50 (diff) | |
| download | rust-65a5d8bf6c5caf5b7084cdc70ce184f3d505638d.tar.gz rust-65a5d8bf6c5caf5b7084cdc70ce184f3d505638d.zip | |
Update string.rs
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/string.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index b29f740ef0f..a222ce040a4 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -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 |
