add const hack comment

This commit is contained in:
Deadbeef
2022-01-14 16:55:19 +08:00
parent a89510e5f9
commit 65fca6db19
+6
View File
@@ -802,6 +802,9 @@ 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.
match self.cmp(&other) {
Ordering::Less | Ordering::Equal => other,
Ordering::Greater => self,
@@ -826,6 +829,9 @@ 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.
match self.cmp(&other) {
Ordering::Less | Ordering::Equal => self,
Ordering::Greater => other,