summaryrefslogtreecommitdiffstats
path: root/src/test/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs
blob: e01b5a26fc70625980a6f610acf3e00dd7d63f87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
use std::cmp::Ordering::{Less,Equal,Greater};

#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct A<'a> {
    x: &'a isize
}
pub fn main() {
    let (a, b) = (A { x: &1 }, A { x: &2 });

    assert_eq!(a.cmp(&a), Equal);
    assert_eq!(b.cmp(&b), Equal);

    assert_eq!(a.cmp(&b), Less);
    assert_eq!(b.cmp(&a), Greater);
}