From 64b04e535d5eba3509721c1955f5c782be014ab4 Mon Sep 17 00:00:00 2001 From: loongs-zhang <1936978077@qq.com> Date: Mon, 9 Feb 2026 18:41:22 +0800 Subject: [PATCH] Update rand requirement from 0.9 to 0.10 --- Cargo.toml | 2 +- core/src/common/ci.rs | 2 +- core/src/common/mod.rs | 4 +--- core/src/common/ordered_work_steal.rs | 2 +- core/src/common/work_steal.rs | 2 +- core/src/coroutine/korosensei.rs | 2 +- core/src/net/event_loop.rs | 2 +- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5fb6ec50..221add9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ polling = "2.8.0" educe = "0.6.0" libc = "0.2" -rand = "0.9" +rand = "0.10" st3 = "0.4" crossbeam-deque = "0.8" time = "0.3" diff --git a/core/src/common/ci.rs b/core/src/common/ci.rs index a737ed7f..7150f4ef 100644 --- a/core/src/common/ci.rs +++ b/core/src/common/ci.rs @@ -4,7 +4,7 @@ use std::time::{Duration, Instant}; pub fn init() { let _ = std::thread::spawn(|| { // exit after 600 seconds, just for CI - let sleep_time = Duration::from_secs(600); + let sleep_time = Duration::from_mins(10); let start_time = Instant::now(); std::thread::sleep(sleep_time); let cost = Instant::now().saturating_duration_since(start_time); diff --git a/core/src/common/mod.rs b/core/src/common/mod.rs index 46150ed4..bf39ecb2 100644 --- a/core/src/common/mod.rs +++ b/core/src/common/mod.rs @@ -128,9 +128,7 @@ pub fn now() -> u64 { /// current ns time add `dur`. #[must_use] pub fn get_timeout_time(dur: Duration) -> u64 { - u64::try_from(dur.as_nanos()) - .map(|d| d.saturating_add(now())) - .unwrap_or(u64::MAX) + u64::try_from(dur.as_nanos()).map_or(u64::MAX, |d| d.saturating_add(now())) } /// Make the total time into slices. diff --git a/core/src/common/ordered_work_steal.rs b/core/src/common/ordered_work_steal.rs index b82e3ead..dd67625c 100644 --- a/core/src/common/ordered_work_steal.rs +++ b/core/src/common/ordered_work_steal.rs @@ -1,6 +1,6 @@ use crossbeam_deque::{Injector, Steal}; use crossbeam_skiplist::SkipMap; -use rand::Rng; +use rand::RngExt; use st3::fifo::Worker; use std::collections::VecDeque; use std::ffi::c_longlong; diff --git a/core/src/common/work_steal.rs b/core/src/common/work_steal.rs index b700393c..ca9cac4a 100644 --- a/core/src/common/work_steal.rs +++ b/core/src/common/work_steal.rs @@ -1,5 +1,5 @@ use crossbeam_deque::{Injector, Steal}; -use rand::Rng; +use rand::RngExt; use st3::fifo::Worker; use std::collections::VecDeque; use std::fmt::Debug; diff --git a/core/src/coroutine/korosensei.rs b/core/src/coroutine/korosensei.rs index 6262f159..13760780 100644 --- a/core/src/coroutine/korosensei.rs +++ b/core/src/coroutine/korosensei.rs @@ -57,7 +57,7 @@ impl<'c, Param, Yield, Return> Coroutine<'c, Param, Yield, Return> { any(target_os = "linux", target_os = "android"), target_arch = "x86", ))] { - let sp = u64::from(std::ffi::c_uint::from_ne_bytes(context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")].to_ne_bytes())); + let sp = u64::from(u32::from_ne_bytes(context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")].to_ne_bytes())); } else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] { let sp = u64::try_from((*context.uc_mcontext).__ss.__rsp).expect("overflow"); } else if #[cfg(all( diff --git a/core/src/net/event_loop.rs b/core/src/net/event_loop.rs index 126dbdbe..aa2040e3 100644 --- a/core/src/net/event_loop.rs +++ b/core/src/net/event_loop.rs @@ -6,7 +6,7 @@ use crate::scheduler::SchedulableCoroutine; use crate::{error, impl_current_for, impl_display_by_debug, info}; use dashmap::DashSet; use once_cell::sync::Lazy; -use rand::Rng; +use rand::RngExt; use std::ffi::{c_char, c_int, c_void, CStr, CString}; use std::io::{Error, ErrorKind}; use std::marker::PhantomData;