Skip to content

Commit f40451c

Browse files
committed
add test for no global allocation
1 parent 17549e5 commit f40451c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Make sure we pretend the allocation symbols don't exist when there is no allocator
2+
3+
#![feature(lang_items, start)]
4+
#![no_std]
5+
6+
extern "Rust" {
7+
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
8+
}
9+
10+
#[start]
11+
fn start(_: isize, _: *const *const u8) -> isize {
12+
unsafe {
13+
__rust_alloc(1, 1); //~ERROR: unsupported operation: can't call foreign function: __rust_alloc
14+
}
15+
16+
0
17+
}
18+
19+
#[panic_handler]
20+
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
21+
loop {}
22+
}
23+
24+
#[lang = "eh_personality"]
25+
fn eh_personality() {}

0 commit comments

Comments
 (0)