-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Use cfg_match!
in core
#138996
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
Use cfg_match!
in core
#138996
Conversation
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.
Pull Request Overview
This PR updates the core library to use cfg_match! instead of cfg_if! to take advantage of the auto‑doc(cfg) capability.
- Replace occurrences of cfg_if! with cfg_match! in multiple sorting modules and FFI definitions.
- Remove the redundant cfg_if! macro in internal_macros.rs and enable the new cfg_match feature in lib.rs.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
library/core/src/slice/sort/stable/mod.rs | Updated conditional compilation to use cfg_match! in stable sort logic. |
library/core/src/slice/sort/select.rs | Replaced cfg_if! with cfg_match! for improved pivot selection handling. |
library/core/src/slice/sort/unstable/quicksort.rs | Swapped cfg_if! for cfg_match! in quicksort partitioning routines. |
library/core/src/ffi/primitives.rs | Migrated FFI type definitions from cfg_if! to cfg_match! to align with new standards. |
library/core/src/slice/sort/unstable/mod.rs | Updated unstable sort algorithms to use cfg_match! for conditional branches. |
library/core/src/num/f32.rs | Changed f32 midpoint calculation to use cfg_match! for performance optimizations. |
library/core/src/internal_macros.rs | Removed the legacy cfg_if! macro implementation. |
library/core/src/lib.rs | Added the cfg_match feature flag to enable new conditional compilation support. |
Well, I wanted to see how well that worked, and no, that's wrong. Uses of Probably won't be clicking that button ever again. |
Great, thank you! |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing a2e6356 (parent) -> 1644cb0 (this PR) Test differencesShow 58 test diffsAdditionally, 58 doctest diffs were found. These are ignored, as they are noisy. Job group index |
Finished benchmarking commit (1644cb0): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 3.0%, secondary 2.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -2.3%, secondary 2.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 778.152s -> 777.476s (-0.09%) |
All of these uses of
cfg_if!
do not utilize thatcfg_if!
works with auto-doc(cfg)
, so no functionality is lost from switching to usecfg_match!
instead. We do lose what rustfmt special support exists forcfg_if!
, though.Tracking issue: #115585