Skip to content

Commit

Permalink
Remove flaky test and document the other's flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
mendess committed May 29, 2020
1 parent 32eedad commit dbf32e2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/liballoc/tests/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
}

0 comments on commit dbf32e2

Please sign in to comment.