File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1341,7 +1341,8 @@ impl PathBuf {
1341
1341
#[ stable( feature = "box_from_path" , since = "1.17.0" ) ]
1342
1342
impl < ' a > From < & ' a Path > for Box < Path > {
1343
1343
fn from ( path : & ' a Path ) -> Box < Path > {
1344
- let rw = Box :: into_raw ( Box :: from ( & path. inner ) ) as * mut Path ;
1344
+ let boxed: Box < OsStr > = path. inner . into ( ) ;
1345
+ let rw = Box :: into_raw ( boxed) as * mut Path ;
1345
1346
unsafe { Box :: from_raw ( rw) }
1346
1347
}
1347
1348
}
@@ -2313,7 +2314,8 @@ impl Path {
2313
2314
#[ stable( feature = "into_boxed_path" , since = "1.20.0" ) ]
2314
2315
pub fn into_path_buf ( self : Box < Path > ) -> PathBuf {
2315
2316
let rw = Box :: into_raw ( self ) as * mut OsStr ;
2316
- unsafe { Box :: from_raw ( rw) }
2317
+ let inner = unsafe { Box :: from_raw ( rw) } ;
2318
+ PathBuf { inner : OsString :: from ( inner) }
2317
2319
}
2318
2320
}
2319
2321
You can’t perform that action at this time.
0 commit comments