diff --git a/config.example.toml b/config.example.toml index b8cdc2ec848..a175a9013e2 100644 --- a/config.example.toml +++ b/config.example.toml @@ -50,7 +50,7 @@ # # Note that many of the LLVM options are not currently supported for # downloading. Currently only the "assertions" option can be toggled. -#download-ci-llvm = if rust.channel == "dev" { "if-unchanged" } else { false } +#download-ci-llvm = if rust.channel == "dev" || rust.download-rustc != false { "if-unchanged" } else { false } # Indicates whether the LLVM build is a Release or Debug build #optimize = true diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 96dec975250..c84eb8a684f 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2483,9 +2483,20 @@ impl Config { llvm::is_ci_llvm_available(self, asserts) } }; + match download_ci_llvm { - None => self.channel == "dev" && if_unchanged(), - Some(StringOrBool::Bool(b)) => b, + None => { + (self.channel == "dev" || self.download_rustc_commit.is_some()) && if_unchanged() + } + Some(StringOrBool::Bool(b)) => { + if !b && self.download_rustc_commit.is_some() { + panic!( + "`llvm.download-ci-llvm` cannot be set to `false` if `rust.download-rustc` is set to `true` or `if-unchanged`." + ); + } + + b + } // FIXME: "if-available" is deprecated. Remove this block later (around mid 2024) // to not break builds between the recent-to-old checkouts. Some(StringOrBool::String(s)) if s == "if-available" => {