Skip to content

Commit 9692231

Browse files
jieyouxugitbot
authored and
gitbot
committed
Rollup merge of rust-lang#137197 - scottmcm:cmp-20, r=ibraheemdev
Update some comparison codegen tests now that they pass in LLVM20 Fixes rust-lang#106107 Needed one tweak to the default `PartialOrd::le` to get the test to pass. Everything but the derived 2-field `le` test passes even without the change to the defaults in the trait.
2 parents cd635d9 + 33f4731 commit 9692231

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/cmp.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
13691369
#[stable(feature = "rust1", since = "1.0.0")]
13701370
#[rustc_diagnostic_item = "cmp_partialord_lt"]
13711371
fn lt(&self, other: &Rhs) -> bool {
1372-
matches!(self.partial_cmp(other), Some(Less))
1372+
self.partial_cmp(other).is_some_and(Ordering::is_lt)
13731373
}
13741374

13751375
/// Tests less than or equal to (for `self` and `other`) and is used by the
@@ -1387,7 +1387,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
13871387
#[stable(feature = "rust1", since = "1.0.0")]
13881388
#[rustc_diagnostic_item = "cmp_partialord_le"]
13891389
fn le(&self, other: &Rhs) -> bool {
1390-
matches!(self.partial_cmp(other), Some(Less | Equal))
1390+
self.partial_cmp(other).is_some_and(Ordering::is_le)
13911391
}
13921392

13931393
/// Tests greater than (for `self` and `other`) and is used by the `>`
@@ -1405,7 +1405,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
14051405
#[stable(feature = "rust1", since = "1.0.0")]
14061406
#[rustc_diagnostic_item = "cmp_partialord_gt"]
14071407
fn gt(&self, other: &Rhs) -> bool {
1408-
matches!(self.partial_cmp(other), Some(Greater))
1408+
self.partial_cmp(other).is_some_and(Ordering::is_gt)
14091409
}
14101410

14111411
/// Tests greater than or equal to (for `self` and `other`) and is used by
@@ -1423,7 +1423,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
14231423
#[stable(feature = "rust1", since = "1.0.0")]
14241424
#[rustc_diagnostic_item = "cmp_partialord_ge"]
14251425
fn ge(&self, other: &Rhs) -> bool {
1426-
matches!(self.partial_cmp(other), Some(Greater | Equal))
1426+
self.partial_cmp(other).is_some_and(Ordering::is_ge)
14271427
}
14281428
}
14291429

0 commit comments

Comments
 (0)