922b827b8c
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.