Skip to content

Commit 4d38190

Browse files
committed
fix compile on rust 1.83.0
1 parent fdeb2c4 commit 4d38190

File tree

3 files changed

+9
-53
lines changed

3 files changed

+9
-53
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
x86_64-pc-windows-msvc,
8787
i686-pc-windows-msvc,
8888
]
89-
channel: [ 1.81.0, nightly-2024-08-02 ]
89+
channel: [ stable, nightly ]
9090
include:
9191
- target: x86_64-unknown-linux-gnu
9292
os: ubuntu-latest

core/src/syscall/windows/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<I: SelectSyscall> SelectSyscall for NioSelectSyscall<I> {
9797
}
9898
_ = EventLoops::wait_event(Some(Duration::from_millis(u64::from(t.min(x)))));
9999
if t != c_uint::MAX {
100-
t = if t > x { t - x } else { 0 };
100+
t = t.saturating_sub(x);
101101
}
102102
if x < 16 {
103103
x <<= 1;

open-coroutine/build.rs

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use cargo_metadata::MetadataCommand;
22
use std::env::var;
3-
use std::fs::{copy, read_dir};
43
use std::path::PathBuf;
54
use tracing::{info, Level};
65
use tracing_appender::rolling::{RollingFileAppender, Rotation};
@@ -75,7 +74,7 @@ fn main() {
7574
.join("registry")
7675
.join("src");
7776
let crates_parent_dirs = Vec::from_iter(
78-
read_dir(dep_src_dir.clone())
77+
std::fs::read_dir(dep_src_dir.clone())
7978
.expect("Failed to read deps")
8079
.flatten(),
8180
);
@@ -164,55 +163,12 @@ fn main() {
164163
{
165164
panic!("failed to build dylib {}", e);
166165
}
167-
// correct dylib path
168-
let hook_deps = out_dir
169-
.join(target)
170-
.join(if cfg!(debug_assertions) {
171-
"debug"
172-
} else {
173-
"release"
174-
})
175-
.join("deps");
176-
let deps = out_dir
177-
.parent()
178-
.expect("can not find deps dir")
179-
.parent()
180-
.expect("can not find deps dir")
181-
.parent()
182-
.expect("can not find deps dir")
183-
.join("deps");
184-
for entry in read_dir(hook_deps.clone())
185-
.expect("can not find deps dir")
186-
.flatten()
187-
{
188-
let file_name = entry.file_name().to_string_lossy().to_string();
189-
if !file_name.contains("open_coroutine_hook") {
190-
continue;
191-
}
192-
if cfg!(target_os = "linux") && file_name.ends_with(".so") {
193-
let from = hook_deps.join(file_name);
194-
let to = deps.join("libopen_coroutine_hook.so");
195-
copy(from.clone(), to.clone()).expect("copy to libopen_coroutine_hook.so failed!");
196-
info!("copy {:?} to {:?} success!", from, to);
197-
} else if cfg!(target_os = "macos") && file_name.ends_with(".dylib") {
198-
let from = hook_deps.join(file_name);
199-
let to = deps.join("libopen_coroutine_hook.dylib");
200-
copy(from.clone(), to.clone()).expect("copy to libopen_coroutine_hook.dylib failed!");
201-
info!("copy {:?} to {:?} success!", from, to);
202-
} else if cfg!(windows) {
203-
if file_name.ends_with(".dll") {
204-
let from = hook_deps.join(file_name);
205-
let to = deps.join("open_coroutine_hook.dll");
206-
copy(from.clone(), to.clone()).expect("copy to open_coroutine_hook.dll failed!");
207-
info!("copy {:?} to {:?} success!", from, to);
208-
} else if file_name.ends_with(".lib") {
209-
let from = hook_deps.join(file_name);
210-
let to = deps.join("open_coroutine_hook.lib");
211-
copy(from.clone(), to.clone()).expect("copy to open_coroutine_hook.lib failed!");
212-
info!("copy {:?} to {:?} success!", from, to);
213-
}
214-
}
215-
}
216166
// link dylib
167+
let hook_deps = out_dir.join(target).join(if cfg!(debug_assertions) {
168+
"debug"
169+
} else {
170+
"release"
171+
});
172+
println!("cargo:rustc-link-search=native={}", hook_deps.display());
217173
println!("cargo:rustc-link-lib=dylib=open_coroutine_hook");
218174
}

0 commit comments

Comments
 (0)