Rollup merge of #56713 - xfix:vec-test-zst-capacity, r=TimNN

Test capacity of ZST vector

Initially, #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.
This commit is contained in:
Pietro Albini 2018-12-15 14:47:39 +01:00 committed by GitHub
commit eed9693616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,6 +79,11 @@ fn test_reserve() {
assert!(v.capacity() >= 33) assert!(v.capacity() >= 33)
} }
#[test]
fn test_zst_capacity() {
assert_eq!(Vec::<()>::new().capacity(), usize::max_value());
}
#[test] #[test]
fn test_extend() { fn test_extend() {
let mut v = Vec::new(); let mut v = Vec::new();