@@ -637,7 +637,7 @@ pub unsafe trait Allocator {
637
637
/// Captures a common usage pattern for allocators.
638
638
unsafe fn dealloc_one < T > ( & mut self , mut ptr : Unique < T > )
639
639
where Self : Sized {
640
- let raw_ptr = ptr. get_mut ( ) as * mut T as * mut u8 ;
640
+ let raw_ptr = ptr. as_mut ( ) as * mut T as * mut u8 ;
641
641
self . dealloc ( raw_ptr, Layout :: new :: < T > ( ) ) ;
642
642
}
643
643
@@ -682,7 +682,9 @@ pub unsafe trait Allocator {
682
682
n_old : usize ,
683
683
n_new : usize ) -> Result < Unique < T > , AllocErr >
684
684
where Self : Sized {
685
- match ( Layout :: array :: < T > ( n_old) , Layout :: array :: < T > ( n_new) , * ptr) {
685
+ match ( Layout :: array :: < T > ( n_old)
686
+ , Layout :: array :: < T > ( n_new)
687
+ , ptr. as_ptr ( ) ) {
686
688
( Some ( ref k_old) , Some ( ref k_new) , ptr) if k_old. size ( ) > 0 && k_new. size ( ) > 0 => {
687
689
self . realloc ( ptr as * mut u8 , k_old. clone ( ) , k_new. clone ( ) )
688
690
. map ( |p|Unique :: new ( p as * mut T ) )
@@ -698,7 +700,7 @@ pub unsafe trait Allocator {
698
700
/// Captures a common usage pattern for allocators.
699
701
unsafe fn dealloc_array < T > ( & mut self , ptr : Unique < T > , n : usize ) -> Result < ( ) , AllocErr >
700
702
where Self : Sized {
701
- let raw_ptr = * ptr as * mut u8 ;
703
+ let raw_ptr = ptr. as_ptr ( ) as * mut u8 ;
702
704
match Layout :: array :: < T > ( n) {
703
705
Some ( ref k) if k. size ( ) > 0 => {
704
706
Ok ( self . dealloc ( raw_ptr, k. clone ( ) ) )
@@ -804,9 +806,9 @@ pub unsafe trait Allocator {
804
806
n_old : usize ,
805
807
n_new : usize ) -> Option < Unique < T > >
806
808
where Self : Sized {
807
- let ( k_old, k_new, ptr) = ( Layout :: array_unchecked :: < T > ( n_old) ,
808
- Layout :: array_unchecked :: < T > ( n_new) ,
809
- * ptr) ;
809
+ let ( k_old, k_new, ptr) = ( Layout :: array_unchecked :: < T > ( n_old)
810
+ , Layout :: array_unchecked :: < T > ( n_new)
811
+ , ptr. as_ptr ( ) ) ;
810
812
self . realloc_unchecked ( ptr as * mut u8 , k_old, k_new)
811
813
. map ( |p|Unique :: new ( * p as * mut T ) )
812
814
}
@@ -821,7 +823,7 @@ pub unsafe trait Allocator {
821
823
unsafe fn dealloc_array_unchecked < T > ( & mut self , ptr : Unique < T > , n : usize )
822
824
where Self : Sized {
823
825
let layout = Layout :: array_unchecked :: < T > ( n) ;
824
- self . dealloc ( * ptr as * mut u8 , layout) ;
826
+ self . dealloc ( ptr. as_ptr ( ) as * mut u8 , layout) ;
825
827
}
826
828
}
827
829
0 commit comments