]> git.lizzy.rs Git - rust.git/blob - tests/run-make/wasm-symbols-not-exported/bar.rs
Rollup merge of #106958 - jyn514:labels, r=m-ou-se
[rust.git] / tests / run-make / wasm-symbols-not-exported / bar.rs
1 #![feature(panic_handler, alloc_error_handler)]
2 #![crate_type = "cdylib"]
3 #![no_std]
4
5 use core::alloc::*;
6
7 struct B;
8
9 unsafe impl GlobalAlloc for B {
10     unsafe fn alloc(&self, x: Layout) -> *mut u8 {
11         1 as *mut u8
12     }
13
14     unsafe fn dealloc(&self, ptr: *mut u8, x: Layout) {
15     }
16 }
17
18 #[global_allocator]
19 static A: B = B;
20
21 #[no_mangle]
22 pub extern fn foo(a: u32) -> u32 {
23     assert_eq!(a, 3);
24     a * 2
25 }
26
27 #[alloc_error_handler]
28 fn a(_: core::alloc::Layout) -> ! {
29     loop {}
30 }
31
32 #[panic_handler]
33 fn b(_: &core::panic::PanicInfo) -> ! {
34     loop {}
35 }