Skip to content

Commit 6e2fcbd

Browse files
committed
the behavior of Vec::shrink_to_fit is allocator dependent
1 parent 3f9e3fd commit 6e2fcbd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/liballoc/vec.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,10 @@ impl<T> Vec<T> {
574574
/// It will drop down as close as possible to the length but the allocator
575575
/// may still inform the vector that there is space for a few more elements.
576576
///
577+
/// Note: `shrink_to_fit` is a non-binding request. Whether the `Vec` size
578+
/// will be shrunk at all, and if so by how much depends on the particular
579+
/// allocator being used.
580+
///
577581
/// # Examples
578582
///
579583
/// ```
@@ -598,6 +602,10 @@ impl<T> Vec<T> {
598602
/// Panics if the current capacity is smaller than the supplied
599603
/// minimum capacity.
600604
///
605+
/// Note: `shrink_to` is a non-binding request. Whether the `Vec` size
606+
/// will be shrunk at all, and if so by how much depends on the particular
607+
/// allocator being used.
608+
///
601609
/// # Examples
602610
///
603611
/// ```

0 commit comments

Comments
 (0)