Skip to content

Commit 9239d14

Browse files
bjorn3lqd
andcommitted
Add test that __rg_oom doesn't get internalized during LTO
Co-Authored-By: Rémy Rakic <[email protected]>
1 parent 0271359 commit 9239d14

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/ui/lto/lto-global-allocator.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)