We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0271359 commit 9239d14Copy full SHA for 9239d14
tests/ui/lto/lto-global-allocator.rs
@@ -0,0 +1,19 @@
1
+//@ compile-flags: --crate-type cdylib -C lto
2
+//@ build-pass
3
+//@ no-prefer-dynamic
4
+//@ needs-crate-type: cdylib
5
+
6
+use std::alloc::{GlobalAlloc, Layout};
7
8
+struct MyAllocator;
9
10
+unsafe impl GlobalAlloc for MyAllocator {
11
+ unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
12
+ todo!()
13
+ }
14
15
+ unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
16
+}
17
18
+#[global_allocator]
19
+static GLOBAL: MyAllocator = MyAllocator;
0 commit comments