Remove flaky test and document the other's flakiness

This commit is contained in:
mendess 2020-05-29 11:18:15 +01:00
parent 32eedadee1
commit dbf32e2270

View file

@ -34,6 +34,11 @@ fn box_clone_and_clone_from_equivalence() {
}
}
/// This test might give a false positive in case the box realocates, but the alocator keeps the
/// original pointer.
///
/// On the other hand it won't give a false negative, if it fails than the memory was definitly not
/// reused
#[test]
fn box_clone_from_ptr_stability() {
for size in (0..8).map(|i| 2usize.pow(i)) {
@ -43,12 +48,4 @@ fn box_clone_from_ptr_stability() {
copy.clone_from(&control);
assert_eq!(copy.as_ptr() as usize, copy_raw);
}
for size in (0..8).map(|i| 2usize.pow(i)) {
let control = vec![Dummy { _data: 42 }; size].into_boxed_slice();
let mut copy = vec![Dummy { _data: 84 }; size + 1].into_boxed_slice();
let copy_raw = copy.as_ptr() as usize;
copy.clone_from(&control);
assert_ne!(copy.as_ptr() as usize, copy_raw);
}
}