File tree 2 files changed +13
-1
lines changed
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> {
725
725
if self . has_root ( ) {
726
726
return false ;
727
727
}
728
- let mut iter = self . path [ self . prefix_len ( ) ..] . iter ( ) ;
728
+ let mut iter = self . path [ self . prefix_remaining ( ) ..] . iter ( ) ;
729
729
match ( iter. next ( ) , iter. next ( ) ) {
730
730
( Some ( & b'.' ) , None ) => true ,
731
731
( 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() {
114
114
assert_eq ! ( prefix, parse_prefix( r"/\?\C:\windows\system32\notepad.exe" ) ) ;
115
115
assert_eq ! ( prefix, parse_prefix( r"\\?/C:\windows\system32\notepad.exe" ) ) ;
116
116
}
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