about summary refs log tree commit diff
path: root/src/libcore/alloc.rs
AgeCommit message (Collapse)AuthorLines
2020-03-26Overhaul of the `AllocRef` trait to match allocator-wg's latest consensTim Diekmann-1043/+0
2020-03-22Auto merge of #69079 - CAD97:layout-of-ptr, r=RalfJungbors-0/+36
Allow calculating the layout behind a pointer There was some discussion around allowing this previously. This does make the requirement for raw pointers to have valid metadata exposed as part of the std API (as a safety invariant, not validity invariant), though I think this is not strictly necessarily required as of current. cc @rust-lang/wg-unsafe-code-guidelines Naming is hard; I picked the best "obvious" name I could come up with. If it's agreed that this is actually a desired API surface, I'll file a tracking issue and update the attributes.
2020-03-21Allow calculating the layout behind a pointerCAD97-0/+36
Let align/size_of_of_val intrinsics work on ptrs
2020-03-08Allow ZSTs in `AllocRef`Tim Diekmann-43/+13
2020-03-07Update alloc.rsTim Diekmann-2/+2
2020-03-07Add `Layout::dangling()` to return a well-aligned `NonNull<u8>`Tim Diekmann-0/+12
2020-03-03Remove `usable_size` APIsTim Diekmann-224/+80
2020-02-12Rollup merge of #69027 - TimDiekmann:zeroed-alloc, r=AmanieuYuki Okushi-0/+137
Add missing `_zeroed` varants to `AllocRef` The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`: > these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed. > > If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents. For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/14. This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`. r? @Amanieu
2020-02-10Add missing `_zeroed` varants to `AllocRef`Tim Diekmann-0/+137
2020-02-10Remove common usage pattern from `AllocRef`Tim Diekmann-199/+2
2020-02-01Remove `Alloc` in favor of `AllocRef`Tim Diekmann-7/+0
`AllocRef` was reexported as `Alloc` in order to not break toolstate in the week before the next stable release.
2020-01-27Rename `Alloc` to `AllocRef`Tim Diekmann-11/+26
2020-01-20Added minor clarification to specification of realloc.Matthew Parkinson-1/+2
The `layout` for the returned allocation of a `realloc` is only implicitly specified. This change makes it explicit.
2020-01-11Constify alloc::LayoutLukas Lueg-4/+8
Tracking issue #67521, Layout::new in #66254
2020-01-09Mark Layout::new as const stableCAD97-0/+1
2020-01-09Make Layout::new constChristopher Durham-3/+2
2019-12-22Format the worldMark Rousskov-96/+71
2019-12-18Propagate cfg bootstrapMark Rousskov-1/+1
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+1
functions with a `const` modifier
2019-12-11Rollup merge of #67174 - kraai:remove-checked_add, r=rkruppeMazdak Farrokhzad-2/+5
Remove `checked_add` in `Layout::repeat`
2019-12-11Rollup merge of #67154 - kraai:alloc-typos, r=Dylan-DPCYuki Okushi-6/+6
Fix typos in src/libcore/alloc.rs docs
2019-12-09Rollup merge of #67155 - kraai:move-instead-of-binding-to-reference, r=cramertjTyler Mandry-6/+6
Move `Layout`s instead of binding by reference
2019-12-09Remove `checked_add` in `Layout::repeat`Matthew Kraai-2/+5
2019-12-08Move `Layout`s instead of binding by referenceMatthew Kraai-6/+6
2019-12-08Change "attributes" to "attribute" in `Alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "`alloc`/`realloc`" to "`realloc/dealloc`"Matthew Kraai-3/+3
2019-12-08Add "this" to `GlobalAlloc::alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "though" to "through" in `Alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "result" to "resulting" in `Layout::extend`'s docsMatthew Kraai-1/+1
2019-12-07Simplify `Layout::extend_packed`Matthew Kraai-2/+1
2019-12-06Rollup merge of #67092 - kraai:us-to-is, r=jonas-schievinkMazdak Farrokhzad-2/+2
Fix comment typos in src/libcore/alloc.rs
2019-12-06Change "wth" to "with" in `Layout::padding_needed_for` commentMatthew Kraai-1/+1
2019-12-06Change "us" to "is" in Layout::for_value commentMatthew Kraai-1/+1
2019-12-06Change "either" to "any" in Layout::from_size_align's docsMatthew Kraai-1/+1
2019-11-25Clarify Layout::pad_to_align safety commentChristopher Durham-1/+1
2019-11-25Remove unsafe in Layout::pad_to_alignChristopher Durham-3/+1
2019-11-09Fix typoChristopher Durham-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-09Fix Layout::pad_to_align type mismatchChristopher Durham-2/+3
2019-11-09Layout::pad_to_align is infallibleChristopher Durham-5/+7
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-0/+2
2019-07-18Fix clippy::clone_on_copy warningsMateusz Mikuła-2/+2
2019-07-09Add missing links for CannotReallocInPlace typeGuillaume Gomez-2/+5
2019-05-19Rollup merge of #60947 - blkerby:global_alloc_typo, r=jonas-schievinkMazdak Farrokhzad-2/+2
Fix typos in docs of GlobalAlloc
2019-05-18Fix typos in docs of GlobalAllocBrent Kerby-2/+2
2019-05-14Mark core::alloc::Layout::from_size_align_unchecked constRichard Wiedenhöft-1/+1
2019-04-19libcore: deny more...Mazdak Farrokhzad-3/+3
2019-04-18libcore => 2018Taiki Endo-6/+6
2019-02-25heading # Unsafety => # Safety in stdlib docs.Mazdak Farrokhzad-2/+2
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0