Commit Graph

43 Commits

Author SHA1 Message Date
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
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
Ross MacArthur
f7256d28d1
Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
Taiki Endo
ccb9dac5ed Fix intra-doc link resolution failure on re-exporting libstd 2019-05-04 23:48:57 +09:00
Tim Diekmann
8733b2ab0c
Add Default to std::alloc::System 2019-03-27 00:09:12 +01:00
Taiki Endo
93b6d9e086 libstd => 2018 2019-02-28 04:06:15 +09:00
Mark Rousskov
7a58c6d1de Replace deprecated ATOMIC_INIT consts 2019-01-26 15:27:38 -07:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Pietro Albini
66fcb3ceb2
Rollup merge of #55901 - euclio:speling, r=petrochenkov
fix various typos in doc comments
2018-11-15 11:04:42 +01:00
Andy Russell
4e35cbb22e
fix various typos in doc comments 2018-11-13 14:45:31 -05:00
Ralf Jung
075983c70b global allocators: add a few comments 2018-11-12 09:01:57 +01:00
Alex Crichton
cc7590341a std: Delete the alloc_system crate
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-11 09:22:28 -08:00
Alex Crichton
61e89446ef Remove all jemalloc-related content
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-11-02 06:52:56 -07:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
Alex Crichton
0a2282e128 rustc: Continue to tweak "std internal symbols"
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]: 35bf1ae257/src/librustc/middle/reachable.rs (L225-L238)
2018-08-26 16:34:14 -07:00
Mark Rousskov
683a3db01f Switch to bootstrapping from 1.29 beta 2018-08-01 11:59:08 -06:00
Simon Sapin
239ec7d2dc Implement #[alloc_error_handler]
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-09 23:13:24 +02:00
Simon Sapin
620599e886 Remove extern on the pub fn rust_oom lang item in libstd, to match ABI of the declaration in liballoc
This turned out to be important on Windows.
Calling `handle_alloc_error(Layout:🆕:<[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-07-09 23:13:24 +02:00
Ixrec
d6cf1821bf
Fix inconsequential typo in GlobalAlloc doc example 2018-06-29 03:12:02 +01: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
a24924f683 Move Unstable Book sections for #[global_allocator] and System to std::alloc docs 2018-06-11 13:48:57 -07:00
Simon Sapin
8111717da1 Stabilize the System allocator 2018-06-11 13:48:39 -07:00
Simon Sapin
90d19728fc Move set_oom_hook and take_oom_hook to a dedicated tracking issue 2018-06-11 13:48:39 -07:00
Simon Sapin
75e17da873 Mark as permanently-unstable some implementation details 2018-06-11 13:48:27 -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
b945be71e8 Make the OOM hook return () rather than !
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-06-01 08:50:07 +09:00
Mike Hommey
a4d899b4a1 Add hooks allowing to override the oom behavior 2018-05-30 10:57:38 +09: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
Mark Simulacrum
9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06: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
eae0d46893 Restore Global.oom() functionality
… now that #[global_allocator] does not define a symbol for it
2018-04-12 22:53:21 +02:00
Simon Sapin
86753ce1cc Use the GlobalAlloc trait for #[global_allocator] 2018-04-12 22:53:12 +02:00
Simon Sapin
ba7081a033 Make AllocErr a zero-size unit struct 2018-04-12 22:53:03 +02:00
Simon Sapin
e521b8b472 Actually deprecate the Heap type 2018-04-12 22:52:47 +02:00
Simon Sapin
743c29bdc5 Actually deprecate heap modules. 2018-04-12 22:52:47 +02:00
Simon Sapin
09e8db1e4f Rename heap modules in the core, alloc, and std crates to alloc 2018-04-12 22:52:47 +02:00