Skip to content

Conversation

pthariensflame
Copy link
Contributor

@pthariensflame pthariensflame commented Sep 10, 2025

Synchronizes the list (and re-sorts it alphabetically by FEAT name) with the initial release version of macOS Tahoe.

@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 Sep 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

Now that this feature has a standard identifier, Darwin has started exposing it accordingly, in addition to the existing less-standard way.  Check both, and enable the `crc` feature if either identifier for it is present to ensure backwards and forwards compatibility.
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@pthariensflame pthariensflame changed the title std_detect on Darwin: add new-style detection for FEAT_CRC32 std_detect on Darwin AArch64: update features Sep 14, 2025
Brings the list of checkable features up to date with the initial release of macOS 26 "Tahoe".
let mte_no_address_tags = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_NO_ADDRESS_TAGS");
let mte_store_only = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_STORE_ONLY");
let mte3 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE3");
let mte4 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE4");
Copy link
Member

Choose a reason for hiding this comment

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

Why not add to this block for the new detected features? Do the changes in this PR expose new stable surface area (I'm not super familiar with how std_detect is wired up...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commented out part of the list contains features that std_detect doesn’t currently keep track of; if and when any of them become trackable they should get moved to the non-commented list above. See detect/arch/aarch64.rs for the list of features that are currently tracked; it’s related to LLVM’s support for them.

As for “stable surface area”, this changes it to the extent that existing code recompiled with a new Rust release may start detecting features on AArch64 Darwin that it didn’t before, if running on a sufficiently new Apple Silicon chip. That’s the only possible change; no new symbols are exposed, nor is any program able to ask/talk about anything new it couldn’t before. It just might get different answers to those existing questions than it used to, under the above circumstances.

Copy link
Member

Choose a reason for hiding this comment

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

Can you write up a description of what answers are different with this PR?

Copy link
Contributor Author

@pthariensflame pthariensflame Sep 15, 2025

Choose a reason for hiding this comment

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

Can you write up a description of what answers are different with this PR?

Absolutely!

The specific questions whose answers might change are all of the form is_aarch64_feature_detected!(…) executed on an Apple OS on an Arm CPU, where is one of the following:

  • "crc": this currently returns true for all Apple Silicon chips; prior to this PR, there is a possibility that under future Apple OSes that answer could incorrectly become false. This PR ensures that it remains true for the foreseeable future, accurately reflecting the presence of this mandatory CPU feature.
  • "mte": this currently always returns false on these platforms, reflecting that no current Apple Silicon CPU supports the Memory Tagging Extension. Apple have at this point publicly announced that their incoming A19 and A19 Pro CPUs support this feature, and it’s a safe bet given the history of Apple Silicon that future chips (M5 family and onward) will also have it. Darwin now exposes a way to check for this, so after this PR Rust code running on Darwin on such a near-future CPU will accurately report true to this question.
  • "sme2p1": Similarly to "mte"’s case above, this is a feature that Darwin newly exposes a way to check for; it is version 2.1 of the Scalable Matrix Extension (SME). SME 2.0 is already exposed correctly on Apple M4/A18 family chips, and while no official word has come that A19/M5 will have SME 2.1, unofficial sources heavily suggest it, and taking advantage of the newly exposed ability to check for it is a good idea anyway.

No other uses of is_aarch64_feature_detected! are changed by this PR, and it remains entirely unaffected on all non-Darwin platforms. The only other change to the non-commented code in this PR is to alphabetize the list properly since it was a bit out of order before; that doesn’t change the functionality of the code at all. Commented code is altered to reflect that Darwin now exposes a variety of subversions and subfeatures of MTE, of which only MTE(1) and MTE2 are something is_aarch64_feature_detected! can ask about (and then only as a pair).

@Mark-Simulacrum
Copy link
Member

r? @Amanieu -- not sure if we have a policy for needing libs-api FCP for exposing new detections in this code or not, but seems plausible that we would want that. Would also be useful to get your opinion on the code changes, I think you're most familiar with this area.

@rustbot rustbot assigned Amanieu and unassigned Mark-Simulacrum Sep 21, 2025
@Amanieu
Copy link
Member

Amanieu commented Sep 21, 2025

This doesn't need an FCP since it's not modifying a public API, it's just making the existing API work better under a particular platform. The code changes also look fine to me.

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 21, 2025

📌 Commit d49f6a7 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors 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 Sep 21, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 22, 2025
std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
bors added a commit that referenced this pull request Sep 22, 2025
Rollup of 8 pull requests

Successful merges:

 - #146317 (Add panic=immediate-abort)
 - #146397 (std_detect on Darwin AArch64: update features)
 - #146594 (bootstrap: Don't force -static for musl targets in cc-rs)
 - #146791 (emit attribute for readonly non-pure inline assembly)
 - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - #146838 (Introduce "wrapper" helpers to rustdoc)
 - #146846 (btree InternalNode::new safety comments)
 - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 22, 2025
std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
bors added a commit that referenced this pull request Sep 22, 2025
Rollup of 10 pull requests

Successful merges:

 - #145411 (regression test for Cow<[u8]> layout)
 - #146317 (Add panic=immediate-abort)
 - #146397 (std_detect on Darwin AArch64: update features)
 - #146594 (bootstrap: Don't force -static for musl targets in cc-rs)
 - #146652 (Port `feature` to the new attribute system)
 - #146791 (emit attribute for readonly non-pure inline assembly)
 - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - #146838 (Introduce "wrapper" helpers to rustdoc)
 - #146846 (btree InternalNode::new safety comments)
 - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 22, 2025
std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
bors added a commit that referenced this pull request Sep 22, 2025
Rollup of 9 pull requests

Successful merges:

 - #145411 (regression test for Cow<[u8]> layout)
 - #146317 (Add panic=immediate-abort)
 - #146397 (std_detect on Darwin AArch64: update features)
 - #146594 (bootstrap: Don't force -static for musl targets in cc-rs)
 - #146791 (emit attribute for readonly non-pure inline assembly)
 - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - #146838 (Introduce "wrapper" helpers to rustdoc)
 - #146846 (btree InternalNode::new safety comments)
 - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 22, 2025
Rollup of 9 pull requests

Successful merges:

 - #145411 (regression test for Cow<[u8]> layout)
 - #146317 (Add panic=immediate-abort)
 - #146397 (std_detect on Darwin AArch64: update features)
 - #146594 (bootstrap: Don't force -static for musl targets in cc-rs)
 - #146791 (emit attribute for readonly non-pure inline assembly)
 - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - #146838 (Introduce "wrapper" helpers to rustdoc)
 - #146846 (btree InternalNode::new safety comments)
 - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 22, 2025
Rollup of 9 pull requests

Successful merges:

 - #145411 (regression test for Cow<[u8]> layout)
 - #146397 (std_detect on Darwin AArch64: update features)
 - #146791 (emit attribute for readonly non-pure inline assembly)
 - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - #146838 (Introduce "wrapper" helpers to rustdoc)
 - #146845 (Add self-profile events for target-machine creation)
 - #146846 (btree InternalNode::new safety comments)
 - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)
 - #146878 (assert_unsafe_precondition: fix some incorrect check_language_ub)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d144638 into rust-lang:master Sep 22, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 22, 2025
rust-timer added a commit that referenced this pull request Sep 22, 2025
Rollup merge of #146397 - pthariensflame:patch-1, r=Amanieu

std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
@pthariensflame pthariensflame deleted the patch-1 branch September 23, 2025 15:22
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#145411 (regression test for Cow<[u8]> layout)
 - rust-lang#146397 (std_detect on Darwin AArch64: update features)
 - rust-lang#146791 (emit attribute for readonly non-pure inline assembly)
 - rust-lang#146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - rust-lang#146838 (Introduce "wrapper" helpers to rustdoc)
 - rust-lang#146845 (Add self-profile events for target-machine creation)
 - rust-lang#146846 (btree InternalNode::new safety comments)
 - rust-lang#146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)
 - rust-lang#146878 (assert_unsafe_precondition: fix some incorrect check_language_ub)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

5 participants