about summary refs log tree commit diff
path: root/library/core/src/slice
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-22 02:14:23 +0000
committerbors <bors@rust-lang.org>2025-05-22 02:14:23 +0000
commit6eef33bb399cabfab16aa4e0825895f5f32f4e26 (patch)
treed5ad348ac4a4f699ed35aafc4327a09faaa62dd0 /library/core/src/slice
parent5df0f729f5355cb3cd91f6bcff13566ae96dc220 (diff)
parent999967a57dce987bbad353d152f03c3ef67d41f2 (diff)
Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieu
Rename `cfg_match!` to `cfg_select!`

[`@Nemo157` pointed out](https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605) that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/115585

[1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
Diffstat (limited to 'library/core/src/slice')
-rw-r--r--library/core/src/slice/sort/select.rs4
-rw-r--r--library/core/src/slice/sort/stable/mod.rs6
-rw-r--r--library/core/src/slice/sort/unstable/mod.rs4
-rw-r--r--library/core/src/slice/sort/unstable/quicksort.rs4
4 files changed, 9 insertions, 9 deletions
diff --git a/library/core/src/slice/sort/select.rs b/library/core/src/slice/sort/select.rs
index c4808b1065d..82194db7fd8 100644
--- a/library/core/src/slice/sort/select.rs
+++ b/library/core/src/slice/sort/select.rs
@@ -6,7 +6,7 @@
 //! for pivot selection. Using this as a fallback ensures O(n) worst case running time with
 //! better performance than one would get using heapsort as fallback.
 
-use crate::cfg_match;
+use crate::cfg_select;
 use crate::mem::{self, SizedTypeProperties};
 #[cfg(not(feature = "optimize_for_size"))]
 use crate::slice::sort::shared::pivot::choose_pivot;
@@ -42,7 +42,7 @@ where
         let min_idx = min_index(v, &mut is_less).unwrap();
         v.swap(min_idx, index);
     } else {
-        cfg_match! {
+        cfg_select! {
             feature = "optimize_for_size" => {
                 median_of_medians(v, &mut is_less, index);
             }
diff --git a/library/core/src/slice/sort/stable/mod.rs b/library/core/src/slice/sort/stable/mod.rs
index a36e5f7801d..8b4e5c0c8c3 100644
--- a/library/core/src/slice/sort/stable/mod.rs
+++ b/library/core/src/slice/sort/stable/mod.rs
@@ -7,7 +7,7 @@ use crate::mem::{MaybeUninit, SizedTypeProperties};
 use crate::slice::sort::shared::smallsort::{
     SMALL_SORT_GENERAL_SCRATCH_LEN, StableSmallSortTypeImpl, insertion_sort_shift_left,
 };
-use crate::{cfg_match, intrinsics};
+use crate::{cfg_select, intrinsics};
 
 pub(crate) mod merge;
 
@@ -39,13 +39,13 @@ pub fn sort<T, F: FnMut(&T, &T) -> bool, BufT: BufGuard<T>>(v: &mut [T], is_less
         return;
     }
 
-    cfg_match! {
+    cfg_select! {
         any(feature = "optimize_for_size", target_pointer_width = "16") => {
             // Unlike driftsort, mergesort only requires len / 2,
             // not len - len / 2.
             let alloc_len = len / 2;
 
-            cfg_match! {
+            cfg_select! {
                 target_pointer_width = "16" => {
                     let mut heap_buf = BufT::with_capacity(alloc_len);
                     let scratch = heap_buf.as_uninit_slice_mut();
diff --git a/library/core/src/slice/sort/unstable/mod.rs b/library/core/src/slice/sort/unstable/mod.rs
index b6c2e05a06a..d4df8d3a264 100644
--- a/library/core/src/slice/sort/unstable/mod.rs
+++ b/library/core/src/slice/sort/unstable/mod.rs
@@ -5,7 +5,7 @@ use crate::mem::SizedTypeProperties;
 use crate::slice::sort::shared::find_existing_run;
 #[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))]
 use crate::slice::sort::shared::smallsort::insertion_sort_shift_left;
-use crate::{cfg_match, intrinsics};
+use crate::{cfg_select, intrinsics};
 
 pub(crate) mod heapsort;
 pub(crate) mod quicksort;
@@ -30,7 +30,7 @@ pub fn sort<T, F: FnMut(&T, &T) -> bool>(v: &mut [T], is_less: &mut F) {
         return;
     }
 
-    cfg_match! {
+    cfg_select! {
         any(feature = "optimize_for_size", target_pointer_width = "16") => {
             heapsort::heapsort(v, is_less);
         }
diff --git a/library/core/src/slice/sort/unstable/quicksort.rs b/library/core/src/slice/sort/unstable/quicksort.rs
index 7e6cfb55990..98efee242eb 100644
--- a/library/core/src/slice/sort/unstable/quicksort.rs
+++ b/library/core/src/slice/sort/unstable/quicksort.rs
@@ -9,7 +9,7 @@ use crate::slice::sort::shared::pivot::choose_pivot;
 use crate::slice::sort::shared::smallsort::UnstableSmallSortTypeImpl;
 #[cfg(not(feature = "optimize_for_size"))]
 use crate::slice::sort::unstable::heapsort;
-use crate::{cfg_match, intrinsics, ptr};
+use crate::{cfg_select, intrinsics, ptr};
 
 /// Sorts `v` recursively.
 ///
@@ -142,7 +142,7 @@ const fn inst_partition<T, F: FnMut(&T, &T) -> bool>() -> fn(&mut [T], &T, &mut
     if size_of::<T>() <= MAX_BRANCHLESS_PARTITION_SIZE {
         // Specialize for types that are relatively cheap to copy, where branchless optimizations
         // have large leverage e.g. `u64` and `String`.
-        cfg_match! {
+        cfg_select! {
             feature = "optimize_for_size" => {
                 partition_lomuto_branchless_simple::<T, F>
             }