2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-11-28 10:57:41 -06:00
|
|
|
use std::cmp::Ordering::{Less,Equal,Greater};
|
2013-05-06 10:32:34 -05:00
|
|
|
|
2015-05-02 08:06:00 -05:00
|
|
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
2013-12-10 01:16:18 -06:00
|
|
|
struct A<'a> {
|
2015-03-25 19:06:52 -05:00
|
|
|
x: &'a isize
|
2013-05-06 10:32:34 -05: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-06 10:32:34 -05: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);
|
|
|
|
}
|