diff options
| author | mendess <pedro.mendes.26@gmail.com> | 2020-05-29 11:18:15 +0100 |
|---|---|---|
| committer | mendess <pedro.mendes.26@gmail.com> | 2020-05-29 11:24:26 +0100 |
| commit | dbf32e2270f82601bd2816da270ce70269cc59ba (patch) | |
| tree | d78a260248a0e64460de03d44dc5cb92514391d6 /src/liballoc | |
| parent | 32eedadee1ed3273a318fa109c5261482e518578 (diff) | |
| download | rust-dbf32e2270f82601bd2816da270ce70269cc59ba.tar.gz rust-dbf32e2270f82601bd2816da270ce70269cc59ba.zip | |
Remove flaky test and document the other's flakiness
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/tests/boxed.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/liballoc/tests/boxed.rs b/src/liballoc/tests/boxed.rs index c0b8fa66561..5377485da8f 100644 --- a/src/liballoc/tests/boxed.rs +++ b/src/liballoc/tests/boxed.rs @@ -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); - } } |
