From d32a5f6bea8c8b2a4460c90ebd81091599823591 Mon Sep 17 00:00:00 2001 From: dragon-zhang Date: Tue, 20 May 2025 23:00:58 +0800 Subject: [PATCH 1/3] Update nix requirement from 0.29 to 0.30 --- Cargo.toml | 2 +- core/src/common/beans.rs | 1 + core/src/common/ordered_work_steal.rs | 2 +- core/src/common/work_steal.rs | 2 +- core/src/coroutine/local.rs | 1 + core/src/syscall/unix/connect.rs | 4 ++-- core/src/syscall/unix/mod.rs | 4 ++-- core/src/syscall/unix/recvmsg.rs | 2 +- core/src/syscall/unix/select.rs | 2 +- core/src/syscall/unix/sendmsg.rs | 2 +- open-coroutine/build.rs | 2 +- 11 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d93b0ce..f7cf8ba1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ corosensei = "0.2" core_affinity = "0.8" crossbeam-utils = "0.8" crossbeam-skiplist = "0.1" -nix = "0.29" +nix = "0.30" io-uring = "0.7" windows-sys = "0.59" anyhow = "1.0" diff --git a/core/src/common/beans.rs b/core/src/common/beans.rs index 67dcbbb7..78fc3b21 100644 --- a/core/src/common/beans.rs +++ b/core/src/common/beans.rs @@ -56,6 +56,7 @@ impl BeanFactory<'_> { /// /// # Safety /// Only one mutable reference can be held for a given bean at a time. + #[allow(clippy::mut_from_ref)] #[must_use] pub unsafe fn get_mut_bean(bean_name: &str) -> Option<&mut B> { Self::get_instance() diff --git a/core/src/common/ordered_work_steal.rs b/core/src/common/ordered_work_steal.rs index 29c795ac..3ea7ad07 100644 --- a/core/src/common/ordered_work_steal.rs +++ b/core/src/common/ordered_work_steal.rs @@ -367,7 +367,7 @@ impl<'l, T: Debug> OrderedLocalQueue<'l, T> { //本地队列超过一半,不再steal break; } - if std::ptr::eq(&another, &self.queue) { + if std::ptr::eq(&raw const another, &raw const self.queue) { //不能偷自己 continue; } diff --git a/core/src/common/work_steal.rs b/core/src/common/work_steal.rs index 3346e45a..1b2a8357 100644 --- a/core/src/common/work_steal.rs +++ b/core/src/common/work_steal.rs @@ -299,7 +299,7 @@ impl<'l, T: Debug> LocalQueue<'l, T> { //本地队列超过一半,不再steal break; } - if std::ptr::eq(&another, &self.queue) { + if std::ptr::eq(&raw const another, &raw const self.queue) { //不能偷自己 continue; } diff --git a/core/src/coroutine/local.rs b/core/src/coroutine/local.rs index 40da92b8..d7434d68 100644 --- a/core/src/coroutine/local.rs +++ b/core/src/coroutine/local.rs @@ -27,6 +27,7 @@ impl<'c> CoroutineLocal<'c> { } /// Get a mut value ref from the coroutine local. + #[allow(clippy::mut_from_ref)] pub fn get_mut(&self, key: &'c str) -> Option<&mut V> { self.0 .get(key) diff --git a/core/src/syscall/unix/connect.rs b/core/src/syscall/unix/connect.rs index 108fdb1a..662a0a91 100644 --- a/core/src/syscall/unix/connect.rs +++ b/core/src/syscall/unix/connect.rs @@ -73,7 +73,7 @@ impl ConnectSyscall for NioConnectSyscall { libc::SOL_SOCKET, libc::SO_ERROR, std::ptr::addr_of_mut!(err).cast::(), - &mut len, + &raw mut len, ); } if r != 0 { @@ -88,7 +88,7 @@ impl ConnectSyscall for NioConnectSyscall { unsafe { let mut address = std::mem::zeroed(); let mut address_len = socklen_t::try_from(size_of_val(&address)).expect("overflow"); - r = libc::getpeername(fd, &mut address, &mut address_len); + r = libc::getpeername(fd, &raw mut address, &raw mut address_len); } } else if errno != Some(libc::EINTR) { break; diff --git a/core/src/syscall/unix/mod.rs b/core/src/syscall/unix/mod.rs index 0e9d882f..61bcdd34 100644 --- a/core/src/syscall/unix/mod.rs +++ b/core/src/syscall/unix/mod.rs @@ -1027,7 +1027,7 @@ pub extern "C" fn send_time_limit(fd: c_int) -> u64 { libc::SOL_SOCKET, libc::SO_SNDTIMEO, std::ptr::from_mut(&mut tv).cast(), - &mut len, + &raw mut len, ) == -1 { let error = std::io::Error::last_os_error(); @@ -1056,7 +1056,7 @@ pub extern "C" fn recv_time_limit(fd: c_int) -> u64 { libc::SOL_SOCKET, libc::SO_RCVTIMEO, std::ptr::from_mut(&mut tv).cast(), - &mut len, + &raw mut len, ) == -1 { let error = std::io::Error::last_os_error(); diff --git a/core/src/syscall/unix/recvmsg.rs b/core/src/syscall/unix/recvmsg.rs index 08a6c64c..034bbb3f 100644 --- a/core/src/syscall/unix/recvmsg.rs +++ b/core/src/syscall/unix/recvmsg.rs @@ -101,7 +101,7 @@ impl RecvmsgSyscall for NioRecvmsgSyscall { msg_controllen: msghdr.msg_controllen, msg_flags: msghdr.msg_flags, }; - r = self.inner.recvmsg(fn_ptr, fd, &mut arg, flags); + r = self.inner.recvmsg(fn_ptr, fd, &raw mut arg, flags); if r == 0 { std::mem::forget(vec); if blocking { diff --git a/core/src/syscall/unix/select.rs b/core/src/syscall/unix/select.rs index d56f9913..8bd21093 100644 --- a/core/src/syscall/unix/select.rs +++ b/core/src/syscall/unix/select.rs @@ -84,7 +84,7 @@ impl SelectSyscall for NioSelectSyscall { loop { r = self .inner - .select(fn_ptr, nfds, readfds, writefds, errorfds, &mut o); + .select(fn_ptr, nfds, readfds, writefds, errorfds, &raw mut o); if r != 0 || t == 0 { break; } diff --git a/core/src/syscall/unix/sendmsg.rs b/core/src/syscall/unix/sendmsg.rs index e8786fcf..9ebd6204 100644 --- a/core/src/syscall/unix/sendmsg.rs +++ b/core/src/syscall/unix/sendmsg.rs @@ -101,7 +101,7 @@ impl SendmsgSyscall for NioSendmsgSyscall { msg_controllen: msghdr.msg_controllen, msg_flags: msghdr.msg_flags, }; - r = self.inner.sendmsg(fn_ptr, fd, &arg, flags); + r = self.inner.sendmsg(fn_ptr, fd, &raw const arg, flags); if r != -1 { reset_errno(); sent += libc::size_t::try_from(r).expect("r overflow"); diff --git a/open-coroutine/build.rs b/open-coroutine/build.rs index 72dd42ea..da654c4a 100644 --- a/open-coroutine/build.rs +++ b/open-coroutine/build.rs @@ -177,7 +177,7 @@ fn main() { .arg(out_dir.clone()) .status() { - panic!("failed to build dylib {}", e); + panic!("failed to build dylib {e}"); } // correct dylib path let hook_deps = out_dir From b8f3ebc4538940ed5f83873b7b0a68dc1dd9c2a5 Mon Sep 17 00:00:00 2001 From: dragon-zhang Date: Sat, 24 May 2025 23:08:20 +0800 Subject: [PATCH 2/3] fix clippy --- core/src/common/mod.rs | 2 +- core/src/net/operator/linux/mod.rs | 6 ++++-- core/src/syscall/windows/connect.rs | 4 ++-- core/src/syscall/windows/mod.rs | 6 +++--- core/src/syscall/windows/select.rs | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/common/mod.rs b/core/src/common/mod.rs index c37551fd..46150ed4 100644 --- a/core/src/common/mod.rs +++ b/core/src/common/mod.rs @@ -160,7 +160,7 @@ pub fn page_size() -> usize { cfg_if::cfg_if! { if #[cfg(windows)] { let mut info = std::mem::zeroed(); - windows_sys::Win32::System::SystemInformation::GetSystemInfo(&mut info); + windows_sys::Win32::System::SystemInformation::GetSystemInfo(&raw mut info); ret = usize::try_from(info.dwPageSize).expect("get page size failed"); } else { ret = usize::try_from(libc::sysconf(libc::_SC_PAGESIZE)).expect("get page size failed"); diff --git a/core/src/net/operator/linux/mod.rs b/core/src/net/operator/linux/mod.rs index 6f5141a3..271a7de0 100644 --- a/core/src/net/operator/linux/mod.rs +++ b/core/src/net/operator/linux/mod.rs @@ -235,7 +235,9 @@ impl Operator<'_> { self, SUPPORT_TIMEOUT_ADD, Timeout, - Timeout::new(&timeout).build().user_data(user_data as u64) + Timeout::new(&raw const timeout) + .build() + .user_data(user_data as u64) ) } Ok(()) @@ -254,7 +256,7 @@ impl Operator<'_> { self, SUPPORT_TIMEOUT_UPDATE, TimeoutUpdate, - TimeoutUpdate::new(user_data as u64, &timeout) + TimeoutUpdate::new(user_data as u64, &raw const timeout) .build() .user_data(user_data as u64) ) diff --git a/core/src/syscall/windows/connect.rs b/core/src/syscall/windows/connect.rs index dbe23df3..5d0c4f02 100644 --- a/core/src/syscall/windows/connect.rs +++ b/core/src/syscall/windows/connect.rs @@ -71,7 +71,7 @@ impl ConnectSyscall for NioConnectSyscall { SOL_SOCKET, SO_ERROR, std::ptr::addr_of_mut!(err).cast::(), - &mut len, + &raw mut len, ); } if r != 0 { @@ -86,7 +86,7 @@ impl ConnectSyscall for NioConnectSyscall { unsafe { let mut address = std::mem::zeroed(); let mut address_len = c_int::try_from(size_of_val(&address)).expect("overflow"); - r = getpeername(fd, &mut address, &mut address_len); + r = getpeername(fd, &raw mut address, &raw mut address_len); } } else if errno != Some(WSAEINTR) { break; diff --git a/core/src/syscall/windows/mod.rs b/core/src/syscall/windows/mod.rs index 1bee4491..2c6df6fd 100644 --- a/core/src/syscall/windows/mod.rs +++ b/core/src/syscall/windows/mod.rs @@ -886,7 +886,7 @@ extern "system" fn set_non_blocking_flag(fd: SOCKET, on: bool) -> bool { windows_sys::Win32::Networking::WinSock::ioctlsocket( fd, windows_sys::Win32::Networking::WinSock::FIONBIO, - &mut argp, + &raw mut argp, ) == 0 } } @@ -913,7 +913,7 @@ pub extern "system" fn send_time_limit(fd: SOCKET) -> u64 { SOL_SOCKET, SO_SNDTIMEO, std::ptr::from_mut(&mut ms).cast(), - &mut len, + &raw mut len, ) } == -1 { @@ -950,7 +950,7 @@ pub extern "system" fn recv_time_limit(fd: SOCKET) -> u64 { SOL_SOCKET, SO_RCVTIMEO, std::ptr::from_mut(&mut ms).cast(), - &mut len, + &raw mut len, ) } == -1 { diff --git a/core/src/syscall/windows/select.rs b/core/src/syscall/windows/select.rs index f37bd0cc..5f9bb4dd 100644 --- a/core/src/syscall/windows/select.rs +++ b/core/src/syscall/windows/select.rs @@ -84,7 +84,7 @@ impl SelectSyscall for NioSelectSyscall { loop { r = self .inner - .select(fn_ptr, nfds, readfds, writefds, errorfds, &mut o); + .select(fn_ptr, nfds, readfds, writefds, errorfds, &raw mut o); if r != 0 || t == 0 { break; } From 51324addf28f4a38509f3882360ef155ec0982b2 Mon Sep 17 00:00:00 2001 From: dragon-zhang Date: Sat, 24 May 2025 23:16:33 +0800 Subject: [PATCH 3/3] fix coverage --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ffd9a223..79186a1b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -24,7 +24,7 @@ jobs: - name: Install toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.81.0 + toolchain: stable profile: minimal override: true components: llvm-tools-preview