Skip to content

chore: replace num_cpus with available_parallelism - #2946

Merged
taiki-e merged 4 commits into
rust-lang:masterfrom
tisonkun:replace-numcpu-with-available_parallelism
May 23, 2025
Merged

taiki-e merged 4 commits into
rust-lang:masterfrom
tisonkun:replace-numcpu-with-available_parallelism

Conversation

@tisonkun

@tisonkun tisonkun commented Apr 8, 2025 •

Copy link
Copy Markdown
Contributor

Related discussion: tokio-rs/tokio#6211 and tokio-rs/tokio#6709

cc @taiki-e

@rustbot rustbot added A-executor Area: futures::executor S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2025
@tisonkun

tisonkun commented Apr 8, 2025

Copy link
Copy Markdown
Contributor Author

https://github.com/rust-lang/futures-rs/actions/runs/14322140475/job/40140977417

Failed to compile iovec 0.1.0 - doesn't seem to be related. It should be resolved to 0.1.4 and previously runs all passed. This patch doesn't touch it.

@taiki-e

taiki-e commented Apr 16, 2025

Copy link
Copy Markdown
Member

iovec crate is used by old dependencies that are enabled via the compat/compat-io feature, but given that our traits are planned to remain basically unchanged between futures 0.3 and 0.4, it is not a problem to remove compat and compat-io features in 0.4. (From a maintenance standpoint, their removal is also welcome because they were not easy to maintain (e.g., #2514).)

@taiki-e taiki-e removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2025
@tisonkun

Copy link
Copy Markdown
Contributor Author

Thanks for your information! Seems I can take a look at dropping dependency to iovec in another PR. For this one, we'd on hold until then or I can rebase on master and ping you once CI is happy.

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun
tisonkun force-pushed the replace-numcpu-with-available_parallelism branch from 0be4cdd to 9bc953e Compare April 24, 2025 09:42
@tisonkun

Copy link
Copy Markdown
Contributor Author

Seems libc's version causes this issue.

Previously, we have:

  Adding libc v0.2.26 (available: v0.2.172)

Now, it becomes:

  Adding libc v0.2.0 (available: v0.2.172)

Maybe num_cpus add a requirement to help indicates the version. I'll try to add a specific libc version and see.

@tisonkun

tisonkun commented May 19, 2025 •

Copy link
Copy Markdown
Contributor Author

For iovec itself, it's depends on tokio's code path (also mio and bytes), it should deserve a new patch to investigate.

tisonkun added 2 commits May 19, 2025 10:50
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@rustbot rustbot added A-lock Area: futures::lock A-stream Area: futures::stream labels May 19, 2025
@tisonkun

Copy link
Copy Markdown
Contributor Author

@taiki-e This patch should be ready for merge now.

The clippy related changes are attached because we have a clippy CI check that runs on latest compiler. I suppose it's intended.

@taiki-e taiki-e left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@taiki-e
taiki-e merged commit 07359ef into rust-lang:master May 23, 2025
@tisonkun
tisonkun deleted the replace-numcpu-with-available_parallelism branch May 23, 2025 15:03
taiki-e pushed a commit that referenced this pull request Feb 15, 2026
Signed-off-by: tison <wander4096@gmail.com>
@taiki-e taiki-e mentioned this pull request Feb 15, 2026
taiki-e pushed a commit that referenced this pull request Feb 15, 2026
Signed-off-by: tison <wander4096@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.3-backport: completed A-executor Area: futures::executor A-lock Area: futures::lock A-stream Area: futures::stream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants