2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2014-11-28 11:57:41 -05:00
|
|
|
use std::cmp::Ordering::{Less,Equal,Greater};
|
2013-05-07 01:32:34 +10:00
|
|
|
|
2015-05-02 15:06:00 +02:00
|
|
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
2013-12-09 23:16:18 -08:00
|
|
|
struct A<'a> {
|
2015-03-25 17:06:52 -07:00
|
|
|
x: &'a isize
|
2013-05-07 01:32:34 +10:00
|
|
|
}
|
2013-10-21 07:45:16 -05:00
|
|
|
pub fn main() {
|
2013-10-20 17:54:53 -05:00
|
|
|
let (a, b) = (A { x: &1 }, A { x: &2 });
|
2013-05-07 01:32:34 +10:00
|
|
|
|
|
|
|
assert_eq!(a.cmp(&a), Equal);
|
|
|
|
assert_eq!(b.cmp(&b), Equal);
|
|
|
|
|
|
|
|
assert_eq!(a.cmp(&b), Less);
|
|
|
|
assert_eq!(b.cmp(&a), Greater);
|
|
|
|
}
|