Clarify that handle_alloc_error
may unwind
#114898
Labels
A-allocators
Area: Custom and system allocators
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Location
Summary
handle_alloc_error
's documentation says:However,
set_alloc_error_hook()
(unstable) which per its example is permitted to panic and thereby potentially unwind, andstd
might choose to panic on allocation failure instead.Therefore, the documentation should be changed to not imply that this function will always abort, which could be taken as a promise that it will never unwind.
It also might be useful to expand the documentation of
set_alloc_error_hook()
so that the text and not only the example code specifies that it's okay to unwind from the hook (and what happens if you don't). (See also #56965 which is broader but doesn't mention this aspect.)cc @xTachyon from discussion in Rust Community Discord
@rustbot label +A-allocators +T-libs-api
The text was updated successfully, but these errors were encountered: