Skip to content

Commit 1a25d19

Browse files
committed
Auto merge of #8491 - matthiaskrgr:no_num_cpus, r=flip1995
tests: use std::thread::available_parallelism() instead of num_cpus to get thread count removes the dependency added in #8451 --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: tests: use std::thread::available_parallelism() instead of num_cpus to get thread count
2 parents b8a205a + 7a15061 commit 1a25d19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ futures = "0.3"
5151
parking_lot = "0.11.2"
5252
tokio = { version = "1", features = ["io-util"] }
5353
rustc-semver = "1.1"
54-
num_cpus = "1.13"
5554

5655
[build-dependencies]
5756
rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }

tests/compile-test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ fn run_ui() {
168168
let _threads = VarGuard::set(
169169
"RUST_TEST_THREADS",
170170
// if RUST_TEST_THREADS is set, adhere to it, otherwise override it
171-
env::var("RUST_TEST_THREADS").unwrap_or_else(|_| num_cpus::get().to_string()),
171+
env::var("RUST_TEST_THREADS").unwrap_or_else(|_| {
172+
std::thread::available_parallelism()
173+
.map_or(1, std::num::NonZeroUsize::get)
174+
.to_string()
175+
}),
172176
);
173177
compiletest::run_tests(&config);
174178
}

0 commit comments

Comments
 (0)