about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-06-03 02:39:09 +0200
committerGitHub <noreply@github.com>2020-06-03 02:39:09 +0200
commitba3d98250f886279e204f6e650666df6818777e2 (patch)
tree200cca83afffab0ecf5dc1427de7b8169069ad7f /src/liballoc/vec.rs
parent0050b8817b56484a82a0f78bf4d5e9b7011b75af (diff)
parent596b0c88cc1f496c3a50a5eb0250aed443495609 (diff)
downloadrust-ba3d98250f886279e204f6e650666df6818777e2.tar.gz
rust-ba3d98250f886279e204f6e650666df6818777e2.zip
Rollup merge of #72921 - pickfire:vec-assert, r=Mark-Simulacrum
Add assert to Vec with_capacity docs
Diffstat (limited to 'src/liballoc/vec.rs')
-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")]