diff options
| author | mandeep <mandeep@users.noreply.github.com> | 2018-10-05 18:22:19 -0400 |
|---|---|---|
| committer | mandeep <mandeep@users.noreply.github.com> | 2018-10-05 18:22:19 -0400 |
| commit | 82444aa753180c9c13028066ae9ddc4933dc610d (patch) | |
| tree | e168f9e433875c21937552cd07ecbdb1994e8433 /src/liballoc | |
| parent | 2155f27b640c14d2f518a4585f7419ab9a334374 (diff) | |
| download | rust-82444aa753180c9c13028066ae9ddc4933dc610d.tar.gz rust-82444aa753180c9c13028066ae9ddc4933dc610d.zip | |
Add doc comments about safest way to initialize a vector of zeros
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 2bc037e3fee..3188de51266 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -120,7 +120,9 @@ use raw_vec::RawVec; /// assert_eq!(vec, [1, 2, 3, 4]); /// ``` /// -/// It can also initialize each element of a `Vec<T>` with a given value: +/// It can also initialize each element of a `Vec<T>` with a given value. +/// Initializing a `Vec<T>` in this manner is the most efficient and safest way to allocate a +/// vector of zeros as previously zeroed memory is requested from the operating system: /// /// ``` /// let vec = vec![0; 5]; |
