@@ -2089,6 +2089,53 @@ impl_cmp!(Cow<'a, Path>, Path);
2089
2089
impl_cmp ! ( Cow <' a, Path >, & ' b Path ) ;
2090
2090
impl_cmp ! ( Cow <' a, Path >, PathBuf ) ;
2091
2091
2092
+ macro_rules! impl_cmp_os_str {
2093
+ ( $lhs: ty, $rhs: ty) => {
2094
+ #[ stable( feature = "cmp_path" , since = "1.8.0" ) ]
2095
+ impl <' a, ' b> PartialEq <$rhs> for $lhs {
2096
+ #[ inline]
2097
+ fn eq( & self , other: & $rhs) -> bool { <Path as PartialEq >:: eq( self , other. as_ref( ) ) }
2098
+ }
2099
+
2100
+ #[ stable( feature = "cmp_path" , since = "1.8.0" ) ]
2101
+ impl <' a, ' b> PartialEq <$lhs> for $rhs {
2102
+ #[ inline]
2103
+ fn eq( & self , other: & $lhs) -> bool { <Path as PartialEq >:: eq( self . as_ref( ) , other) }
2104
+ }
2105
+
2106
+ #[ stable( feature = "cmp_path" , since = "1.8.0" ) ]
2107
+ impl <' a, ' b> PartialOrd <$rhs> for $lhs {
2108
+ #[ inline]
2109
+ fn partial_cmp( & self , other: & $rhs) -> Option <cmp:: Ordering > {
2110
+ <Path as PartialOrd >:: partial_cmp( self , other. as_ref( ) )
2111
+ }
2112
+ }
2113
+
2114
+ #[ stable( feature = "cmp_path" , since = "1.8.0" ) ]
2115
+ impl <' a, ' b> PartialOrd <$lhs> for $rhs {
2116
+ #[ inline]
2117
+ fn partial_cmp( & self , other: & $lhs) -> Option <cmp:: Ordering > {
2118
+ <Path as PartialOrd >:: partial_cmp( self . as_ref( ) , other)
2119
+ }
2120
+ }
2121
+ }
2122
+ }
2123
+
2124
+ impl_cmp_os_str ! ( PathBuf , OsStr ) ;
2125
+ impl_cmp_os_str ! ( PathBuf , & ' a OsStr ) ;
2126
+ impl_cmp_os_str ! ( PathBuf , Cow <' a, OsStr >) ;
2127
+ impl_cmp_os_str ! ( PathBuf , OsString ) ;
2128
+ impl_cmp_os_str ! ( Path , OsStr ) ;
2129
+ impl_cmp_os_str ! ( Path , & ' a OsStr ) ;
2130
+ impl_cmp_os_str ! ( Path , Cow <' a, OsStr >) ;
2131
+ impl_cmp_os_str ! ( Path , OsString ) ;
2132
+ impl_cmp_os_str ! ( & ' a Path , OsStr ) ;
2133
+ impl_cmp_os_str ! ( & ' a Path , Cow <' b, OsStr >) ;
2134
+ impl_cmp_os_str ! ( & ' a Path , OsString ) ;
2135
+ impl_cmp_os_str ! ( Cow <' a, Path >, OsStr ) ;
2136
+ impl_cmp_os_str ! ( Cow <' a, Path >, & ' b OsStr ) ;
2137
+ impl_cmp_os_str ! ( Cow <' a, Path >, OsString ) ;
2138
+
2092
2139
#[ stable( since = "1.7.0" , feature = "strip_prefix" ) ]
2093
2140
impl fmt:: Display for StripPrefixError {
2094
2141
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
0 commit comments