about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorIvan Tham <pickfire@riseup.net>2020-06-03 01:29:02 +0800
committerIvan Tham <pickfire@riseup.net>2020-06-03 01:29:02 +0800
commit596b0c88cc1f496c3a50a5eb0250aed443495609 (patch)
tree534d32c1c0f60036412b9fa2c6ef964192fe3fd3 /src/liballoc
parenteeaf497b2a6bc065874e3d3367b1f3023c5bb3d3 (diff)
downloadrust-596b0c88cc1f496c3a50a5eb0250aed443495609.tar.gz
rust-596b0c88cc1f496c3a50a5eb0250aed443495609.zip
Add assert to Vec with_capacity docs
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 42fb1f8c737..22d43468771 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -348,9 +348,11 @@ impl<T> Vec<T> {
     /// for i in 0..10 {
     ///     vec.push(i);
     /// }
+    /// assert_eq!(vec.capacity(), 10);
     ///
     /// // ...but this may make the vector reallocate
     /// vec.push(11);
+    /// assert!(vec.capacity() >= 11);
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]