@@ -30,7 +30,10 @@ and `Eq` to overload the `==` and `!=` operators.
30
30
*
31
31
* Eventually this may be simplified to only require
32
32
* an `eq` method, with the other generated from
33
- * a default implementation.
33
+ * a default implementation. However it should
34
+ * remain possible to implement `ne` separately, for
35
+ * compatibility with floating-point NaN semantics
36
+ * (cf. IEEE 754-2008 section 5.11).
34
37
*/
35
38
#[ lang="eq" ]
36
39
pub trait Eq {
@@ -43,7 +46,10 @@ pub trait Eq {
43
46
*
44
47
* Eventually this may be simplified to only require
45
48
* an `le` method, with the others generated from
46
- * default implementations.
49
+ * default implementations. However it should remain
50
+ * possible to implement the others separately, for
51
+ * compatibility with floating-point NaN semantics
52
+ * (cf. IEEE 754-2008 section 5.11).
47
53
*/
48
54
#[ lang="ord" ]
49
55
pub trait Ord {
@@ -59,8 +65,8 @@ pub pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
59
65
}
60
66
61
67
#[ inline( always) ]
62
- pub pure fn le < T : Ord Eq > ( v1 : & T , v2 : & T ) -> bool {
63
- ( * v1) . lt ( v2 ) || ( * v1 ) . eq ( v2)
68
+ pub pure fn le < T : Ord > ( v1 : & T , v2 : & T ) -> bool {
69
+ ( * v1) . le ( v2)
64
70
}
65
71
66
72
#[ inline( always) ]
0 commit comments