Skip to content

Commit f0ec3e1

Browse files
committed
TEST: Add test that ensures the MaybeUninit impl is used on nightly
1 parent d395a01 commit f0ec3e1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ matrix:
1919
- rust: nightly
2020
env:
2121
- NODEFAULT=1
22+
- ARRAYVECTEST_ENSURE_UNION=1
2223
- rust: nightly
2324
env:
2425
- NODROP_FEATURES='use_needs_drop'
26+
- ARRAYVECTEST_ENSURE_UNION=1
2527
- rust: nightly
2628
env:
2729
- FEATURES='serde use_union'
2830
- NODROP_FEATURES='use_union'
31+
- ARRAYVECTEST_ENSURE_UNION=1
2932
branches:
3033
only:
3134
- master

tests/tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,12 @@ fn test_sizes_129_255() {
508508
ArrayVec::from([0u8; 255]);
509509
}
510510

511+
512+
#[test]
513+
fn test_nightly_uses_maybe_uninit() {
514+
if option_env!("ARRAYVECTEST_ENSURE_UNION").map(|s| !s.is_empty()).unwrap_or(false) {
515+
assert!(cfg!(has_manually_drop_in_union));
516+
type ByteArray = ArrayVec<[u8; 4]>;
517+
assert!(mem::size_of::<ByteArray>() == 5);
518+
}
519+
}

0 commit comments

Comments
 (0)