about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-08-19 13:33:06 +0400
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-08-21 02:21:41 +0400
commit928ef372c3180d0a6ef2aa0f1fd63cfd5d24911f (patch)
tree16ad1687cc940d7ecdb2405f02b78a2499906864
parent3a8ff6140bddae63fc07c2f8ba61d2d058f339b6 (diff)
downloadrust-928ef372c3180d0a6ef2aa0f1fd63cfd5d24911f.tar.gz
rust-928ef372c3180d0a6ef2aa0f1fd63cfd5d24911f.zip
Replace most uses of `pointer::offset` with `add` and `sub`
-rw-r--r--example/alloc_system.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/example/alloc_system.rs b/example/alloc_system.rs
index 5f66ca67f2d..89661918d05 100644
--- a/example/alloc_system.rs
+++ b/example/alloc_system.rs
@@ -156,7 +156,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)));