about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-12-15 14:47:39 +0100
committerGitHub <noreply@github.com>2018-12-15 14:47:39 +0100
commiteed969361658be1651e76be6880b5688d1a5455d (patch)
tree56008af6d9af8d2beb946912560ad5254c674ffe /src/liballoc
parent8d9dc2b74931a30ad3ee4be09e065468afc9a566 (diff)
parent1006425769ada70d0f394ccdab3caecaf6fa3e77 (diff)
downloadrust-eed969361658be1651e76be6880b5688d1a5455d.tar.gz
rust-eed969361658be1651e76be6880b5688d1a5455d.zip
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.
Diffstat (limited to 'src/liballoc')
-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();