Skip to content

Commit be9844b

Browse files
Fix Windows CI: cast function pointer through *const () to satisfy function_casts_as_integer lint, allow cast_possible_truncation on i686
Agent-Logs-Url: https://github.com/acl-dev/open-coroutine/sessions/4afcc93e-28af-4537-a925-c2ca02300c75 Co-authored-by: loongs-zhang <38336731+loongs-zhang@users.noreply.github.com>
1 parent 7a41422 commit be9844b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/src/monitor.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl Monitor {
430430
// then set RIP to the preempt assembly function
431431
context.Rsp -= 8;
432432
std::ptr::write(context.Rsp as *mut u64, context.Rip);
433-
context.Rip = preempt_asm as usize as u64;
433+
context.Rip = preempt_asm as *const () as usize as u64;
434434
if SetThreadContext(thread_handle, &raw const context) == 0 {
435435
let _ = ResumeThread(thread_handle);
436436
return false;
@@ -462,7 +462,10 @@ impl Monitor {
462462
// then set EIP to the preempt assembly function
463463
context.Esp -= 4;
464464
std::ptr::write(context.Esp as *mut u32, context.Eip);
465-
context.Eip = preempt_asm as usize as u32;
465+
#[allow(clippy::cast_possible_truncation)]
466+
{
467+
context.Eip = preempt_asm as *const () as usize as u32;
468+
}
466469
if SetThreadContext(thread_handle, &raw const context) == 0 {
467470
let _ = ResumeThread(thread_handle);
468471
return false;

0 commit comments

Comments
 (0)