Skip to content

Commit 2549b60

Browse files
committed
Allow trait method paths to satisfy const Fn bounds
1 parent fb1993d commit 2549b60

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

core/src/cmp.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,12 @@ pub trait Ord: Eq + PartialOrd<Self> {
800800
Self: Sized,
801801
Self: ~const Destruct,
802802
{
803-
// HACK(fee1-dead): go back to using `self.max_by(other, Ord::cmp)`
804-
// when trait methods are allowed to be used when a const closure is
805-
// expected.
803+
#[cfg(not(bootstrap))]
804+
{
805+
max_by(self, other, Ord::cmp)
806+
}
807+
808+
#[cfg(bootstrap)]
806809
match self.cmp(&other) {
807810
Ordering::Less | Ordering::Equal => other,
808811
Ordering::Greater => self,
@@ -827,9 +830,12 @@ pub trait Ord: Eq + PartialOrd<Self> {
827830
Self: Sized,
828831
Self: ~const Destruct,
829832
{
830-
// HACK(fee1-dead): go back to using `self.min_by(other, Ord::cmp)`
831-
// when trait methods are allowed to be used when a const closure is
832-
// expected.
833+
#[cfg(not(bootstrap))]
834+
{
835+
min_by(self, other, Ord::cmp)
836+
}
837+
838+
#[cfg(bootstrap)]
833839
match self.cmp(&other) {
834840
Ordering::Less | Ordering::Equal => self,
835841
Ordering::Greater => other,

0 commit comments

Comments
 (0)