File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -725,7 +725,7 @@ impl<'a> Components<'a> {
725725 if self . has_root ( ) {
726726 return false ;
727727 }
728- let mut iter = self . path [ self . prefix_len ( ) ..] . iter ( ) ;
728+ let mut iter = self . path [ self . prefix_remaining ( ) ..] . iter ( ) ;
729729 match ( iter. next ( ) , iter. next ( ) ) {
730730 ( Some ( & b'.' ) , None ) => true ,
731731 ( Some ( & b'.' ) , Some ( & b) ) => self . is_sep_byte ( b) ,
Original file line number Diff line number Diff line change @@ -114,3 +114,15 @@ fn test_parse_prefix_verbatim_device() {
114114 assert_eq ! ( prefix, parse_prefix( r"/\?\C:\windows\system32\notepad.exe" ) ) ;
115115 assert_eq ! ( prefix, parse_prefix( r"\\?/C:\windows\system32\notepad.exe" ) ) ;
116116}
117+
118+ // See #93586 for more infomation.
119+ #[ test]
120+ fn test_windows_prefix_components ( ) {
121+ use crate :: path:: Path ;
122+
123+ let path = Path :: new ( "C:" ) ;
124+ let mut components = path. components ( ) ;
125+ let drive = components. next ( ) . expect ( "drive is expected here" ) ;
126+ assert_eq ! ( drive. as_os_str( ) , OsStr :: new( "C:" ) ) ;
127+ assert_eq ! ( components. as_path( ) , Path :: new( "" ) ) ;
128+ }
You can’t perform that action at this time.
0 commit comments