about summary refs log tree commit diff
path: root/example/alloc_example.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-25 00:08:35 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-04-25 00:08:35 +0200
commitb908472a93f218f12d8f980ddf6b008ecee83c87 (patch)
tree1246f742d9276935ca0aec39ef645a9ba9fb66ce /example/alloc_example.rs
parent106db3ef59a20abd4403587895140114236ea4f5 (diff)
downloadrust-b908472a93f218f12d8f980ddf6b008ecee83c87.tar.gz
rust-b908472a93f218f12d8f980ddf6b008ecee83c87.zip
Revert "Remove #[alloc_error_handler] from the compiler and library"
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
Diffstat (limited to 'example/alloc_example.rs')
-rw-r--r--example/alloc_example.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/example/alloc_example.rs b/example/alloc_example.rs
index e39c3272958..4ede2fe4efe 100644
--- a/example/alloc_example.rs
+++ b/example/alloc_example.rs
@@ -1,4 +1,4 @@
-#![feature(start, core_intrinsics)]
+#![feature(start, core_intrinsics, alloc_error_handler)]
 #![no_std]
 
 extern crate alloc;
@@ -22,6 +22,11 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
     core::intrinsics::abort();
 }
 
+#[alloc_error_handler]
+fn alloc_error_handler(_: alloc::alloc::Layout) -> ! {
+    core::intrinsics::abort();
+}
+
 #[start]
 fn main(_argc: isize, _argv: *const *const u8) -> isize {
     let world: Box<&str> = Box::new("Hello World!\0");