@@ -1886,6 +1886,30 @@ macro_rules! impl_pos {
1886
1886
$( #[ $attr] ) *
1887
1887
$vis struct $ident( $inner_vis $inner_ty) ;
1888
1888
1889
+ impl :: std:: cmp:: Ord for $ident {
1890
+ #[ inline( always) ]
1891
+ fn cmp( & self , other: & Self ) -> :: std:: cmp:: Ordering {
1892
+ self . 0 . cmp( & other. 0 )
1893
+ }
1894
+ }
1895
+
1896
+ impl :: std:: cmp:: PartialOrd for $ident {
1897
+ #[ inline( always) ]
1898
+ fn partial_cmp( & self , other: & Self ) -> Option <:: std:: cmp:: Ordering > {
1899
+ self . 0 . partial_cmp( & other. 0 )
1900
+ }
1901
+
1902
+ #[ inline( always) ]
1903
+ fn lt( & self , other: & Self ) -> bool {
1904
+ self . 0 . lt( & other. 0 )
1905
+ }
1906
+
1907
+ #[ inline( always) ]
1908
+ fn le( & self , other: & Self ) -> bool {
1909
+ self . 0 . le( & other. 0 )
1910
+ }
1911
+ }
1912
+
1889
1913
impl Pos for $ident {
1890
1914
#[ inline( always) ]
1891
1915
fn from_usize( n: usize ) -> $ident {
@@ -1933,15 +1957,15 @@ impl_pos! {
1933
1957
/// A byte offset.
1934
1958
///
1935
1959
/// Keep this small (currently 32-bits), as AST contains a lot of them.
1936
- #[ derive( Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord , Debug ) ]
1960
+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug ) ]
1937
1961
pub struct BytePos ( pub u32 ) ;
1938
1962
1939
1963
/// A character offset.
1940
1964
///
1941
1965
/// Because of multibyte UTF-8 characters, a byte offset
1942
1966
/// is not equivalent to a character offset. The [`SourceMap`] will convert [`BytePos`]
1943
1967
/// values to `CharPos` values as necessary.
1944
- #[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Debug ) ]
1968
+ #[ derive( Clone , Copy , PartialEq , Eq , Debug ) ]
1945
1969
pub struct CharPos ( pub usize ) ;
1946
1970
}
1947
1971
0 commit comments