Skip to content

std: unconditionally use preadv/pwritev on AArch64 macOS#158179

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joboet:arm_macos_preadv
Jul 8, 2026
Merged

std: unconditionally use preadv/pwritev on AArch64 macOS#158179
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joboet:arm_macos_preadv

Conversation

@joboet

@joboet joboet commented Jun 20, 2026

Copy link
Copy Markdown
Member

The stars happened to line up perfectly: macOS 11.0 was the first version to support ARM, and also the first version with preadv/pwritev. Thus we don't need to use weak linkage if the target is aarch64-apple-darwin.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 20, 2026
@rustbot

rustbot commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 12 candidates
  • Random selection from Darksonn, Mark-Simulacrum, clarfonthey, jhpratt

@Mark-Simulacrum

Copy link
Copy Markdown
Member

How did you check which versions of macOS support preadv/pwritev? Maybe we can document that into https://doc.rust-lang.org/nightly/rustc/platform-support/apple-darwin.html or some other location (seems like more generally useful information).

Also -- do we know if the non-macOS platforms support these (watchos/tvos/etc)?

@joboet

joboet commented Jun 21, 2026

Copy link
Copy Markdown
Member Author

The minimum versions are given in the header file containing the function. Interestingly, that file reports a different version (10.16) than my local SDK header files, which says that its supported since 11.0.

As for the other Apple OSes, they have these functions too, but our minimum version is too old.

Comment thread library/std/src/sys/fd/unix.rs Outdated
#[cfg(target_vendor = "apple")]
#[cfg(all(
target_vendor = "apple",
not(all(target_os = "macos", target_arch = "aarch64")) // See above.

@Darksonn Darksonn Jul 1, 2026

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.

See where? The referenced comment is quite far up. I'd update both "see above" comments to either duplicate the comment or be more specific. Or maybe just change the longer form comment immediately on this method that already talks about which Apple OS versions require weak linking and why.

View changes since the review

@joboet joboet Jul 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair enough. I changed the longer form comment and removed the comment here. Anyone curious will look at the non-special-case version anyway.

@Darksonn Darksonn added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 1, 2026
@joboet joboet force-pushed the arm_macos_preadv branch from 65aa12d to 4674b5d Compare July 7, 2026 13:07
@joboet joboet added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 7, 2026

@Darksonn Darksonn 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.

Looks good to me.

@bors r+

View changes since this review

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4674b5d has been approved by Darksonn

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
std: unconditionally use `preadv`/`pwritev` on AArch64 macOS

The stars happened to line up perfectly: macOS 11.0 was the first version to support ARM, and also the first version with `preadv`/`pwritev`. Thus we don't need to use weak linkage if the target is `aarch64-apple-darwin`.
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
std: unconditionally use `preadv`/`pwritev` on AArch64 macOS

The stars happened to line up perfectly: macOS 11.0 was the first version to support ARM, and also the first version with `preadv`/`pwritev`. Thus we don't need to use weak linkage if the target is `aarch64-apple-darwin`.
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #157385 (Enable Enzyme on x86_64-apple)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156016 (view-types: store view types in the AST)
 - #157385 (Enable Enzyme on x86_64-apple)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158085 (rustdoc: Fix sidebar heading order)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
 - #158922 (tests: clean up over-constraint on LLVM feature count)

Failed merges:

 - #158617 (allow mGCA const arguments to fall back to anon consts)
@rust-bors rust-bors Bot merged commit d4f3011 into rust-lang:main Jul 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 8, 2026
rust-timer added a commit that referenced this pull request Jul 8, 2026
Rollup merge of #158179 - joboet:arm_macos_preadv, r=Darksonn

std: unconditionally use `preadv`/`pwritev` on AArch64 macOS

The stars happened to line up perfectly: macOS 11.0 was the first version to support ARM, and also the first version with `preadv`/`pwritev`. Thus we don't need to use weak linkage if the target is `aarch64-apple-darwin`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants