Rollup merge of #72921 - pickfire:vec-assert, r=Mark-Simulacrum

Add assert to Vec with_capacity docs
This commit is contained in:
Dylan DPC 2020-06-03 02:39:09 +02:00 committed by GitHub
commit ba3d98250f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")]