@@ -358,7 +358,7 @@ mod spec_extend;
358358///
359359/// `vec![x; n]`, `vec![a, b, c, d]`, and
360360/// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
361- /// with exactly the requested capacity. If <code>[len] == [capacity]</code>,
361+ /// with at least the requested capacity. If <code>[len] == [capacity]</code>,
362362/// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
363363/// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
364364///
@@ -1023,8 +1023,11 @@ impl<T, A: Allocator> Vec<T, A> {
10231023
10241024 /// Shrinks the capacity of the vector as much as possible.
10251025 ///
1026- /// It will drop down as close as possible to the length but the allocator
1027- /// may still inform the vector that there is space for a few more elements.
1026+ /// The behavior of this method depends on the allocator, which may either shrink the vector
1027+ /// in-place or reallocate. The resulting vector might still have some excess capacity, just as
1028+ /// is the case for [`with_capacity`]. See [`Allocator::shrink`] for more details.
1029+ ///
1030+ /// [`with_capacity`]: Vec::with_capacity
10281031 ///
10291032 /// # Examples
10301033 ///
@@ -1074,10 +1077,10 @@ impl<T, A: Allocator> Vec<T, A> {
10741077
10751078 /// Converts the vector into [`Box<[T]>`][owned slice].
10761079 ///
1077- /// If the vector has excess capacity, its items will be moved into a
1078- /// newly-allocated buffer with exactly the right capacity.
1080+ /// Before doing the conversion, this method discards excess capacity like [`shrink_to_fit`].
10791081 ///
10801082 /// [owned slice]: Box
1083+ /// [`shrink_to_fit`]: Vec::shrink_to_fit
10811084 ///
10821085 /// # Examples
10831086 ///
@@ -3290,8 +3293,10 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
32903293impl < T , A : Allocator > From < Vec < T , A > > for Box < [ T ] , A > {
32913294 /// Convert a vector into a boxed slice.
32923295 ///
3293- /// If `v` has excess capacity, its items will be moved into a
3294- /// newly-allocated buffer with exactly the right capacity.
3296+ /// Before doing the conversion, this method discards excess capacity like [`Vec::shrink_to_fit`].
3297+ ///
3298+ /// [owned slice]: Box
3299+ /// [`Vec::shrink_to_fit`]: Vec::shrink_to_fit
32953300 ///
32963301 /// # Examples
32973302 ///
0 commit comments