diff --git a/library/core/tests/cmp.rs b/library/core/tests/cmp.rs index 2b234de6795..8d0e59d5a49 100644 --- a/library/core/tests/cmp.rs +++ b/library/core/tests/cmp.rs @@ -133,6 +133,19 @@ fn ordering_const() { assert_eq!(THEN, Greater); } +#[test] +fn ordering_structural_eq() { + // test that consts of type `Ordering` are usable in patterns + + const ORDERING: Ordering = Greater; + + const REVERSE: Ordering = ORDERING.reverse(); + match Ordering::Less { + REVERSE => {} + _ => unreachable!(), + }; +} + #[test] fn cmp_default() { // Test default methods in PartialOrd and PartialEq