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 authored Dec 15, 2018
2 parents 8d9dc2b + 1006425 commit eed9693
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 eed9693

Please sign in to comment.