diff options
Diffstat (limited to 'tests/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs')
-rw-r--r-- | tests/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs b/tests/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs new file mode 100644 index 000000000..e01b5a26f --- /dev/null +++ b/tests/ui/deriving/deriving-self-lifetime-totalord-totaleq.rs @@ -0,0 +1,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); +} |