Use addr_of_mut instead

This commit is contained in:
mejrs 2022-02-14 23:18:22 +01:00
parent 03e650c02f
commit e5000e470a

View file

@ -148,7 +148,11 @@ macro_rules! pyobject_native_type_info(
// Create a very short lived mutable reference and directly // Create a very short lived mutable reference and directly
// cast it to a pointer: no mutable references can be aliasing // cast it to a pointer: no mutable references can be aliasing
// because we hold the GIL. // because we hold the GIL.
#[cfg(not(addr_of))]
unsafe { &mut $typeobject } unsafe { &mut $typeobject }
#[cfg(addr_of)]
unsafe { ::std::ptr::addr_of_mut!($typeobject) }
} }
$( $(