about summary refs log tree commit diff
path: root/src/libstd/alloc.rs
AgeCommit message (Collapse)AuthorLines
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