Skip to content

Commit

Permalink
Test capacity of ZST vector
Browse files Browse the repository at this point in the history
Initially, rust-lang#50233 accidentally changed the capacity of empty ZST. This
was pointed out during code review. This commit adds a test to prevent
capacity of ZST vectors from accidentally changing to prevent that
from happening again.
  • Loading branch information
KamilaBorowska committed Dec 11, 2018
1 parent 128a1fa commit 1006425
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/liballoc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ fn test_reserve() {
assert!(v.capacity() >= 33)
}

#[test]
fn test_zst_capacity() {
assert_eq!(Vec::<()>::new().capacity(), usize::max_value());
}

#[test]
fn test_extend() {
let mut v = Vec::new();
Expand Down

0 comments on commit 1006425

Please sign in to comment.