-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add std_detect::detect::features() API that returns iterator of target-features and reject unstable features in feature-detection macros #739
Conversation
Do you plan to rebase this? I could use something like this to map the env var content to the features. |
Yep, I'll merge this today. |
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.
It looks fine and I'd use it
It rebases cleanly but if I try to build it I get:
|
Damn I forgot about this. |
Actually I had a problem with my local repo and origin/master was pointing to the wrong place, so a rebase isn't immediate :) (if you have time to rebase and push would be great) |
7665f09
to
938b6dd
Compare
If it survives I guess it should be good to go pending some shuffling/amending. |
Gonna update stdarch upstream and do a crater run. There might be code in the wild accidentally relying on some of the unstable features. |
rust-lang#739 added per-feature stabilization of runtime CPU feature detection. In so doing, it de-stabilized some detection features that had been stable since Rust 1.27.0, breaking some published crates (on nightly). This commit re-stabilizes the subset of AVX-512 detection features that were included in 1.27.0 (that is, the pre-Ice-Lake subset). Other instruction sets (MMX in particular) remain de-stabilized, pending a decision about whether should ever stabilize them. See rust-lang/rust#68905.
…#842) * re-stabilize the AVX-512 features that were stabilized in Rust 1.27.0 #739 added per-feature stabilization of runtime CPU feature detection. In so doing, it de-stabilized some detection features that had been stable since Rust 1.27.0, breaking some published crates (on nightly). This commit re-stabilizes the subset of AVX-512 detection features that were included in 1.27.0 (that is, the pre-Ice-Lake subset). Other instruction sets (MMX in particular) remain de-stabilized, pending a decision about whether should ever stabilize them. See rust-lang/rust#68905. * add a comment explaining feature detection stability * adjust stabilizations to match most recent proposal rust-lang/rust#68905 (comment)
This PR implements an unstable
features()
function instd::detect
that returns an iterator over the target features, returning a tuple of the target-feature name, and whether it is enabled or disabled in the current host.This can be used to implement a solution to rust-lang/rust#54688 using our own run-time feature detection system.
The refactor required to implement this also allows us to close #667