File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -753,17 +753,18 @@ pub mod test {
753
753
fn hole_list_new_min_size ( ) {
754
754
// define an array of `u64` instead of `u8` for alignment
755
755
static mut HEAP : [ u64 ; 2 ] = [ 0 ; 2 ] ;
756
+ let heap_start = unsafe { HEAP . as_ptr ( ) as usize } ;
756
757
let heap =
757
758
unsafe { HoleList :: new ( HEAP . as_mut_ptr ( ) . cast ( ) , 2 * core:: mem:: size_of :: < usize > ( ) ) } ;
758
- assert_eq ! ( heap. bottom. cast ( ) , unsafe { HEAP . as_mut_ptr ( ) } ) ;
759
- assert_eq ! ( heap. top. cast ( ) , unsafe { HEAP . as_mut_ptr ( ) . add ( 2 ) } ) ;
759
+ assert_eq ! ( heap. bottom as usize , heap_start ) ;
760
+ assert_eq ! ( heap. top as usize , heap_start + 2 * size_of :: < usize > ( ) ) ;
760
761
assert_eq ! ( heap. first. size, 0 ) ; // dummy
761
762
assert_eq ! (
762
763
heap. first. next,
763
764
Some ( NonNull :: new( heap. bottom. cast( ) ) ) . unwrap( )
764
765
) ;
765
766
assert_eq ! (
766
- unsafe { & * ( heap. first. next. unwrap ( ) . as_ptr ( ) ) } . size,
767
+ unsafe { heap. first. next. as_ref ( ) . unwrap ( ) . as_ref ( ) } . size,
767
768
2 * core:: mem:: size_of:: <usize >( )
768
769
) ;
769
770
assert_eq ! ( unsafe { & * ( heap. first. next. unwrap( ) . as_ptr( ) ) } . next, None ) ;
Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ fn oddly_sized_heap_extension() {
532
532
#[ test]
533
533
fn extend_odd_size ( ) {
534
534
// define an array of `u64` instead of `u8` for alignment
535
- static mut HEAP : [ u64 ; 5 ] = [ 0 ; 5 ] ;
535
+ static mut HEAP : [ u64 ; 6 ] = [ 0 ; 6 ] ;
536
536
unsafe {
537
537
let mut heap = Heap :: new ( HEAP . as_mut_ptr ( ) . cast ( ) , 17 ) ;
538
538
assert_eq ! ( 1 , heap. holes. pending_extend) ;
You can’t perform that action at this time.
0 commit comments