2 // check that the derived impls for the comparison traits shortcircuit
3 // where possible, by having a type that panics when compared as the
4 // second element, so this passes iff the instances shortcircuit.
7 use std::cmp::Ordering;
10 impl PartialEq for FailCmp {
11 fn eq(&self, _: &FailCmp) -> bool { panic!("eq") }
14 impl PartialOrd for FailCmp {
15 fn partial_cmp(&self, _: &FailCmp) -> Option<Ordering> { panic!("partial_cmp") }
18 impl Eq for FailCmp {}
20 impl Ord for FailCmp {
21 fn cmp(&self, _: &FailCmp) -> Ordering { panic!("cmp") }
24 #[derive(PartialEq,PartialOrd,Eq,Ord)]
31 let a = ShortCircuit { x: 1, y: FailCmp };
32 let b = ShortCircuit { x: 2, y: FailCmp };
36 assert_eq!(a.cmp(&b), ::std::cmp::Ordering::Less);