@@ -61,13 +61,13 @@ use option::{Option, Some, None};
61
61
/// `Eq`.
62
62
#[ lang="eq" ]
63
63
#[ unstable = "Definition may change slightly after trait reform" ]
64
- pub trait PartialEq for Sized ? {
64
+ pub trait PartialEq < Sized ? Rhs = Self > for Sized ? {
65
65
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
66
- fn eq ( & self , other : & Self ) -> bool ;
66
+ fn eq ( & self , other : & Rhs ) -> bool ;
67
67
68
68
/// This method tests for `!=`.
69
69
#[ inline]
70
- fn ne ( & self , other : & Self ) -> bool { !self . eq ( other) }
70
+ fn ne ( & self , other : & Rhs ) -> bool { !self . eq ( other) }
71
71
}
72
72
73
73
/// Trait for equality comparisons which are [equivalence relations](
@@ -80,7 +80,7 @@ pub trait PartialEq for Sized? {
80
80
/// - symmetric: `a == b` implies `b == a`; and
81
81
/// - transitive: `a == b` and `b == c` implies `a == c`.
82
82
#[ unstable = "Definition may change slightly after trait reform" ]
83
- pub trait Eq for Sized ?: PartialEq {
83
+ pub trait Eq < Sized ? Rhs = Self > for Sized ?: PartialEq < Rhs > {
84
84
// FIXME #13101: this method is used solely by #[deriving] to
85
85
// assert that every component of a type implements #[deriving]
86
86
// itself, the current deriving infrastructure means doing this
@@ -150,7 +150,7 @@ impl Ordering {
150
150
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
151
151
/// both `==` and `>`.
152
152
#[ unstable = "Definition may change slightly after trait reform" ]
153
- pub trait Ord for Sized ?: Eq + PartialOrd {
153
+ pub trait Ord < Sized ? Rhs = Self > for Sized ?: Eq < Rhs > + PartialOrd < Rhs > {
154
154
/// This method returns an ordering between `self` and `other` values.
155
155
///
156
156
/// By convention, `self.cmp(&other)` returns the ordering matching
@@ -161,7 +161,7 @@ pub trait Ord for Sized?: Eq + PartialOrd {
161
161
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
162
162
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
163
163
/// ```
164
- fn cmp ( & self , other : & Self ) -> Ordering ;
164
+ fn cmp ( & self , other : & Rhs ) -> Ordering ;
165
165
}
166
166
167
167
#[ unstable = "Trait is unstable." ]
@@ -194,14 +194,14 @@ impl PartialOrd for Ordering {
194
194
/// 5.11).
195
195
#[ lang="ord" ]
196
196
#[ unstable = "Definition may change slightly after trait reform" ]
197
- pub trait PartialOrd for Sized ?: PartialEq {
197
+ pub trait PartialOrd < Sized ? Rhs = Self > for Sized ?: PartialEq < Rhs > {
198
198
/// This method returns an ordering between `self` and `other` values
199
199
/// if one exists.
200
- fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > ;
200
+ fn partial_cmp ( & self , other : & Rhs ) -> Option < Ordering > ;
201
201
202
202
/// This method tests less than (for `self` and `other`) and is used by the `<` operator.
203
203
#[ inline]
204
- fn lt ( & self , other : & Self ) -> bool {
204
+ fn lt ( & self , other : & Rhs ) -> bool {
205
205
match self . partial_cmp ( other) {
206
206
Some ( Less ) => true ,
207
207
_ => false ,
@@ -210,7 +210,7 @@ pub trait PartialOrd for Sized?: PartialEq {
210
210
211
211
/// This method tests less than or equal to (`<=`).
212
212
#[ inline]
213
- fn le ( & self , other : & Self ) -> bool {
213
+ fn le ( & self , other : & Rhs ) -> bool {
214
214
match self . partial_cmp ( other) {
215
215
Some ( Less ) | Some ( Equal ) => true ,
216
216
_ => false ,
@@ -219,7 +219,7 @@ pub trait PartialOrd for Sized?: PartialEq {
219
219
220
220
/// This method tests greater than (`>`).
221
221
#[ inline]
222
- fn gt ( & self , other : & Self ) -> bool {
222
+ fn gt ( & self , other : & Rhs ) -> bool {
223
223
match self . partial_cmp ( other) {
224
224
Some ( Greater ) => true ,
225
225
_ => false ,
@@ -228,7 +228,7 @@ pub trait PartialOrd for Sized?: PartialEq {
228
228
229
229
/// This method tests greater than or equal to (`>=`).
230
230
#[ inline]
231
- fn ge ( & self , other : & Self ) -> bool {
231
+ fn ge ( & self , other : & Rhs ) -> bool {
232
232
match self . partial_cmp ( other) {
233
233
Some ( Greater ) | Some ( Equal ) => true ,
234
234
_ => false ,
0 commit comments