Skip to content

Commit 437fb43

Browse files
committed
Migrate unwind to Rust 2024
1 parent dbeab37 commit 437fb43

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

library/unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "unwind"
33
version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
6-
edition = "2021"
6+
edition = "2024"
77
include = [
88
'/libunwind/*',
99
]

library/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)