@@ -113,7 +113,9 @@ impl Drop for Bomb {
113113
114114#[ inline( always) ]
115115pub unsafe fn trace ( mut cb : & mut dyn FnMut ( & super :: Frame ) -> bool ) {
116- uw:: _Unwind_Backtrace ( trace_fn, addr_of_mut ! ( cb) . cast ( ) ) ;
116+ unsafe {
117+ uw:: _Unwind_Backtrace ( trace_fn, addr_of_mut ! ( cb) . cast ( ) ) ;
118+ }
117119
118120 extern "C" fn trace_fn (
119121 ctx : * mut uw:: _Unwind_Context ,
@@ -168,7 +170,7 @@ mod uw {
168170 pub type _Unwind_Trace_Fn =
169171 extern "C" fn ( ctx : * mut _Unwind_Context , arg : * mut c_void ) -> _Unwind_Reason_Code ;
170172
171- extern "C" {
173+ unsafe extern "C" {
172174 pub fn _Unwind_Backtrace (
173175 trace : _Unwind_Trace_Fn ,
174176 trace_argument : * mut c_void ,
@@ -186,7 +188,7 @@ mod uw {
186188 not( all( target_os = "vita" , target_arch = "arm" ) ) ,
187189 not( all( target_os = "nuttx" , target_arch = "arm" ) ) ,
188190 ) ) ] {
189- extern "C" {
191+ unsafe extern "C" {
190192 pub fn _Unwind_GetIP( ctx: * mut _Unwind_Context) -> libc:: uintptr_t;
191193 pub fn _Unwind_FindEnclosingFunction( pc: * mut c_void) -> * mut c_void;
192194
@@ -206,10 +208,10 @@ mod uw {
206208 // instead of relying on _Unwind_GetCFA.
207209 #[ cfg( all( target_os = "linux" , target_arch = "s390x" ) ) ]
208210 pub unsafe fn get_sp( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
209- extern "C" {
211+ unsafe extern "C" {
210212 pub fn _Unwind_GetGR( ctx: * mut _Unwind_Context, index: libc:: c_int) -> libc:: uintptr_t;
211213 }
212- _Unwind_GetGR( ctx, 15 )
214+ unsafe { _Unwind_GetGR( ctx, 15 ) }
213215 }
214216 } else {
215217 use core:: ptr:: addr_of_mut;
@@ -246,7 +248,7 @@ mod uw {
246248 }
247249
248250 type _Unwind_Word = libc:: c_uint;
249- extern "C" {
251+ unsafe extern "C" {
250252 fn _Unwind_VRS_Get(
251253 ctx: * mut _Unwind_Context,
252254 klass: _Unwind_VRS_RegClass,
@@ -259,13 +261,15 @@ mod uw {
259261 pub unsafe fn _Unwind_GetIP( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
260262 let mut val: _Unwind_Word = 0 ;
261263 let ptr = addr_of_mut!( val) ;
262- let _ = _Unwind_VRS_Get(
263- ctx,
264- _Unwind_VRS_RegClass:: _UVRSC_CORE,
265- 15 ,
266- _Unwind_VRS_DataRepresentation:: _UVRSD_UINT32,
267- ptr. cast:: <c_void>( ) ,
268- ) ;
264+ unsafe {
265+ let _ = _Unwind_VRS_Get(
266+ ctx,
267+ _Unwind_VRS_RegClass:: _UVRSC_CORE,
268+ 15 ,
269+ _Unwind_VRS_DataRepresentation:: _UVRSD_UINT32,
270+ ptr. cast:: <c_void>( ) ,
271+ ) ;
272+ }
269273 ( val & !1 ) as libc:: uintptr_t
270274 }
271275
@@ -275,13 +279,15 @@ mod uw {
275279 pub unsafe fn get_sp( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
276280 let mut val: _Unwind_Word = 0 ;
277281 let ptr = addr_of_mut!( val) ;
278- let _ = _Unwind_VRS_Get(
279- ctx,
280- _Unwind_VRS_RegClass:: _UVRSC_CORE,
281- SP ,
282- _Unwind_VRS_DataRepresentation:: _UVRSD_UINT32,
283- ptr. cast:: <c_void>( ) ,
284- ) ;
282+ unsafe {
283+ let _ = _Unwind_VRS_Get(
284+ ctx,
285+ _Unwind_VRS_RegClass:: _UVRSC_CORE,
286+ SP ,
287+ _Unwind_VRS_DataRepresentation:: _UVRSD_UINT32,
288+ ptr. cast:: <c_void>( ) ,
289+ ) ;
290+ }
285291 val as libc:: uintptr_t
286292 }
287293
0 commit comments