Update vec.rs

improve the 'Unsafety' section of `collections::vec::Vec::<T>::from_raw_parts`.
This commit is contained in:
Wei-Ming Yang
2015-07-17 15:47:14 +08:00
parent e4e93196e1
commit 1070231987
+1
View File
@@ -231,6 +231,7 @@ pub fn with_capacity(capacity: usize) -> Vec<T> {
///
/// * `ptr` needs to have been previously allocated via `String`/`Vec<T>`
/// (at least, it's highly likely to be incorrect if it wasn't).
/// * `length` needs to be the length that less than or equal to `capacity`.
/// * `capacity` needs to be the capacity that the pointer was allocated with.
///
/// Violating these may cause problems like corrupting the allocator's