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