From d50ce1536cf9ce101e08e1f9913076762a9390a6 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 9 Apr 2023 13:05:30 -0500 Subject: [PATCH] download-rustc: Give a better error message if artifacts can't be downloaded Before: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz curl: (22) The requested URL returned error: 404 ``` After: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz curl: (22) The requested URL returned error: 404 error: failed to download pre-built rustc from CI note: old builds get deleted after a certain time help: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml: [rust] download-rustc = false ``` --- src/bootstrap/download.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs index 133cda639d9..6405fe3da02 100644 --- a/src/bootstrap/download.rs +++ b/src/bootstrap/download.rs @@ -541,7 +541,18 @@ fn download_component( None }; - self.download_file(&format!("{base_url}/{url}"), &tarball, ""); + let mut help_on_error = ""; + if destination == "ci-rustc" { + help_on_error = "error: failed to download pre-built rustc from CI + +note: old builds get deleted after a certain time +help: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml: + +[rust] +download-rustc = false +"; + } + self.download_file(&format!("{base_url}/{url}"), &tarball, help_on_error); if let Some(sha256) = checksum { if !self.verify(&tarball, sha256) { panic!("failed to verify {}", tarball.display());