From bd1ab724064f2bcc59ddc6157d6cae9ca344939b Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 19 Aug 2022 13:33:06 +0400 Subject: [PATCH] Replace most uses of `pointer::offset` with `add` and `sub` --- example/alloc_system.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/alloc_system.rs b/example/alloc_system.rs index cf95c89bc31..50261c19397 100644 --- a/example/alloc_system.rs +++ b/example/alloc_system.rs @@ -94,7 +94,7 @@ mod platform { struct Header(*mut u8); const HEAP_ZERO_MEMORY: DWORD = 0x00000008; unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header { - &mut *(ptr as *mut Header).offset(-1) + &mut *(ptr as *mut Header).sub(1) } unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 { let aligned = ptr.add(align - (ptr as usize & (align - 1)));