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/vec/mod.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/vec/mod.rs')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index cbb5b0627b7..3dc8a4fbba8 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -489,8 +489,10 @@ impl<T> Vec<T> { /// * `length` needs to be less than or equal to `capacity`. /// /// Violating these may cause problems like corrupting the allocator's - /// internal data structures. For example it is **not** safe - /// to build a `Vec<u8>` from a pointer to a C `char` array with length `size_t`. + /// internal data structures. For example it is normally **not** safe + /// to build a `Vec<u8>` from a pointer to a C `char` array with length + /// `size_t`, doing so is only safe if the array was initially allocated by + /// a `Vec` or `String`. /// It's also not safe to build one from a `Vec<u16>` and its length, because /// the allocator cares about the alignment, and these two types have different /// alignments. The buffer was allocated with alignment 2 (for `u16`), but after |
