Skip to content

Commit e10f5b6

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 d0e65a9 commit e10f5b6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ compile-flags: --crate-type cdylib -C lto
2+
//@ build-pass
3+
//@ no-prefer-dynamic
4+
5+
use std::alloc::{GlobalAlloc, Layout};
6+
7+
struct MyAllocator;
8+
9+
unsafe impl GlobalAlloc for MyAllocator {
10+
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
11+
todo!()
12+
}
13+
14+
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
15+
}
16+
17+
#[global_allocator]
18+
static GLOBAL: MyAllocator = MyAllocator;

0 commit comments

Comments
 (0)