2021-05-08 19:56:59 -05:00
|
|
|
use std::alloc::{GlobalAlloc, Layout};
|
|
|
|
|
|
|
|
struct Test(u32);
|
|
|
|
|
|
|
|
unsafe impl GlobalAlloc for Test {
|
|
|
|
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
2021-05-10 23:20:43 -05:00
|
|
|
self.0 += 1; //~ ERROR cannot assign
|
2021-05-08 19:56:59 -05:00
|
|
|
0 as *mut u8
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|