@@ -214,14 +214,18 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, span: Span, substr: &Substru
214
214
_ => cx. span_bug ( span, "not exactly 2 arguments in `derive(PartialOrd)`" ) ,
215
215
} ;
216
216
217
- let cmp = cx. expr_binary ( span, op, self_f. clone ( ) , other_f. clone ( ) ) ;
217
+ let strict_ineq = cx. expr_binary ( span, op, self_f. clone ( ) , other_f. clone ( ) ) ;
218
218
219
- let not_cmp = cx. expr_unary ( span,
220
- ast:: UnOp :: Not ,
221
- cx. expr_binary ( span, op, other_f. clone ( ) , self_f) ) ;
219
+ let deleg_cmp = if !equal {
220
+ cx. expr_unary ( span,
221
+ ast:: UnOp :: Not ,
222
+ cx. expr_binary ( span, op, other_f. clone ( ) , self_f) )
223
+ } else {
224
+ cx. expr_binary ( span, BinOpKind :: Eq , self_f, other_f. clone ( ) )
225
+ } ;
222
226
223
- let and = cx. expr_binary ( span, BinOpKind :: And , not_cmp , subexpr) ;
224
- cx. expr_binary ( span, BinOpKind :: Or , cmp , and)
227
+ let and = cx. expr_binary ( span, BinOpKind :: And , deleg_cmp , subexpr) ;
228
+ cx. expr_binary ( span, BinOpKind :: Or , strict_ineq , and)
225
229
} ,
226
230
cx. expr_bool ( span, equal) ,
227
231
Box :: new ( |cx, span, ( self_args, tag_tuple) , _non_self_args| {
0 commit comments