@@ -2582,6 +2582,37 @@ impl<T: ?Sized> fmt::Pointer for NonNull<T> {
25822582 }
25832583}
25842584
2585+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2586+ impl < T : ?Sized > Eq for NonNull < T > { }
2587+
2588+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2589+ impl < T : ?Sized > PartialEq for NonNull < T > {
2590+ fn eq ( & self , other : & Self ) -> bool {
2591+ self . as_ptr ( ) == other. as_ptr ( )
2592+ }
2593+ }
2594+
2595+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2596+ impl < T : ?Sized > Ord for NonNull < T > {
2597+ fn cmp ( & self , other : & Self ) -> Ordering {
2598+ self . as_ptr ( ) . cmp ( & other. as_ptr ( ) )
2599+ }
2600+ }
2601+
2602+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2603+ impl < T : ?Sized > PartialOrd for NonNull < T > {
2604+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
2605+ self . as_ptr ( ) . partial_cmp ( & other. as_ptr ( ) )
2606+ }
2607+ }
2608+
2609+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2610+ impl < T : ?Sized > hash:: Hash for NonNull < T > {
2611+ fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
2612+ self . as_ptr ( ) . hash ( state)
2613+ }
2614+ }
2615+
25852616#[ stable( feature = "nonnull" , since = "1.25.0" ) ]
25862617impl < T : ?Sized > From < Unique < T > > for NonNull < T > {
25872618 fn from ( unique : Unique < T > ) -> Self {
0 commit comments