From 18877f243a6c131be4f16ecf7594f7fc6471db56 Mon Sep 17 00:00:00 2001 From: bluss Date: Tue, 23 Mar 2021 17:21:35 +0100 Subject: [PATCH] TEST: Fix size assertion test for const gen With const generics we can't avoid the usize (or other type) length field. --- tests/tests.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/tests.rs b/tests/tests.rs index d1bae4f..46fb575 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -273,21 +273,20 @@ fn test_is_send_sync() { #[test] fn test_compact_size() { - // Future rust will kill these drop flags! - // 4 elements size + 1 len + 1 enum tag + [1 drop flag] + // 4 bytes + padding + length type ByteArray = ArrayVec; println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 8); + assert!(mem::size_of::() <= 2 * mem::size_of::()); - // 1 enum tag + 1 drop flag + // just length type EmptyArray = ArrayVec; println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 2); + assert!(mem::size_of::() <= mem::size_of::()); - // 12 element size + 1 enum tag + 3 padding + 1 len + 1 drop flag + 2 padding + // 3 elements + padding + length type QuadArray = ArrayVec; println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 24); + assert!(mem::size_of::() <= 4 * 4 + mem::size_of::()); } #[test]