File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 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() {
3434 }
3535}
3636
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
3742#[ test]
3843fn box_clone_from_ptr_stability ( ) {
3944 for size in ( 0 ..8 ) . map ( |i| 2usize . pow ( i) ) {
@@ -43,12 +48,4 @@ fn box_clone_from_ptr_stability() {
4348 copy. clone_from ( & control) ;
4449 assert_eq ! ( copy. as_ptr( ) as usize , copy_raw) ;
4550 }
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- }
5451}
You can’t perform that action at this time.
0 commit comments