about summary refs log tree commit diff
path: root/example/alloc_example.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-04-29 11:10:56 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-04-29 11:10:56 +0000
commit72022bb24d77fb82a62bc6d6d60306d75799e172 (patch)
treef5ab06b3e09a3a2ec2bb35c2a952219141e16ff1 /example/alloc_example.rs
parent0c79ce3bac73d7e9ade41d9ed488644e705e96f4 (diff)
parent2f624db5eaeeebadbebdef727b941c599916aa15 (diff)
downloadrust-72022bb24d77fb82a62bc6d6d60306d75799e172.tar.gz
rust-72022bb24d77fb82a62bc6d6d60306d75799e172.zip
Sync from rust f4956053816439a5884cb2ad1247835858f92218
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 31a294ad7a8..d994e2fbc0a 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");