We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17549e5 commit f40451cCopy full SHA for f40451c
tests/compile-fail/alloc/no_global_allocator.rs
@@ -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