Skip to content

Commit

Permalink
Rollup merge of rust-lang#56713 - xfix:vec-test-zst-capacity, r=TimNN
Browse files Browse the repository at this point in the history
Test capacity of ZST vector

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
pietroalbini committed Dec 12, 2018
2 parents a7bfe8a + 1006425 commit 6911f20
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 6911f20

Please sign in to comment.