diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2018-04-03 17:51:03 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-04-12 22:53:03 +0200 |
| commit | eb69593f73be1e41d9e2ef065010a47478c14924 (patch) | |
| tree | 993962e4a31a1616f969ea4118ed77ba57e51347 /src/libcore/alloc.rs | |
| parent | ba7081a033de4981ccad1e1525c8b5191ce02208 (diff) | |
| download | rust-eb69593f73be1e41d9e2ef065010a47478c14924.tar.gz rust-eb69593f73be1e41d9e2ef065010a47478c14924.zip | |
Implement GlobalAlloc for System
Diffstat (limited to 'src/libcore/alloc.rs')
| -rw-r--r-- | src/libcore/alloc.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index b6626ff9f26..1c764dab000 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -381,6 +381,10 @@ pub unsafe trait GlobalAlloc { ptr } + /// # Safety + /// + /// `new_size`, when rounded up to the nearest multiple of `old_layout.align()`, + /// must not overflow (i.e. the rounded value must be less than `usize::MAX`). unsafe fn realloc(&self, ptr: *mut Void, old_layout: Layout, new_size: usize) -> *mut Void { let new_layout = Layout::from_size_align_unchecked(new_size, old_layout.align()); let new_ptr = self.alloc(new_layout); |
