handle_alloc_error in std::alloc - Rust (original) (raw)

Function handle_alloc_error

1.28.0 (const: unstable) ยท Source

pub fn handle_alloc_error(layout: Layout) -> !

Expand description

Signals a memory allocation error.

Callers of memory allocation APIs wishing to cease execution in response to an allocation error are encouraged to call this function, rather than directly invoking panic! or similar.

This function is guaranteed to diverge (not return normally with a value), but depending on global configuration, it may either panic (resulting in unwinding or aborting as per configuration for all panics), or abort the process (with no unwinding).

The default behavior is: