Skip to content

Commit 1070231

Browse files
committed
Update vec.rs
improve the 'Unsafety' section of `collections::vec::Vec::<T>::from_raw_parts`.
1 parent e4e9319 commit 1070231

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libcollections/vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ impl<T> Vec<T> {
231231
///
232232
/// * `ptr` needs to have been previously allocated via `String`/`Vec<T>`
233233
/// (at least, it's highly likely to be incorrect if it wasn't).
234+
/// * `length` needs to be the length that less than or equal to `capacity`.
234235
/// * `capacity` needs to be the capacity that the pointer was allocated with.
235236
///
236237
/// Violating these may cause problems like corrupting the allocator's

0 commit comments

Comments
 (0)