@@ -113,7 +113,9 @@ impl Drop for Bomb {
113
113
114
114
#[ inline( always) ]
115
115
pub 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
+ }
117
119
118
120
extern "C" fn trace_fn (
119
121
ctx : * mut uw:: _Unwind_Context ,
@@ -168,7 +170,7 @@ mod uw {
168
170
pub type _Unwind_Trace_Fn =
169
171
extern "C" fn ( ctx : * mut _Unwind_Context , arg : * mut c_void ) -> _Unwind_Reason_Code ;
170
172
171
- extern "C" {
173
+ unsafe extern "C" {
172
174
pub fn _Unwind_Backtrace (
173
175
trace : _Unwind_Trace_Fn ,
174
176
trace_argument : * mut c_void ,
@@ -186,7 +188,7 @@ mod uw {
186
188
not( all( target_os = "vita" , target_arch = "arm" ) ) ,
187
189
not( all( target_os = "nuttx" , target_arch = "arm" ) ) ,
188
190
) ) ] {
189
- extern "C" {
191
+ unsafe extern "C" {
190
192
pub fn _Unwind_GetIP( ctx: * mut _Unwind_Context) -> libc:: uintptr_t;
191
193
pub fn _Unwind_FindEnclosingFunction( pc: * mut c_void) -> * mut c_void;
192
194
@@ -206,10 +208,10 @@ mod uw {
206
208
// instead of relying on _Unwind_GetCFA.
207
209
#[ cfg( all( target_os = "linux" , target_arch = "s390x" ) ) ]
208
210
pub unsafe fn get_sp( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
209
- extern "C" {
211
+ unsafe extern "C" {
210
212
pub fn _Unwind_GetGR( ctx: * mut _Unwind_Context, index: libc:: c_int) -> libc:: uintptr_t;
211
213
}
212
- _Unwind_GetGR( ctx, 15 )
214
+ unsafe { _Unwind_GetGR( ctx, 15 ) }
213
215
}
214
216
} else {
215
217
use core:: ptr:: addr_of_mut;
@@ -246,7 +248,7 @@ mod uw {
246
248
}
247
249
248
250
type _Unwind_Word = libc:: c_uint;
249
- extern "C" {
251
+ unsafe extern "C" {
250
252
fn _Unwind_VRS_Get(
251
253
ctx: * mut _Unwind_Context,
252
254
klass: _Unwind_VRS_RegClass,
@@ -259,13 +261,15 @@ mod uw {
259
261
pub unsafe fn _Unwind_GetIP( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
260
262
let mut val: _Unwind_Word = 0 ;
261
263
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
+ }
269
273
( val & !1 ) as libc:: uintptr_t
270
274
}
271
275
@@ -275,13 +279,15 @@ mod uw {
275
279
pub unsafe fn get_sp( ctx: * mut _Unwind_Context) -> libc:: uintptr_t {
276
280
let mut val: _Unwind_Word = 0 ;
277
281
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
+ }
285
291
val as libc:: uintptr_t
286
292
}
287
293
0 commit comments