Skip to content

Commit 9b22cb8

Browse files
ehussgitbot
authored and
gitbot
committed
unwind: Apply unsafe_op_in_unsafe_fn
1 parent 1705de8 commit 9b22cb8

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

unwind/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)]
1010
#![allow(internal_features)]
1111
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
12+
#![deny(unsafe_op_in_unsafe_fn)]
1213

1314
// Force libc to be included even if unused. This is required by many platforms.
1415
#[cfg(not(all(windows, target_env = "msvc")))]

unwind/src/libunwind.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -218,36 +218,38 @@ if #[cfg(any(target_vendor = "apple", target_os = "netbsd", not(target_arch = "a
218218

219219
pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word {
220220
let mut val: _Unwind_Word = core::ptr::null();
221-
_Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
222-
(&raw mut val) as *mut c_void);
221+
unsafe { _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
222+
(&raw mut val) as *mut c_void); }
223223
val
224224
}
225225

226226
pub unsafe fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word) {
227227
let mut value = value;
228-
_Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
229-
(&raw mut value) as *mut c_void);
228+
unsafe { _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
229+
(&raw mut value) as *mut c_void); }
230230
}
231231

232232
pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context)
233233
-> _Unwind_Word {
234-
let val = _Unwind_GetGR(ctx, UNWIND_IP_REG);
234+
let val = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG) };
235235
val.map_addr(|v| v & !1)
236236
}
237237

238238
pub unsafe fn _Unwind_SetIP(ctx: *mut _Unwind_Context,
239239
value: _Unwind_Word) {
240240
// Propagate thumb bit to instruction pointer
241-
let thumb_state = _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1;
241+
let thumb_state = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1 };
242242
let value = value.map_addr(|v| v | thumb_state);
243-
_Unwind_SetGR(ctx, UNWIND_IP_REG, value);
243+
unsafe { _Unwind_SetGR(ctx, UNWIND_IP_REG, value); }
244244
}
245245

246246
pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
247247
ip_before_insn: *mut c_int)
248248
-> _Unwind_Word {
249-
*ip_before_insn = 0;
250-
_Unwind_GetIP(ctx)
249+
unsafe {
250+
*ip_before_insn = 0;
251+
_Unwind_GetIP(ctx)
252+
}
251253
}
252254

253255
// This function also doesn't exist on Android or ARM/Linux, so make it a no-op

0 commit comments

Comments
 (0)