1
Fork 0

Clarify contiguity of Vec's elements.

This commit is contained in:
Sergio Benitez 2018-02-16 17:05:49 -08:00
parent 58a8e0c271
commit 22aecb9c6e

View file

@ -231,9 +231,9 @@ use Bound::{Excluded, Included, Unbounded};
/// ///
/// If a `Vec` *has* allocated memory, then the memory it points to is on the heap /// If a `Vec` *has* allocated memory, then the memory it points to is on the heap
/// (as defined by the allocator Rust is configured to use by default), and its /// (as defined by the allocator Rust is configured to use by default), and its
/// pointer points to [`len`] initialized elements in order (what you would see /// pointer points to [`len`] initialized, contiguous elements in order (what
/// if you coerced it to a slice), followed by [`capacity`]` - `[`len`] /// you would see if you coerced it to a slice), followed by [`capacity`]` -
/// logically uninitialized elements. /// `[`len`] logically uninitialized, contiguous elements.
/// ///
/// `Vec` will never perform a "small optimization" where elements are actually /// `Vec` will never perform a "small optimization" where elements are actually
/// stored on the stack for two reasons: /// stored on the stack for two reasons:
@ -281,8 +281,8 @@ use Bound::{Excluded, Included, Unbounded};
/// not break, however: using `unsafe` code to write to the excess capacity, /// not break, however: using `unsafe` code to write to the excess capacity,
/// and then increasing the length to match, is always valid. /// and then increasing the length to match, is always valid.
/// ///
/// `Vec` does not currently guarantee the order in which elements are dropped /// `Vec` does not currently guarantee the order in which elements are dropped.
/// (the order has changed in the past, and may change again). /// The order has changed in the past and may change again.
/// ///
/// [`vec!`]: ../../std/macro.vec.html /// [`vec!`]: ../../std/macro.vec.html
/// [`Index`]: ../../std/ops/trait.Index.html /// [`Index`]: ../../std/ops/trait.Index.html