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 {
13411341#[ stable( feature = "box_from_path" , since = "1.17.0" ) ]
13421342impl < ' a > From < & ' a Path > for Box < Path > {
13431343 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 ;
13451346 unsafe { Box :: from_raw ( rw) }
13461347 }
13471348}
@@ -2313,7 +2314,8 @@ impl Path {
23132314 #[ stable( feature = "into_boxed_path" , since = "1.20.0" ) ]
23142315 pub fn into_path_buf ( self : Box < Path > ) -> PathBuf {
23152316 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) }
23172319 }
23182320}
23192321
You can’t perform that action at this time.
0 commit comments