-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
haiku thread affinity build fix #89462
Conversation
Updates src/tools/cargo. cc @ehuss |
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
|
Please rebase/adjust to remove the updates to submodules. Just to make sure, since Haiku is not covered by the CI, has this been verified to build locally? |
6b29cd3
to
27e29b2
Compare
|
||
Ok(unsafe { NonZeroUsize::new_unchecked(sinfo.cpu_count as usize) }) | ||
Ok(NonZeroUsize::new_unchecked(sinfo.cpu_count as usize)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This escaped my attention last time, but calls of unsafe functions in new code should be annotated with comments describing why a call like this is safe. In particular I'm having trouble finding haiku documentation for get_system_info
that would guarantee that the returned cpu_count
will be non-zero. A reference here would be great.
See e.g.
rust/library/core/src/ptr/unique.rs
Line 88 in 673d0db
// SAFETY: the caller must guarantee that `ptr` is non-null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you could use a checked constructor instead, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cpu_count field is filled with the number of cpus at boot time set here https://github.com/haiku/haiku/blob/04be20a75a6e09d9c2f801fc0e6ffd4e5b486950/src/system/kernel/main.cpp#L114 and taken here afterwards https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f331814273e5857555020f/src/system/kernel/smp.cpp#L1481
@bors r+ |
📌 Commit 27e29b2e3a35b0280d51678583203a60f57b7509 has been approved by |
27e29b2
to
1ce7484
Compare
1ce7484
to
98dde56
Compare
@bors r+ |
📌 Commit 98dde56 has been approved by |
…, r=nagisa haiku thread affinity build fix
…, r=nagisa haiku thread affinity build fix
…arth Rollup of 12 pull requests Successful merges: - rust-lang#87631 (os current_exe using same approach as linux to get always the full ab…) - rust-lang#88234 (rustdoc-json: Don't ignore impls for primitive types) - rust-lang#88651 (Use the 64b inner:monotonize() implementation not the 128b one for aarch64) - rust-lang#88816 (Rustdoc migrate to table so the gui can handle >2k constants) - rust-lang#89244 (refactor: VecDeques PairSlices fields to private) - rust-lang#89364 (rustdoc-json: Encode json files with UTF-8) - rust-lang#89423 (Fix ICE caused by non_exaustive_omitted_patterns struct lint) - rust-lang#89426 (bootstrap: add config option for nix patching) - rust-lang#89462 (haiku thread affinity build fix) - rust-lang#89482 (Follow the diagnostic output style guide) - rust-lang#89504 (Don't suggest replacing region with 'static in NLL) - rust-lang#89535 (fix busted JavaScript in error index generator) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.