1717
1818use super :: super :: Bomb ;
1919use core:: ffi:: c_void;
20+ use core:: ptr:: addr_of_mut;
2021
2122pub enum Frame {
2223 Raw ( * mut uw:: _Unwind_Context ) ,
@@ -101,7 +102,7 @@ impl Clone for Frame {
101102
102103#[ inline( always) ]
103104pub unsafe fn trace ( mut cb : & mut dyn FnMut ( & super :: Frame ) -> bool ) {
104- uw:: _Unwind_Backtrace ( trace_fn, & mut cb as * mut _ as * mut _ ) ;
105+ uw:: _Unwind_Backtrace ( trace_fn, addr_of_mut ! ( cb ) as * mut _ ) ;
105106
106107 extern "C" fn trace_fn (
107108 ctx : * mut uw:: _Unwind_Context ,
@@ -198,6 +199,8 @@ mod uw {
198199 _Unwind_GetGR( ctx, 15 )
199200 }
200201 } else {
202+ use core:: ptr:: addr_of_mut;
203+
201204 // On android and arm, the function `_Unwind_GetIP` and a bunch of
202205 // others are macros, so we define functions containing the
203206 // expansion of the macros.
@@ -242,7 +245,7 @@ mod uw {
242245
243246 pub unsafe fn _Unwind_GetIP( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
244247 let mut val: _Unwind_Word = 0 ;
245- let ptr = & mut val as * mut _Unwind_Word ;
248+ let ptr = addr_of_mut! ( val) ;
246249 let _ = _Unwind_VRS_Get(
247250 ctx,
248251 _Unwind_VRS_RegClass:: _UVRSC_CORE,
@@ -258,7 +261,7 @@ mod uw {
258261
259262 pub unsafe fn get_sp( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
260263 let mut val: _Unwind_Word = 0 ;
261- let ptr = & mut val as * mut _Unwind_Word ;
264+ let ptr = addr_of_mut! ( val) ;
262265 let _ = _Unwind_VRS_Get(
263266 ctx,
264267 _Unwind_VRS_RegClass:: _UVRSC_CORE,
0 commit comments