@@ -126,7 +126,7 @@ pub unsafe trait AllocRef {
126
126
/// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar.
127
127
///
128
128
/// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
129
- fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
129
+ fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
130
130
let ptr = self . alloc ( layout) ?;
131
131
// SAFETY: `alloc` returns a valid memory block
132
132
unsafe { ptr. as_non_null_ptr ( ) . as_ptr ( ) . write_bytes ( 0 , ptr. len ( ) ) }
@@ -142,7 +142,7 @@ pub unsafe trait AllocRef {
142
142
///
143
143
/// [*currently allocated*]: #currently-allocated-memory
144
144
/// [*fit*]: #memory-fitting
145
- unsafe fn dealloc ( & mut self , ptr : NonNull < u8 > , layout : Layout ) ;
145
+ unsafe fn dealloc ( & self , ptr : NonNull < u8 > , layout : Layout ) ;
146
146
147
147
/// Attempts to extend the memory block.
148
148
///
@@ -353,12 +353,12 @@ where
353
353
}
354
354
355
355
#[ inline]
356
- fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
356
+ fn alloc_zeroed ( & self , layout : Layout ) -> Result < NonNull < [ u8 ] > , AllocErr > {
357
357
( * * self ) . alloc_zeroed ( layout)
358
358
}
359
359
360
360
#[ inline]
361
- unsafe fn dealloc ( & mut self , ptr : NonNull < u8 > , layout : Layout ) {
361
+ unsafe fn dealloc ( & self , ptr : NonNull < u8 > , layout : Layout ) {
362
362
// SAFETY: the safety contract must be upheld by the caller
363
363
unsafe { ( * * self ) . dealloc ( ptr, layout) }
364
364
}
0 commit comments