forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmotor.rs
More file actions
28 lines (24 loc) · 968 Bytes
/
motor.rs
File metadata and controls
28 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::alloc::{GlobalAlloc, Layout, System};
#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// SAFETY: same requirements as in GlobalAlloc::alloc.
moto_rt::alloc::alloc(layout)
}
#[inline]
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
// SAFETY: same requirements as in GlobalAlloc::alloc_zeroed.
moto_rt::alloc::alloc_zeroed(layout)
}
#[inline]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
// SAFETY: same requirements as in GlobalAlloc::dealloc.
unsafe { moto_rt::alloc::dealloc(ptr, layout) }
}
#[inline]
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
// SAFETY: same requirements as in GlobalAlloc::realloc.
unsafe { moto_rt::alloc::realloc(ptr, layout, new_size) }
}
}