]> git.lizzy.rs Git - rust.git/blob - src/test/ui/missing/missing-alloc_error_handler.rs
Rollup merge of #93840 - yaahc:termination-stabilization-celebration-station, r=josht...
[rust.git] / src / test / ui / missing / missing-alloc_error_handler.rs
1 // compile-flags: -C panic=abort
2 // no-prefer-dynamic
3
4 #![no_std]
5 #![crate_type = "staticlib"]
6 #![feature(alloc_error_handler)]
7
8 #[panic_handler]
9 fn panic(_: &core::panic::PanicInfo) -> ! {
10     loop {}
11 }
12
13 extern crate alloc;
14
15 #[global_allocator]
16 static A: MyAlloc = MyAlloc;
17
18 struct MyAlloc;
19
20 unsafe impl core::alloc::GlobalAlloc for MyAlloc {
21     unsafe fn alloc(&self, _: core::alloc::Layout) -> *mut u8 { 0 as _ }
22     unsafe fn dealloc(&self, _: *mut u8, _: core::alloc::Layout) {}
23 }