Skip to content

Commit 4b6f55a

Browse files
committed
Document handle_alloc_error feature in Unstable Book
1 parent 13471d3 commit 4b6f55a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# `alloc_error_handler`
2+
3+
The tracking issue for this feature is: [#51540]
4+
5+
[#51540]: https://github.com/rust-lang/rust/issues/51540
6+
7+
------------------------
8+
9+
This attribute is mandatory when using the alloc crate without the std crate. It is used when handling out of memory (OOM) allocation error, and is called
10+
by `alloc::alloc::handle_alloc_error`
11+
12+
``` rust,ignore (partial-example)
13+
#![feature(alloc_error_handler)]
14+
#![no_std]
15+
16+
#[alloc_error_handler]
17+
fn foo(_: core::alloc::Layout) -> ! {
18+
// …
19+
}
20+
```

0 commit comments

Comments
 (0)