about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCDirkx <christiaan@dirkx.com>2020-08-30 19:40:00 +0200
committerCDirkx <christiaan@dirkx.com>2020-08-30 19:40:00 +0200
commit5fac991bf6bc4b07df9b4b4eb3fcb0c5487973c4 (patch)
tree7c3fbd3db128134e09fb4a873802f8ecb8c19c83 /src
parent6b0d44e92a529962792d3a5f1e7b44b6e3c6ed05 (diff)
downloadrust-5fac991bf6bc4b07df9b4b4eb3fcb0c5487973c4.tar.gz
rust-5fac991bf6bc4b07df9b4b4eb3fcb0c5487973c4.zip
Add unstable `const_ordering` feature, and some tests.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/consts/const-ordering.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-ordering.rs b/src/test/ui/consts/const-ordering.rs
new file mode 100644
index 00000000000..9feb2b27dad
--- /dev/null
+++ b/src/test/ui/consts/const-ordering.rs
@@ -0,0 +1,17 @@
+// run-pass
+
+#![feature(const_ordering)]
+
+use std::cmp::Ordering;
+
+// the following methods of core::cmp::Ordering are const:
+//  - reverse
+//  - then
+
+fn main() {
+    const REVERSE : Ordering = Ordering::Greater.reverse();
+    assert_eq!(REVERSE, Ordering::Less);
+
+    const THEN : Ordering = Ordering::Equal.then(REVERSE);
+    assert_eq!(THEN, Ordering::Less);
+}