Skip to content

Commit 6b94964

Browse files
committed
rust: move ALLOCATOR static into the allocator module
Signed-off-by: Miguel Ojeda <[email protected]>
1 parent bfe9ec6 commit 6b94964

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

rust/kernel/allocator.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ unsafe impl GlobalAlloc for KernelAllocator {
2424
}
2525
}
2626

27+
#[global_allocator]
28+
static ALLOCATOR: KernelAllocator = KernelAllocator;
29+
2730
#[alloc_error_handler]
2831
fn oom(_layout: Layout) -> ! {
2932
panic!("Out of memory!");

rust/kernel/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,3 @@ macro_rules! container_of {
213213
unsafe { ($ptr as *const _ as *const u8).offset(-offset) as *const $type }
214214
}}
215215
}
216-
217-
#[global_allocator]
218-
static ALLOCATOR: allocator::KernelAllocator = allocator::KernelAllocator;

0 commit comments

Comments
 (0)