File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ fn box_clone_and_clone_from_equivalence() {
34
34
}
35
35
}
36
36
37
+ /// This test might give a false positive in case the box realocates, but the alocator keeps the
38
+ /// original pointer.
39
+ ///
40
+ /// On the other hand it won't give a false negative, if it fails than the memory was definitly not
41
+ /// reused
37
42
#[ test]
38
43
fn box_clone_from_ptr_stability ( ) {
39
44
for size in ( 0 ..8 ) . map ( |i| 2usize . pow ( i) ) {
@@ -43,12 +48,4 @@ fn box_clone_from_ptr_stability() {
43
48
copy. clone_from ( & control) ;
44
49
assert_eq ! ( copy. as_ptr( ) as usize , copy_raw) ;
45
50
}
46
-
47
- for size in ( 0 ..8 ) . map ( |i| 2usize . pow ( i) ) {
48
- let control = vec ! [ Dummy { _data: 42 } ; size] . into_boxed_slice ( ) ;
49
- let mut copy = vec ! [ Dummy { _data: 84 } ; size + 1 ] . into_boxed_slice ( ) ;
50
- let copy_raw = copy. as_ptr ( ) as usize ;
51
- copy. clone_from ( & control) ;
52
- assert_ne ! ( copy. as_ptr( ) as usize , copy_raw) ;
53
- }
54
51
}
You can’t perform that action at this time.
0 commit comments