Skip to content

Stabilise std::is_aarch64_feature_detected #86941

Closed

Description

@adamgemmell

This issue constitutes the stabilisation report as per the rustc dev guide

Summary

I'm hoping to stabilise std::is_aarch64_feature_detected which allows for runtime feature detection on aarch64 platforms. It was recently updated to include all features supported by both linux and LLVM 12, though the detection for some features isn't on non-linux platforms yet.

Documentation

The documentation for it is in this file. There's doc comments for individual features in the macro but I don't see these exposed anywhere, just on a hidden enum. Perhaps this could be improved. I've also got a small patch to mention it in the Rust Reference here.

Tests

There are tests for it in stdarch as well as rust. These are currently all up to date.

Unresolved questions

The only backwards-compatible question left to resolve is whether to split pauth into paca (address authentication) and pacg (generic authentication) as linux does. The current behaviour (together) matches LLVM (and the ARMv8-A feature FEAT_PAuth).

The x86 macro was stabilised under the simd_x86 feature - does this mean I should create a new simd_aarch64 feature to stabilise this and other aarch64 stdsimd work under?

See also:
#48556 for the tracking issue for the stdsimd feature.
#90620 for stabilising the target_feature attribute on aarch64 platforms.

Activity

  1. added
    A-SIMDArea: SIMD (Single Instruction Multiple Data)
    O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
    on Jul 7, 2021
  2. added 2 commits that reference this issue on Aug 3, 2021
  3. adamgemmell commented on Oct 25, 2021

    @adamgemmell
    ContributorAuthor

    One possible issue I've noticed is that I can't see a way to view https://doc.rust-lang.org/std/macro.is_aarch64_feature_detected.html under a different platform like you can with other crates on docs.rs. Until we can I'm not sure it's possible to make the documentation for the macro easily visible.

  4. bjorn3 commented on Oct 25, 2021

    @bjorn3
    Member

    The documentation on doc.rust-lang.org is for all platforms at the same time.

  5. adamgemmell commented on Oct 25, 2021

    @adamgemmell
    ContributorAuthor

    The issue is there's different output for multiple different platforms. I'll try removing the doc comment on the error macro in there to see if that helps. It's not useful on the docs page anyway and should just be a normal comment

  6. CryZe commented on Oct 25, 2021

    @CryZe
    Contributor

    Is the general ARM one different enough to not just stabilize it at the same time as well?

  7. Amanieu commented on Oct 25, 2021

    @Amanieu
    Member

    @rfcbot merge

  8. Amanieu commented on Oct 25, 2021

    @Amanieu
    Member

    @rfcbot merge

  9. rfcbot commented on Oct 25, 2021

    @rfcbot

    Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:

    Concerns:

    Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

    See this document for info about what commands tagged team members can give me.

  10. added
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    on Oct 25, 2021
  11. BurntSushi commented on Oct 26, 2021

    @BurntSushi
    Member

    Have the unresolved questions here been addressed?

    Also, are we stabilizing any corresponding #[target_feature(enable = "...")] values for aarch64?

  12. 44 remaining items

  13. adamgemmell commented on Feb 14, 2022

    @adamgemmell
    ContributorAuthor

    @ehuss also mentioned that the docs still show the error_macro docs for none-x86 platforms. Yet to find the reason but everything's fine with cargo doc in stdarch, but not with ./x.py doc.

  14. Amanieu commented on Feb 14, 2022

    @Amanieu
    Member

    Maybe some issue due to std_detect being a separate crate from std which causes #[cfg(doc)] to not work correctly?

  15. ehuss commented on Feb 14, 2022

    @ehuss
    Contributor

    When a dependency is built for rustdoc, cfg(doc) is not set. So the re-export is just re-exporting the normal macros, not the cfg(doc) ones.

  16. adamgemmell commented on Feb 16, 2022

    @adamgemmell
    ContributorAuthor

    That makes sense rust-lang/cargo#8811

    So, with beta cutoff next week, we could:

    • Modify the rustc-args via a section like [package.metadata.docs.rs] in std_detect's Cargo.toml. Does that docs.rs section also affect doc.rust-lang? Is there another (presumably unused as I couldn't find any) section for doc.rust-lang.org?
    • Apply the doc comments in aarch64.rs to the error macro. It will look the same with the exception of the src link, and the list of cases in the macro (which are duplicates of what's in the doc comments anyway.
    • Is there a way to expose the feature detection macro (under #[doc(hidden)]) regardless of architecture so we can put some #[cfg(doc)] logic in library/std/src/lib.rs? Potentially through a wrapper macro or reexporting under a different name/module.

    The third option seems to be more invasive so I'm going to go with the second for now until someone says otherwise.

  17. ehuss commented on Feb 16, 2022

    @ehuss
    Contributor

    cutoff next week

    Cutoff is Friday morning this week.

    Does that docs.rs section also affect doc.rust-lang?

    It does not.

    Adding comments to the error macros might help a little, but I imagine will still show up as unstable so it might still be confusing.

    Unfortunately I don't have much time to help here. It's a bit of a thorny issue that can be tricky to fix.

  18. Amanieu commented on Feb 16, 2022

    @Amanieu
    Member

    I opened rust-lang/stdarch#1283 which should fix this.

  19. added
    O-AArch64Armv8-A or later processors in AArch64 mode
    and removed
    O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
    on Mar 18, 2022
  20. added a commit that references this issue on Mar 22, 2022
  21. added a commit that references this issue on Mar 23, 2022
  22. joshtriplett commented on Jul 16, 2022

    @joshtriplett
    Member

    Following up on this: what are the remaining blockers to merge this?

  23. Amanieu commented on Jul 16, 2022

    @Amanieu
    Member

    I believe all of the concerns have been addressed so this is just waiting on a stabilization PR.

  24. adamgemmell commented on Jul 18, 2022

    @adamgemmell
    ContributorAuthor

    https://doc.rust-lang.org/std/arch/macro.is_aarch64_feature_detected.html I stabilised this back in 1.60 https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html

    Likewise with aarch64_target_feature (#90620), apologies for not closing the issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SIMDArea: SIMD (Single Instruction Multiple Data)O-AArch64Armv8-A or later processors in AArch64 modeT-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions