rust/library/std
Matthias Krüger 922b827b8c
Rollup merge of #115007 - kpreid:alloc, r=Mark-Simulacrum
Correct and expand documentation of `handle_alloc_error` and `set_alloc_error_hook`.

The primary goal of this change is to remove the false claim that `handle_alloc_error` always aborts; instead, code should be prepared for `handle_alloc_error` to possibly unwind, and be sound under that condition.

I saw other opportunities for improvement, so I have added all the following information:

* `handle_alloc_error` may panic instead of aborting. (Fixes #114898)
* What happens if a hook returns rather than diverging.
* A hook may panic. (This was already demonstrated in an example, but not stated in prose.)
* A hook must be sound to call — it cannot assume that it is only called by the runtime, since its function pointer can be retrieved by safe code.

I've checked these statements against the source code of `alloc` and `std`, but there may be nuances I haven't caught, so a careful review is welcome.
2023-08-27 09:45:18 +02:00
..
benches
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Rollup merge of #115007 - kpreid:alloc, r=Mark-Simulacrum 2023-08-27 09:45:18 +02:00
tests Add data race test to std::env::{get, set} 2023-08-20 21:50:45 +02:00
build.rs wip: Support Apple tvOS in libstd 2023-06-21 14:59:37 -07:00
Cargo.toml Upgrade Object and related deps 2023-08-14 23:05:45 +08:00