Skip to content

Commit e4e82da

Browse files
authored
Rollup merge of rust-lang#56713 - xfix:vec-test-zst-capacity, r=TimNN
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.
2 parents 3aa2356 + 1006425 commit e4e82da

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/liballoc/tests/vec.rs

+5
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ fn test_reserve() {
7979
assert!(v.capacity() >= 33)
8080
}
8181

82+
#[test]
83+
fn test_zst_capacity() {
84+
assert_eq!(Vec::<()>::new().capacity(), usize::max_value());
85+
}
86+
8287
#[test]
8388
fn test_extend() {
8489
let mut v = Vec::new();

0 commit comments

Comments
 (0)