Commit graph

61 commits

Author SHA1 Message Date
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
LeSeulArtichaut
7b6398657c Apply suggestions from code review
Co-authored-by: nikomatsakis <niko@alum.mit.edu>
2020-06-19 13:47:04 +02:00
LeSeulArtichaut
39e29ce4d0 #[deny(unsafe_op_in_unsafe_fn)] in liballoc 2020-06-19 13:47:01 +02:00
Linus Färnstrand
fff4f08398 Stop importing integer modules in liballoc 2020-04-05 11:22:01 +02:00
Tim Diekmann
3ade8ae660 Implement init and init_offset on AllocInit and mark it unsafe 2020-03-29 01:47:05 +01:00
Tim Diekmann
bf6a46db31 Make fields in MemoryBlock public 2020-03-28 20:22:07 +01:00
Tim Diekmann
03b055b0b4 Remove alignment from MemoryBlock 2020-03-26 17:14:12 +01:00
Tim Diekmann
2526accdd3 Fix issues from review and unsoundness of RawVec::into_box 2020-03-26 17:11:47 +01:00
Tim Diekmann
56cbf2f22a Overhaul of the AllocRef trait to match allocator-wg's latest consens 2020-03-26 17:10:54 +01:00
Tim Diekmann
f77afc8f9c Allow ZSTs in AllocRef 2020-03-08 11:01:12 +01:00
Tim Diekmann
d8e3557dba Remove usable_size APIs 2020-03-03 00:08:24 +01:00
Tim Diekmann
76aa29ff5e
Preparation for allocator aware Box 2020-02-11 13:16:20 +01:00
Tim Diekmann
7ca25db816
Rename Alloc to AllocRef 2020-01-27 21:39:51 +01:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mark Rousskov
f359a94849 Snap cfgs to new beta 2019-09-25 08:42:46 -04:00
Josh Stone
9f374da467 Exempt extern "Rust" from improper_ctypes
It should be fine for Rust ABIs to involve any Rust type.
2019-09-20 15:39:34 -07:00
Vadim Petrochenkov
3d0d6ee271 liballoc: Unconfigure tests during normal build
Remove additional libcore-like restrictions from liballoc, turns out the testing works ok if the tests are a part of liballoc itself.
2019-08-02 01:59:01 +03:00
Mark Rousskov
8a7dded1a2 Switch master to 1.38 2019-07-04 11:26:57 -04:00
Vadim Petrochenkov
74a6d1c821 Turn #[allocator] into a built-in attribute and rename it to #[rustc_allocator] 2019-06-08 23:55:25 +03:00
Taiki Endo
ccb9dac5ed Fix intra-doc link resolution failure on re-exporting libstd 2019-05-04 23:48:57 +09:00
Ralf Jung
29eed6b931 make liballoc internal test suite mostly pass in Miri 2019-04-18 13:37:14 +02:00
Jethro Beekman
e41e694d9e Clarify guarantees for Box allocation 2019-02-13 12:51:59 +05:30
Mazdak Farrokhzad
2396780cda liballoc: revert nested imports style changes. 2019-02-03 08:27:44 +01:00
Mazdak Farrokhzad
748970dfa9 liballoc: apply uniform_paths. 2019-02-02 11:05:20 +01:00
Mazdak Farrokhzad
7693e3e666 liballoc: refactor & fix some imports. 2019-02-02 10:14:40 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Ralf Jung
075983c70b global allocators: add a few comments 2018-11-12 09:01:57 +01:00
Corey Farwell
993fb93464 Replace usages of ptr::offset with ptr::{add,sub}. 2018-08-20 07:28:34 -04:00
Corey Farwell
d1193bf95e Add doc examples for std::alloc::{alloc,alloc_zeroed}. 2018-08-14 21:32:11 -04:00
Simon Sapin
2b789bd057 Rename OOM to allocation error
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-18 21:41:24 +02:00
Simon Sapin
7f0d54d988 More alloc docs tweaks 2018-06-11 13:48:57 -07:00
Simon Sapin
125b259b35 Stabilize alloc::oom (but not set_oom_hook or take_oom_hook) 2018-06-11 13:48:39 -07:00
Simon Sapin
45d6d207b0 Stabilize alloc free functions for the global allocators. 2018-06-11 13:48:39 -07:00
Simon Sapin
951bc28fd0 Stablize the alloc module without changing stability of its contents. 2018-06-11 13:48:25 -07:00
Simon Sapin
e9fd063edb Document memory allocation APIs
Add some docs where they were missing,
attempt to fix them where they were out of date.
2018-06-11 13:47:28 -07:00
Simon Sapin
11f992c958 Remove the deprecated Heap type/const 2018-06-11 13:47:28 -07:00
Mike Hommey
3373204ac4 Replace impl GlobalAlloc for Global with a set of free functions 2018-06-11 13:47:23 -07:00
Mike Hommey
f6ab74b8e7 Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAlloc 2018-06-11 13:47:23 -07:00
Mike Hommey
0f4ef003ac Pass a Layout to oom
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-30 05:35:48 +09:00
Alex Crichton
f67453729c std: Ensure OOM is classified as nounwind
OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind

Closes #50925
2018-05-24 12:03:05 -07:00
bors
90463a6bdc Auto merge of #50629 - Mark-Simulacrum:stage-step, r=alexcrichton
Switch to bootstrapping from 1.27

It's possible the Float trait could be removed from core, but I couldn't tell whether it was intended to be removed or not. @SimonSapin may be able to comment more here; we can presumably also do that in a follow up PR as this one is already quite large.
2018-05-17 16:44:38 +00:00
Mark Simulacrum
9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
Irina Popa
b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
bors
71d3dac4a8 Auto merge of #50097 - glandium:box_free, r=nikomatsakis
Partial future-proofing for Box<T, A>

In some ways, this is similar to @eddyb's PR #47043 that went stale, but doesn't cover everything. Notably, this still leaves Box internalized as a pointer in places, so practically speaking, only ZSTs can be practically added to the Box type with the changes here (the compiler ICEs otherwise).

The Box type is not changed here, that's left for the future because I want to test that further first, but this puts things in place in a way that hopefully will make things easier.
2018-04-27 12:24:17 +00:00
Mike Hommey
bd8c177d49 Switch box_free to take the destructured contents of Box
As of now, Box only contains a Unique pointer, so this is the sole
argument to box_free. Consequently, we remove the code supporting
the previous box_free signature. We however keep the old definition
for bootstrapping purpose.
2018-04-25 11:39:07 +09:00
Steven Fackler
9e8f683476 Remove Alloc::oom 2018-04-22 10:08:49 -07:00
Steven Fackler
e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00
Simon Sapin
f607a3872a Rename alloc::Void to alloc::Opaque 2018-04-12 22:53:22 +02:00
Simon Sapin
ed29777759 Remove conversions for allocated pointers
One was now unused, and `NonNull::new(…).ok_or(AllocErr)` feels short enough
for the few cases that need the other conversion.
2018-04-12 22:53:22 +02:00
Mike Hommey
fddf51ee0b Use NonNull<Void> instead of *mut u8 in the Alloc trait
Fixes #49608
2018-04-12 22:53:22 +02:00