diff options
| author | bors <bors@rust-lang.org> | 2024-12-20 07:27:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-20 07:27:15 +0000 |
| commit | 8a1f8039a7ded79d3d4fe97b110016d89f2b11e2 (patch) | |
| tree | 5022f5c7ef7a02bbf580da393908b05294aa30c9 /library/alloc/src/vec/mod.rs | |
| parent | 5dfe648b45659db8dd0a673a806bba3df84aa3af (diff) | |
| parent | e6aea1afe920f0146699ff35e6a83e61b100d006 (diff) | |
Auto merge of #134550 - jhpratt:rollup-wsfmo59, r=jhpratt
Rollup of 6 pull requests Successful merges: - #126118 (docs: Mention `spare_capacity_mut()` in `Vec::set_len`) - #132830 (Rename `elem_offset` to `element_offset`) - #133103 (Pass FnAbi to find_mir_or_eval_fn) - #134321 (Hide `= _` as associated constant value inside impl blocks) - #134518 (fix typos in the example code in the doc comments of `Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`) - #134521 (Arbitrary self types v2: roll loop.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 5f4b85b58a9..55496005f40 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1824,7 +1824,10 @@ impl<T, A: Allocator> Vec<T, A> { /// /// # Examples /// - /// This method can be useful for situations in which the vector + /// See [`spare_capacity_mut()`] for an example with safe + /// initialization of capacity elements and use of this method. + /// + /// `set_len()` can be useful for situations in which the vector /// is serving as a buffer for other code, particularly over FFI: /// /// ```no_run @@ -1884,6 +1887,8 @@ impl<T, A: Allocator> Vec<T, A> { /// /// Normally, here, one would use [`clear`] instead to correctly drop /// the contents and thus not leak memory. + /// + /// [`spare_capacity_mut()`]: Vec::spare_capacity_mut #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn set_len(&mut self, new_len: usize) { |
