@@ -93,7 +93,7 @@ use intrinsics;
93
93
use option:: Option ;
94
94
use option:: Option :: { Some , None } ;
95
95
96
- use cmp:: { PartialEq , Eq , PartialOrd , Equiv } ;
96
+ use cmp:: { PartialEq , Eq , Ord , PartialOrd , Equiv } ;
97
97
use cmp:: Ordering ;
98
98
use cmp:: Ordering :: { Less , Equal , Greater } ;
99
99
@@ -388,17 +388,24 @@ mod externfnpointers {
388
388
}
389
389
390
390
// Comparison for pointers
391
- impl < T > PartialOrd for * const T {
391
+ impl < T > Ord for * const T {
392
392
#[ inline]
393
- fn partial_cmp ( & self , other : & * const T ) -> Option < Ordering > {
393
+ fn cmp ( & self , other : & * const T ) -> Ordering {
394
394
if self < other {
395
- Some ( Less )
395
+ Less
396
396
} else if self == other {
397
- Some ( Equal )
397
+ Equal
398
398
} else {
399
- Some ( Greater )
399
+ Greater
400
400
}
401
401
}
402
+ }
403
+
404
+ impl < T > PartialOrd for * const T {
405
+ #[ inline]
406
+ fn partial_cmp ( & self , other : & * const T ) -> Option < Ordering > {
407
+ Some ( self . cmp ( other) )
408
+ }
402
409
403
410
#[ inline]
404
411
fn lt ( & self , other : & * const T ) -> bool { * self < * other }
@@ -413,17 +420,24 @@ impl<T> PartialOrd for *const T {
413
420
fn ge ( & self , other : & * const T ) -> bool { * self >= * other }
414
421
}
415
422
416
- impl < T > PartialOrd for * mut T {
423
+ impl < T > Ord for * mut T {
417
424
#[ inline]
418
- fn partial_cmp ( & self , other : & * mut T ) -> Option < Ordering > {
425
+ fn cmp ( & self , other : & * mut T ) -> Ordering {
419
426
if self < other {
420
- Some ( Less )
427
+ Less
421
428
} else if self == other {
422
- Some ( Equal )
429
+ Equal
423
430
} else {
424
- Some ( Greater )
431
+ Greater
425
432
}
426
433
}
434
+ }
435
+
436
+ impl < T > PartialOrd for * mut T {
437
+ #[ inline]
438
+ fn partial_cmp ( & self , other : & * mut T ) -> Option < Ordering > {
439
+ Some ( self . cmp ( other) )
440
+ }
427
441
428
442
#[ inline]
429
443
fn lt ( & self , other : & * mut T ) -> bool { * self < * other }
0 commit comments