]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/alloc/no_global_allocator.rs
handle unknown targets more gracefully
[rust.git] / src / tools / miri / tests / fail / alloc / no_global_allocator.rs
1 //@normalize-stderr-test: "OS `.*`" -> "$$OS"
2 // Make sure we pretend the allocation symbols don't exist when there is no allocator
3
4 #![feature(lang_items, start)]
5 #![no_std]
6
7 extern "Rust" {
8     fn __rust_alloc(size: usize, align: usize) -> *mut u8;
9 }
10
11 #[start]
12 fn start(_: isize, _: *const *const u8) -> isize {
13     unsafe {
14         __rust_alloc(1, 1); //~ERROR: unsupported operation: can't call foreign function `__rust_alloc`
15     }
16
17     0
18 }
19
20 #[panic_handler]
21 fn panic_handler(_: &core::panic::PanicInfo) -> ! {
22     loop {}
23 }
24
25 #[lang = "eh_personality"]
26 fn eh_personality() {}