Add unstable const_ordering feature, and some tests.
This commit is contained in:
parent
6b0d44e92a
commit
5fac991bf6
3 changed files with 20 additions and 0 deletions
17
src/test/ui/consts/const-ordering.rs
Normal file
17
src/test/ui/consts/const-ordering.rs
Normal file
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue