diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-08-27 09:45:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-27 09:45:18 +0200 |
| commit | 922b827b8c6cd98651d709ef98d8ee6838f43c84 (patch) | |
| tree | 07040342d2f2e4d05d8b8ab74c3ed96a65802812 /compiler/rustc_interface/src | |
| parent | ce7993670b2e3c18793a06f06ba1e79114e6326c (diff) | |
| parent | 3dde25edc46267cd21ab189af84cad100811b204 (diff) | |
| download | rust-922b827b8c6cd98651d709ef98d8ee6838f43c84.tar.gz rust-922b827b8c6cd98651d709ef98d8ee6838f43c84.zip | |
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.
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions
