From ceac4197767d29a6518f15c65af7df4a58b895ee Mon Sep 17 00:00:00 2001 From: Lin Yihai Date: Fri, 13 Oct 2023 19:47:08 +0800 Subject: [PATCH] add detailed message when target folder path is invalid --- crates/cargo-util/src/paths.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/cargo-util/src/paths.rs b/crates/cargo-util/src/paths.rs index bf3ca3f82..f405c8f97 100644 --- a/crates/cargo-util/src/paths.rs +++ b/crates/cargo-util/src/paths.rs @@ -694,7 +694,8 @@ pub fn create_dir_all_excluded_from_backups_atomic(p: impl AsRef) -> Resul // we can infer from it's another cargo process doing work. if let Err(e) = fs::rename(tempdir.path(), path) { if !path.exists() { - return Err(anyhow::Error::from(e)); + return Err(anyhow::Error::from(e)) + .with_context(|| format!("failed to create directory `{}`", path.display())); } } Ok(())