about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-11-11 11:01:36 -0500
committerjyn <github@jyn.dev>2023-12-16 15:09:20 -0500
commit336ed0ebc7d1f00b58aeba27e257465dced89f3f (patch)
treeface6785481a2195a37e4763db78cb80f639bf72
parent0ffac661faf09198132a24e64c743795cf2c41f5 (diff)
downloadrust-336ed0ebc7d1f00b58aeba27e257465dced89f3f.tar.gz
rust-336ed0ebc7d1f00b58aeba27e257465dced89f3f.zip
give a better error if renaming a temp file fails
-rw-r--r--src/bootstrap/src/core/download.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index 0a5844a6859..ebb789c91f6 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -208,7 +208,10 @@ impl Config {
             Some(other) => panic!("unsupported protocol {other} in {url}"),
             None => panic!("no protocol in {url}"),
         }
-        t!(std::fs::rename(&tempfile, dest_path));
+        t!(
+            std::fs::rename(&tempfile, dest_path),
+            format!("failed to rename {tempfile:?} to {dest_path:?}")
+        );
     }
 
     fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
@@ -544,6 +547,10 @@ impl Config {
         key: &str,
         destination: &str,
     ) {
+        if self.dry_run() {
+            return;
+        }
+
         let cache_dst = self.out.join("cache");
         let cache_dir = cache_dst.join(key);
         if !cache_dir.exists() {