Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::ffi::OsString;
use std::fmt::Debug;
#[cfg(not(windows))]
use std::io;
use std::io::Write;
use std::path::PathBuf;
Expand Down Expand Up @@ -77,6 +76,13 @@ pub enum RustupError {
RemovingDirectory { name: &'static str, path: PathBuf },
#[error("could not remove '{name}' file: '{}'", .path.display())]
RemovingFile { name: &'static str, path: PathBuf },
#[error("could not rename '{name}' file from '{src}' to '{dest}': {source}")]
RenamingFile {
name: &'static str,
src: PathBuf,
dest: PathBuf,
source: io::Error,
},
#[error("{}", component_unavailable_msg(.components, .manifest, .toolchain))]
RequestedComponentsUnavailable {
components: Vec<Component>,
Expand Down
13 changes: 7 additions & 6 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,14 @@ where
},
},
)
.with_context(|| {
format!(
"could not rename {} file from '{}' to '{}'",
.map_err(|e| {
RustupError::RenamingFile {
name,
src.display(),
dest.display()
)
src: PathBuf::from(src),
dest: PathBuf::from(dest),
source: e.error,
}
.into()
})
}

Expand Down
Loading