From f0ec3e13986d975904cc9a3cb85b8e0a7a657a00 Mon Sep 17 00:00:00 2001 From: bluss Date: Sun, 16 Dec 2018 10:46:38 +0100 Subject: [PATCH] TEST: Add test that ensures the MaybeUninit impl is used on nightly --- .travis.yml | 3 +++ tests/tests.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3ff361e..3730670 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,13 +19,16 @@ matrix: - rust: nightly env: - NODEFAULT=1 + - ARRAYVECTEST_ENSURE_UNION=1 - rust: nightly env: - NODROP_FEATURES='use_needs_drop' + - ARRAYVECTEST_ENSURE_UNION=1 - rust: nightly env: - FEATURES='serde use_union' - NODROP_FEATURES='use_union' + - ARRAYVECTEST_ENSURE_UNION=1 branches: only: - master diff --git a/tests/tests.rs b/tests/tests.rs index 5a21829..0e69467 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -508,3 +508,12 @@ fn test_sizes_129_255() { ArrayVec::from([0u8; 255]); } + +#[test] +fn test_nightly_uses_maybe_uninit() { + if option_env!("ARRAYVECTEST_ENSURE_UNION").map(|s| !s.is_empty()).unwrap_or(false) { + assert!(cfg!(has_manually_drop_in_union)); + type ByteArray = ArrayVec<[u8; 4]>; + assert!(mem::size_of::() == 5); + } +}