diff options
| author | SabrinaJewson <sejewson@gmail.com> | 2025-08-11 19:02:00 +0100 |
|---|---|---|
| committer | SabrinaJewson <sejewson@gmail.com> | 2025-08-11 19:02:00 +0100 |
| commit | 45e2449b2af5cb8e96a60cddafe4b6a49568a937 (patch) | |
| tree | 4233bb1165250bc08c3b94b7511bb635cb4d7b30 /library | |
| parent | 19df24b3b8778d929bbef50bf64330defa1412bb (diff) | |
| download | rust-45e2449b2af5cb8e96a60cddafe4b6a49568a937.tar.gz rust-45e2449b2af5cb8e96a60cddafe4b6a49568a937.zip | |
Respond to review comments
Diffstat (limited to 'library')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 5258aaffd83..e02265dcafc 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -51,18 +51,18 @@ //! //! # Memory layout //! -//! For non-zero-sized values, a [`Vec`] will use the [`Global`] allocator for its allocation. It is +//! For non-zero-sized types, [`Vec`] uses the [`Global`] allocator for its allocation. It is //! valid to convert both ways between a [`Vec`] and a raw pointer allocated with the [`Global`] -//! allocator, given that the [`Layout`] used with the allocator is correct for a sequence of -//! `capacity` values of the type, and the first `len` values pointed to by the raw pointer are +//! allocator, provided that the [`Layout`] used with the allocator is correct for a sequence of +//! `capacity` elements of the type, and the first `len` values pointed to by the raw pointer are //! valid. More precisely, a `ptr: *mut T` that has been allocated with the [`Global`] allocator //! with [`Layout::array::<T>(capacity)`][Layout::array] may be converted into a vec using //! [`Vec::<T>::from_raw_parts(ptr, len, capacity)`](Vec::from_raw_parts). //! Conversely, the memory backing a `value: *mut T` obtained from [`Vec::<T>::as_mut_ptr`] may be //! deallocated using the [`Global`] allocator with the same layout. //! -//! For zero-sized values, the `Vec` pointer has to be non-null and sufficiently aligned. The -//! recommended way to build a `Vec` of ZSTs if [`vec!`] cannot be used is to use +//! For zero-sized types (ZSTs), the `Vec` pointer must be non-null and sufficiently aligned. +//! The recommended way to build a `Vec` of ZSTs if [`vec!`] cannot be used is to use //! [`ptr::NonNull::dangling`]. //! //! [`push`]: Vec::push |
