From f4e1759d768e9d5dc39778b455e3aaa7c8a628d2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 7 Jul 2019 11:01:31 +0200 Subject: [PATCH] try to fix old macro --- src/offset_of.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/offset_of.rs b/src/offset_of.rs index 0d6e238..6931748 100644 --- a/src/offset_of.rs +++ b/src/offset_of.rs @@ -79,7 +79,7 @@ macro_rules! offset_of { // See above for a better version that only works with newer Rust. let non_null = $crate::ptr::NonNull::<$parent>::dangling(); #[allow(unused_unsafe)] - let base_ptr = unsafe { non_null.as_ref() as *const _ }; + let base_ptr = unsafe { non_null.as_ref() as *const $parent }; #[allow(unused_unsafe)] let field_ptr = unsafe { &(*base_ptr).$field as *const _ }; let offset = (field_ptr as usize) - (base_ptr as usize);