@@ -156,7 +156,7 @@ mod platform {
156156 None
157157 }
158158
159- #[ derive( Copy , Clone , Show , Hash , PartialEq , Eq ) ]
159+ #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq ) ]
160160 pub struct Prefix < ' a > ;
161161
162162 impl < ' a > Prefix < ' a > {
@@ -177,9 +177,10 @@ mod platform {
177177mod platform {
178178 use core:: prelude:: * ;
179179
180- use super :: { Path , os_str_as_u8_slice , u8_slice_as_os_str } ;
181- use ffi :: OsStr ;
180+ use char :: CharExt as UnicodeCharExt ;
181+ use super :: { os_str_as_u8_slice , u8_slice_as_os_str } ;
182182 use ascii:: * ;
183+ use ffi:: OsStr ;
183184
184185 #[ inline]
185186 pub fn is_sep ( b : u8 ) -> bool {
@@ -299,7 +300,7 @@ mod platform {
299300 pub fn len ( & self ) -> usize {
300301 use self :: Prefix :: * ;
301302 fn os_str_len ( s : & OsStr ) -> usize {
302- unsafe { os_str_as_u8_slice ( s) . len ( ) }
303+ os_str_as_u8_slice ( s) . len ( )
303304 }
304305 match * self {
305306 Verbatim ( x) => 4 + os_str_len ( x) ,
@@ -339,12 +340,12 @@ mod platform {
339340 }
340341 }
341342
342- impl < ' a > ops :: PartialEq for Prefix < ' a > {
343+ impl < ' a > PartialEq for Prefix < ' a > {
343344 fn eq ( & self , other : & Prefix < ' a > ) -> bool {
344345 use self :: Prefix :: * ;
345346 match ( * self , * other) {
346347 ( Verbatim ( x) , Verbatim ( y) ) => x == y,
347- ( VerbatimUNC ( x1, x2) , Verbatim ( y1, y2) ) => x1 == y1 && x2 == y2,
348+ ( VerbatimUNC ( x1, x2) , VerbatimUNC ( y1, y2) ) => x1 == y1 && x2 == y2,
348349 ( VerbatimDisk ( x) , VerbatimDisk ( y) ) =>
349350 os_str_as_u8_slice ( x) . eq_ignore_ascii_case ( os_str_as_u8_slice ( y) ) ,
350351 ( DeviceNS ( x) , DeviceNS ( y) ) => x == y,
@@ -457,7 +458,7 @@ fn split_file_at_dot(file: &OsStr) -> (Option<&OsStr>, Option<&OsStr>) {
457458/// Going front to back, a path is made up of a prefix, a root component, a body
458459/// (of normal components), and a suffix/emptycomponent (normalized `.` or ``
459460/// for a path ending with the separator)
460- #[ derive( Copy , Clone , PartialEq , PartialOrd , Show ) ]
461+ #[ derive( Copy , Clone , PartialEq , PartialOrd , Debug ) ]
461462enum State {
462463 Prefix = 0 , // c:
463464 Root = 1 , // /
@@ -470,7 +471,7 @@ enum State {
470471///
471472/// See the module documentation for an in-depth explanation of components and
472473/// their role in the API.
473- #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Show ) ]
474+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Debug ) ]
474475pub enum Component < ' a > {
475476 /// A Windows path prefix, e.g. `C:` or `\server\share`
476477 Prefix ( & ' a OsStr ) ,
@@ -2434,12 +2435,21 @@ mod tests {
24342435 tfn ! ( "foo" , "bar" , "bar" ) ;
24352436 tfn ! ( "foo" , "" , "" ) ;
24362437 tfn ! ( "" , "foo" , "foo" ) ;
2437- tfn ! ( "." , "foo" , "./foo" ) ;
2438- tfn ! ( "foo/" , "bar" , "foo/bar" ) ;
2439- tfn ! ( "foo/." , "bar" , "foo/./bar" ) ;
2440- tfn ! ( ".." , "foo" , "../foo" ) ;
2441- tfn ! ( "foo/.." , "bar" , "foo/../bar" ) ;
2442- tfn ! ( "/" , "foo" , "/foo" ) ;
2438+ if cfg ! ( unix) {
2439+ tfn ! ( "." , "foo" , "./foo" ) ;
2440+ tfn ! ( "foo/" , "bar" , "foo/bar" ) ;
2441+ tfn ! ( "foo/." , "bar" , "foo/./bar" ) ;
2442+ tfn ! ( ".." , "foo" , "../foo" ) ;
2443+ tfn ! ( "foo/.." , "bar" , "foo/../bar" ) ;
2444+ tfn ! ( "/" , "foo" , "/foo" ) ;
2445+ } else {
2446+ tfn ! ( "." , "foo" , r".\foo" ) ;
2447+ tfn ! ( r"foo\" , "bar" , r"foo\bar" ) ;
2448+ tfn ! ( r"foo\." , "bar" , r"foo\.\bar" ) ;
2449+ tfn ! ( ".." , "foo" , r"..\foo" ) ;
2450+ tfn ! ( r"foo\.." , "bar" , r"foo\..\bar" ) ;
2451+ tfn ! ( r"\" , "foo" , r"\foo" ) ;
2452+ }
24432453 }
24442454
24452455 #[ test]
0 commit comments