diff options
| author | blitzerr <rusty.blitzerr@gmail.com> | 2020-09-22 06:22:02 -0700 |
|---|---|---|
| committer | blitzerr <rusty.blitzerr@gmail.com> | 2020-09-22 06:22:02 -0700 |
| commit | 3ffd403c6b97f181c189a8eb5fbd30e3e7a95b43 (patch) | |
| tree | 23200238b60848d20c1e78f486c97fdbcce997ff /library/core/src/alloc/mod.rs | |
| parent | 219003bd2ee6778333cf92405c6ea8591ecc8816 (diff) | |
| download | rust-3ffd403c6b97f181c189a8eb5fbd30e3e7a95b43.tar.gz rust-3ffd403c6b97f181c189a8eb5fbd30e3e7a95b43.zip | |
removing &mut self for other methods of AllocRef
Diffstat (limited to 'library/core/src/alloc/mod.rs')
| -rw-r--r-- | library/core/src/alloc/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index b7dd249d093..5f9092fe703 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -126,7 +126,7 @@ pub unsafe trait AllocRef { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html - fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { + fn alloc_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { let ptr = self.alloc(layout)?; // SAFETY: `alloc` returns a valid memory block unsafe { ptr.as_non_null_ptr().as_ptr().write_bytes(0, ptr.len()) } @@ -142,7 +142,7 @@ pub unsafe trait AllocRef { /// /// [*currently allocated*]: #currently-allocated-memory /// [*fit*]: #memory-fitting - unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout); + unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout); /// Attempts to extend the memory block. /// @@ -353,12 +353,12 @@ where } #[inline] - fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { + fn alloc_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { (**self).alloc_zeroed(layout) } #[inline] - unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout) { + unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout) { // SAFETY: the safety contract must be upheld by the caller unsafe { (**self).dealloc(ptr, layout) } } |
