Merge branch '0.4' of https://github.com/bluss/arrayvec into merge-0.4

* '0.4' of https://github.com/bluss/arrayvec:
  0.4.9
  TEST: Add test that ensures the MaybeUninit impl is used on nightly
  FIX: Remove use of uninitialized in ArrayString
  FEAT: Implement a "MaybeUninit" and use it conditionally
  TEST: Add test that Some(ArrayVec<[&_;_]>).is_some()
  MAINT: Test the 0.4 branch in travis
This commit is contained in:
bluss
2018-12-16 18:09:20 +01:00
9 changed files with 234 additions and 31 deletions
+17
View File
@@ -281,6 +281,14 @@ fn test_compact_size() {
assert!(mem::size_of::<QuadArray>() <= 24);
}
#[test]
fn test_still_works_with_option_arrayvec() {
type RefArray = ArrayVec<[&'static i32; 2]>;
let array = Some(RefArray::new());
assert!(array.is_some());
println!("{:?}", array);
}
#[test]
fn test_drain() {
let mut v = ArrayVec::from([0; 8]);
@@ -617,3 +625,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::<ByteArray>() == 5);
}
}