Skip to content

Commit

Permalink
Rollup merge of #72921 - pickfire:vec-assert, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Add assert to Vec with_capacity docs
  • Loading branch information
Dylan-DPC authored Jun 3, 2020
2 parents 0050b88 + 596b0c8 commit ba3d982
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit ba3d982

Please sign in to comment.