diff options
| author | blitzerr <rusty.blitzerr@gmail.com> | 2020-09-20 20:14:44 -0700 |
|---|---|---|
| committer | blitzerr <rusty.blitzerr@gmail.com> | 2020-09-21 16:43:36 -0700 |
| commit | d9d02fa168016b5b5b2033a2964a723f447f94b0 (patch) | |
| tree | e649c2f8137da4515a01a4e606d641f7765cd18f /library/std/src/alloc.rs | |
| parent | fb1dc34a831688f8eca89ea22ea2eb39e881d729 (diff) | |
| download | rust-d9d02fa168016b5b5b2033a2964a723f447f94b0.tar.gz rust-d9d02fa168016b5b5b2033a2964a723f447f94b0.zip | |
Changing the alloc() to accept &self instead of &mut self
Diffstat (limited to 'library/std/src/alloc.rs')
| -rw-r--r-- | library/std/src/alloc.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 770c97899f0..86ae4cf4dd2 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -133,7 +133,7 @@ pub struct System; impl System { #[inline] - fn alloc_impl(&mut self, layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocErr> { + fn alloc_impl(&self, layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocErr> { match layout.size() { 0 => Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)), // SAFETY: `layout` is non-zero in size, @@ -202,7 +202,7 @@ impl System { #[unstable(feature = "allocator_api", issue = "32838")] unsafe impl AllocRef for System { #[inline] - fn alloc(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { + fn alloc(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { self.alloc_impl(layout, false) } |
