about summary refs log tree commit diff
path: root/src/liballoc/tests/vec.rs
diff options
context:
space:
mode:
authorKonrad Borowski <konrad@borowski.pw>2018-12-11 15:07:07 +0100
committerKonrad Borowski <konrad@borowski.pw>2018-12-11 15:07:09 +0100
commit1006425769ada70d0f394ccdab3caecaf6fa3e77 (patch)
tree096c2d8623b476c2d7100942846d1fb2a34466e0 /src/liballoc/tests/vec.rs
parent128a1fa4e1f85e04f522653bb9bee83ed6523440 (diff)
downloadrust-1006425769ada70d0f394ccdab3caecaf6fa3e77.tar.gz
rust-1006425769ada70d0f394ccdab3caecaf6fa3e77.zip
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.
Diffstat (limited to 'src/liballoc/tests/vec.rs')
-rw-r--r--src/liballoc/tests/vec.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs
index e329b45a617..509195cd047 100644
--- a/src/liballoc/tests/vec.rs
+++ b/src/liballoc/tests/vec.rs
@@ -80,6 +80,11 @@ fn test_reserve() {
 }
 
 #[test]
+fn test_zst_capacity() {
+    assert_eq!(Vec::<()>::new().capacity(), usize::max_value());
+}
+
+#[test]
 fn test_extend() {
     let mut v = Vec::new();
     let mut w = Vec::new();