]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/config.rs
Rollup merge of #104721 - WaffleLapkin:deref-harder, r=oli-obk
[rust.git] / src / bootstrap / config.rs
index c61025b556aa5702941f43215aebc73144aaa59e..babf09d2b93349605ed3c8b2965635e7932a352b 100644 (file)
@@ -1511,19 +1511,25 @@ pub(crate) fn llvm_link_shared(&self) -> bool {
 
     /// Return whether we will use a downloaded, pre-compiled version of rustc, or just build from source.
     pub(crate) fn download_rustc(&self) -> bool {
-        static DOWNLOAD_RUSTC: OnceCell<bool> = OnceCell::new();
+        self.download_rustc_commit().is_some()
+    }
+
+    pub(crate) fn download_rustc_commit(&self) -> Option<&'static str> {
+        static DOWNLOAD_RUSTC: OnceCell<Option<String>> = OnceCell::new();
         if self.dry_run() && DOWNLOAD_RUSTC.get().is_none() {
             // avoid trying to actually download the commit
-            return false;
+            return None;
         }
 
-        *DOWNLOAD_RUSTC.get_or_init(|| match &self.download_rustc_commit {
-            None => false,
-            Some(commit) => {
-                self.download_ci_rustc(commit);
-                true
-            }
-        })
+        DOWNLOAD_RUSTC
+            .get_or_init(|| match &self.download_rustc_commit {
+                None => None,
+                Some(commit) => {
+                    self.download_ci_rustc(commit);
+                    Some(commit.clone())
+                }
+            })
+            .as_deref()
     }
 
     pub(crate) fn initial_rustfmt(&self) -> Option<PathBuf> {