fix: replace nostd_detect with generated calls to std::arch:: macros#22
Open
Petrusion wants to merge 5 commits intoronnychevalier:mainfrom
Open
fix: replace nostd_detect with generated calls to std::arch:: macros#22Petrusion wants to merge 5 commits intoronnychevalier:mainfrom
Petrusion wants to merge 5 commits intoronnychevalier:mainfrom
Conversation
ronnychevalier
requested changes
Mar 12, 2026
Owner
|
You can also update the README:
|
Owner
|
Otherwise, it is indeed a good solution to the current issue, thanks for the PR! |
Owner
|
Also, when you update the PR, I would prefer if you could override old versions of commits by squashing your changes into the original commit, and force push the branch. The idea is to avoid in the same PR commits that revert or change what other commits did (for instance, you should not have |
64359d1 to
b8a3563
Compare
Author
Ok, done. I hope I did that right. |
Replaces the notstd_detect dependency, instead generating code (during multivers-runner build) that checks for the exact features that the builds were compiled with. This approach has two major advantages over notstd_detect: cargo-multivers now works on the stable toolchain, and builds having more target features than can be detected at runtime (which caused ronnychevalier#20) now results in a compilation error (raised by std::arch:: macro) instead of silently using the least optimized build. Also adds a custom implementation of PartialEq for Build, since all_features_supported (a function pointer) shouldn't be compared for equality. See discussions in ronnychevalier#20 and ronnychevalier#21. Unlike ronnychevalier#21, this commit doesn't break cross compilation.
Since multivers-runner no longer depends on notstd_detect, the nightly toolchain requirement can be dropped.
This test tries to find the sse feature, but that won't work when ran with 'cargo test' because there were no features in JSON loaded from MULTIVERS_BUILDS_DESCRIPTION_PATH. The test made sense in the past when the runner was detecting all available features, now it only detects features the builds were compiled with.
Since the project can now fail to build on nightly when nightly rustc prints more target cpu features than std::arch::is_ARCH_feature_detected!() supports (which is the case as of this moment). A user of cargo-multivers would simply use --exclude-cpu-features on features that are causing the compile time error, but using nightly in CI would mean keeping up with which features are supported by rustc but not std::arch:: macros.
Update readme to show that nightly is no longer needed (but recommended for build-std). Also added a tip about using --exclude-cpu-features to avoid compilation errors when std::arch:: macros are not caught up to rustc's supported features.
b8a3563 to
5e0692d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Made based on discussions in #20 and #21. Fixes #20.
Summary:
build-std)--exclude-cpu-featuresnotstd_detectIt would be amazing if we could make it so that (on nightly) features unsupported by
std::archare filtered automatically. Maybe that can be solved later, but for now, reading a compilation error and adding--exclude-cpu-featuresis incomparably better than multivers silently not working.Please let me know what you think.