]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/cmp.rs
Rollup merge of #105846 - compiler-errors:issue-105838, r=jackh726
[rust.git] / library / core / src / cmp.rs
index 6a6e30c01d6a7d476ea087000a56defd24a1345b..ebf5baa3c020bf898a68c25094675f4f0422e81d 100644 (file)
@@ -798,9 +798,12 @@ fn max(self, other: Self) -> Self
         Self: Sized,
         Self: ~const Destruct,
     {
-        // HACK(fee1-dead): go back to using `self.max_by(other, Ord::cmp)`
-        // when trait methods are allowed to be used when a const closure is
-        // expected.
+        #[cfg(not(bootstrap))]
+        {
+            max_by(self, other, Ord::cmp)
+        }
+
+        #[cfg(bootstrap)]
         match self.cmp(&other) {
             Ordering::Less | Ordering::Equal => other,
             Ordering::Greater => self,
@@ -825,9 +828,12 @@ fn min(self, other: Self) -> Self
         Self: Sized,
         Self: ~const Destruct,
     {
-        // HACK(fee1-dead): go back to using `self.min_by(other, Ord::cmp)`
-        // when trait methods are allowed to be used when a const closure is
-        // expected.
+        #[cfg(not(bootstrap))]
+        {
+            min_by(self, other, Ord::cmp)
+        }
+
+        #[cfg(bootstrap)]
         match self.cmp(&other) {
             Ordering::Less | Ordering::Equal => self,
             Ordering::Greater => other,