]> git.lizzy.rs Git - rust.git/blobdiff - library/core/tests/cmp.rs
Rollup merge of #106709 - khuey:disable_split_dwarf_inlining_by_default, r=davidtwco
[rust.git] / library / core / tests / cmp.rs
index 2b234de6795eb9c59644a697cca5bb0a9bb7994a..8d0e59d5a4972d5a80a95d205628c664b1f66e76 100644 (file)
@@ -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