diff options
| author | bors <bors@rust-lang.org> | 2022-05-02 03:28:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-02 03:28:14 +0000 |
| commit | f6cbc92e2a91cd6018a999ce99a0e4af924c5b59 (patch) | |
| tree | 387ed9ada4682c675a04a40e59584d3608148523 /library/alloc/src/string.rs | |
| parent | 4c5efea6fed6fdb30ffcbb49325c76e2856ac01d (diff) | |
| parent | 5750e3305536fa961f846cb63b2600068f707d69 (diff) | |
Auto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #94126 (Classify BinaryHeap & LinkedList unit tests as such) - #96222 (Clarify docs for `from_raw_parts` on `Vec` and `String`) - #96499 (Make it possible to write doctests for bootstrap) - #96567 (Fix docs for u32 and i32 logs func) - #96568 (std::fmt: Various fixes and improvements to documentation) - #96571 (Add a bathroom stall to weird expressions test) - #96610 (Update browser-ui-test version to 0.9.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc/src/string.rs')
| -rw-r--r-- | library/alloc/src/string.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index e97c1637fd5..2272c5b7330 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -770,7 +770,10 @@ impl String { /// * The first `length` bytes at `buf` need to be valid UTF-8. /// /// Violating these may cause problems like corrupting the allocator's - /// internal data structures. + /// internal data structures. For example, it is normally **not** safe to + /// build a `String` from a pointer to a C `char` array containing UTF-8 + /// _unless_ you are certain that array was originally allocated by the + /// Rust standard library's allocator. /// /// The ownership of `buf` is effectively transferred to the /// `String` which may then deallocate, reallocate or change the |
