RustCrypto / RustCrypto/utils

cpufeatures: use `is_*_feature_detected!` on targets with `std`?

Open
#1,534 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
674
Forks
170
Avg merge
1d 12h
Merged PRs (30d)
10

Description

Sadly, the only popular target arch where a proper no_std target feature detection is available is x86(-64). For other targets we use OS-specific detection code.

Targets with OS generally have std, so we could use is_*_feature_detected! macros on them instead of re-implementing OS-specific target feature detection code. This would allow us to automatically support new target features with minimal maintenance burden.

I suggest we switch to the macros on selected targets with available std in the next breaking release.

One open question is whether we should use is_x86_feature_detected! on targets with OS or keep using our CPUID code.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the cpufeatures target-detection implementation and the referenced is_*_feature_detected! macros. Compare the macro-based and CPUID approaches on OS targets, including the open x86 question. Done means the selected targets have an agreed detection strategy suitable for the next breaking release and new target features require less maintenance.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.