File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use std:: ffi:: OsString ;
4
4
use std:: fmt:: Debug ;
5
- #[ cfg( not( windows) ) ]
6
5
use std:: io;
7
6
use std:: io:: Write ;
8
7
use std:: path:: PathBuf ;
@@ -77,6 +76,13 @@ pub enum RustupError {
77
76
RemovingDirectory { name : & ' static str , path : PathBuf } ,
78
77
#[ error( "could not remove '{name}' file: '{}'" , . path. display( ) ) ]
79
78
RemovingFile { name : & ' static str , path : PathBuf } ,
79
+ #[ error( "could not rename '{name}' file from '{src}' to '{dest}': {source}" ) ]
80
+ RenamingFile {
81
+ name : & ' static str ,
82
+ src : PathBuf ,
83
+ dest : PathBuf ,
84
+ source : io:: Error ,
85
+ } ,
80
86
#[ error( "{}" , component_unavailable_msg( . components, . manifest, . toolchain) ) ]
81
87
RequestedComponentsUnavailable {
82
88
components : Vec < Component > ,
Original file line number Diff line number Diff line change @@ -471,13 +471,14 @@ where
471
471
} ,
472
472
} ,
473
473
)
474
- . with_context ( || {
475
- format ! (
476
- "could not rename {} file from '{}' to '{}'" ,
474
+ . map_err ( |e| {
475
+ RustupError :: RenamingFile {
477
476
name,
478
- src. display( ) ,
479
- dest. display( )
480
- )
477
+ src : PathBuf :: from ( src) ,
478
+ dest : PathBuf :: from ( dest) ,
479
+ source : e. error ,
480
+ }
481
+ . into ( )
481
482
} )
482
483
}
483
484
You can’t perform that action at this time.
0 commit comments