Movatterモバイル変換


[0]ホーム

URL:


handle_alloc_error

std::alloc

Functionhandle_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 executionin response to an allocation error are encouraged to call this function,rather than directly invokingpanic! or similar.

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

The default behavior is:

  • If the binary links againststd (typically the case), thenprint a message to standard error and abort the process.This behavior can be replaced withset_alloc_error_hook andtake_alloc_error_hook.Future versions of Rust may panic by default instead.

  • If the binary does not link againststd (all of its crates are marked#![no_std]), then callpanic! with a message.The panic handler applies as to any panic.


[8]ページ先頭

©2009-2026 Movatter.jp