diff options
| author | bors <bors@rust-lang.org> | 2025-02-25 05:41:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-25 05:41:34 +0000 |
| commit | ad27045c31a9f37ad7d44ca2a403de52d1a896d3 (patch) | |
| tree | 6c7e874e179133af18c4b8a1998ecf9b44a02d6c /library/alloc/src/string.rs | |
| parent | f5729cfed3c45e061e8a443677fc1d5ef9277df7 (diff) | |
| parent | 91dc3eed50e2ac5c22c80c3c5129f0dbc818c67c (diff) | |
| download | rust-ad27045c31a9f37ad7d44ca2a403de52d1a896d3.tar.gz rust-ad27045c31a9f37ad7d44ca2a403de52d1a896d3.zip | |
Auto merge of #137571 - tgross35:rollup-i1tcnv1, r=tgross35
Rollup of 8 pull requests Successful merges: - #134655 (Stabilize `hash_extract_if`) - #135933 (Explain how Vec::with_capacity is faithful) - #136668 (Stabilize `core::str::from_utf8_mut` as `const`) - #136775 (Update `String::from_raw_parts` safety requirements) - #137109 (stabilize extract_if) - #137349 (Implement `read_buf` for zkVM stdin) - #137493 (configure.py: don't instruct user to run nonexistent program) - #137516 (remove some unnecessary rustc_const_unstable) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc/src/string.rs')
| -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 9446afd4b24..f10ef1fca13 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 |
