about summary refs log tree commit diff
path: root/src/libstd/alloc.rs
AgeCommit message (Collapse)AuthorLines
2019-05-04Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo-0/+5
2019-03-27Add `Default` to `std::alloc::System`Tim Diekmann-1/+1
2019-02-28libstd => 2018Taiki Endo-2/+3
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-2/+2
2018-12-25Remove licensesMark Rousskov-10/+0
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-1/+1
fix various typos in doc comments
2018-11-13fix various typos in doc commentsAndy Russell-1/+1
2018-11-12global allocators: add a few commentsRalf Jung-0/+5
2018-11-11std: Delete the `alloc_system` crateAlex Crichton-2/+87
This commit deletes the `alloc_system` crate from the standard distribution. This unstable crate is no longer needed in the modern stable global allocator world, but rather its functionality is folded directly into the standard library. The standard library was already the only stable location to access this crate, and as a result this should not affect any stable code.
2018-11-02Remove all jemalloc-related contentAlex Crichton-6/+3
This commit removes all jemalloc related submodules, configuration, etc, from the bootstrap, from the standard library, and from the compiler. This will be followed up with a change to use jemalloc specifically as part of rustc on blessed platforms.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-4/+0
2018-08-26rustc: Continue to tweak "std internal symbols"Alex Crichton-4/+4
In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: https://github.com/rust-lang/rust/issues/51342#issuecomment-414368019 [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
2018-08-01Switch to bootstrapping from 1.29 betaMark Rousskov-2/+1
2018-07-09Implement #[alloc_error_handler]Simon Sapin-1/+2
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-09Remove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI ↵Simon Sapin-1/+1
of the declaration in liballoc This turned out to be important on Windows. Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused: ``` Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005: Access violation reading location 0x000000000000002A. ``` 0x2A equals 42, so it looks like the `Layout::size` field of type `usize` was interpreted as a pointer to read from.
2018-06-29Fix inconsequential typo in GlobalAlloc doc exampleIxrec-1/+1
2018-06-18Rename OOM to allocation errorSimon Sapin-14/+14
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-11Move Unstable Book sections for #[global_allocator] and System to std::alloc ↵Simon Sapin-0/+62
docs
2018-06-11Stabilize the `System` allocatorSimon Sapin-1/+1
2018-06-11Move set_oom_hook and take_oom_hook to a dedicated tracking issueSimon Sapin-2/+2
2018-06-11Mark as permanently-unstable some implementation detailsSimon Sapin-2/+2
2018-06-11Stablize the alloc module without changing stability of its contents.Simon Sapin-6/+13
2018-06-11Document memory allocation APIsSimon Sapin-1/+1
Add some docs where they were missing, attempt to fix them where they were out of date.
2018-06-11Remove the deprecated Heap type/constSimon Sapin-1/+0
2018-06-11Replace `impl GlobalAlloc for Global` with a set of free functionsMike Hommey-0/+1
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-5/+5
2018-06-01Make the OOM hook return `()` rather than `!`Mike Hommey-10/+12
Per discussion in https://github.com/rust-lang/rust/issues/51245#issuecomment-393651083 This allows more flexibility in what can be done with the API. This also splits `rtabort!` into `dumb_print` happening in the default hook and `abort_internal`, happening in the actual oom handler after calling the hook. Registering an empty function thus makes the oom handler not print anything but still abort. Cc: @alexcrichton
2018-05-30Add hooks allowing to override the `oom` behaviorMike Hommey-2/+46
2018-05-30Pass a `Layout` to `oom`Mike Hommey-2/+2
As discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456 and subsequent, there are use-cases where the OOM handler needs to know the size of the allocation that failed. The alignment might also be a cause for allocation failure, so providing it as well can be useful.
2018-05-17Switch to 1.26 bootstrap compilerMark Simulacrum-61/+0
2018-04-22Replace GlobalAlloc::oom with a lang itemSteven Fackler-2/+11
2018-04-12Rename alloc::Void to alloc::OpaqueSimon Sapin-3/+3
2018-04-12Restore Global.oom() functionalitySimon Sapin-0/+6
… now that #[global_allocator] does not define a symbol for it
2018-04-12Use the GlobalAlloc trait for #[global_allocator]Simon Sapin-99/+54
2018-04-12Make AllocErr a zero-size unit structSimon Sapin-30/+13
2018-04-12Actually deprecate the Heap typeSimon Sapin-1/+2
2018-04-12Actually deprecate heap modules.Simon Sapin-3/+3
2018-04-12Rename `heap` modules in the core, alloc, and std crates to `alloc`Simon Sapin-0/+176