From 646fb1e87677fe1fa878007b7fdbb4eea487ec11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E7=8C=AB=E5=90=8C=E5=AD=A6?= <842913787@qq.com> Date: Sat, 14 Nov 2026 15:44:15 -0800 Subject: [PATCH] fix(ide-workspace): declare GetProcessTimes consistently Two modules declared the same kernel32 function with different out-pointer types (FileTime vs packed u64), which clippy rejects under -D warnings. Both now read the packed u64. --- crates/ide-workspace/src/process.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/crates/ide-workspace/src/process.rs b/crates/ide-workspace/src/process.rs index c24ef0ce0a..4e773cf426 100644 --- a/crates/ide-workspace/src/process.rs +++ b/crates/ide-workspace/src/process.rs @@ -246,30 +246,24 @@ mod imp { } pub fn process_start() -> Option { - #[repr(C)] - #[derive(Default)] - struct FileTime { - low: u32, - high: u32, - } #[link(name = "kernel32")] unsafe extern "system" { + // The same signature `memory.rs` declares: FILETIMEs read as packed u64s. fn GetProcessTimes( process: *mut std::ffi::c_void, - creation: *mut FileTime, - exit: *mut FileTime, - kernel: *mut FileTime, - user: *mut FileTime, + creation: *mut u64, + exit: *mut u64, + kernel: *mut u64, + user: *mut u64, ) -> i32; } let (mut c, mut e, mut k, mut u) = Default::default(); - // SAFETY: all out-pointers are valid FILETIME structs. + // SAFETY: all out-pointers are valid 64-bit FILETIME slots. let ok = unsafe { GetProcessTimes(GetCurrentProcess(), &mut c, &mut e, &mut k, &mut u) }; if ok == 0 { return None; } - let c: FileTime = c; - let ticks = ((c.high as u64) << 32) | c.low as u64; // 100 ns since 1601-01-01 + let ticks = c; // 100 ns since 1601-01-01 let unix_100ns = ticks.checked_sub(116_444_736_000_000_000)?; Some(std::time::UNIX_EPOCH + std::time::Duration::from_nanos(unix_100ns * 100)) }