diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-12-15 14:47:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-15 14:47:39 +0100 |
| commit | eed969361658be1651e76be6880b5688d1a5455d (patch) | |
| tree | 56008af6d9af8d2beb946912560ad5254c674ffe /src/liballoc | |
| parent | 8d9dc2b74931a30ad3ee4be09e065468afc9a566 (diff) | |
| parent | 1006425769ada70d0f394ccdab3caecaf6fa3e77 (diff) | |
| download | rust-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.rs | 5 |
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(); |
