From 7d579046c80d3de3143dcb8b2db5640f95b5383c Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 19 Sep 2024 11:29:37 +0300 Subject: [PATCH] change download-ci-llvm default from "if-unchanged" to true Signed-off-by: onur-ozkan --- src/bootstrap/src/core/config/config.rs | 11 +++++------ src/bootstrap/src/core/config/tests.rs | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 555a6a7f8bd..dcecd7f8084 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2738,6 +2738,8 @@ impl Config { download_ci_llvm: Option, asserts: bool, ) -> bool { + let download_ci_llvm = download_ci_llvm.unwrap_or(StringOrBool::Bool(true)); + let if_unchanged = || { if self.rust_info.is_from_tarball() { // Git is needed for running "if-unchanged" logic. @@ -2761,10 +2763,7 @@ impl Config { }; match download_ci_llvm { - None => { - (self.channel == "dev" || self.download_rustc_commit.is_some()) && if_unchanged() - } - Some(StringOrBool::Bool(b)) => { + 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`." @@ -2774,8 +2773,8 @@ impl Config { // If download-ci-llvm=true we also want to check that CI llvm is available b && llvm::is_ci_llvm_available(self, asserts) } - Some(StringOrBool::String(s)) if s == "if-unchanged" => if_unchanged(), - Some(StringOrBool::String(other)) => { + StringOrBool::String(s) if s == "if-unchanged" => if_unchanged(), + StringOrBool::String(other) => { panic!("unrecognized option for download-ci-llvm: {:?}", other) } } diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index f54a5d3b512..a45e73b5d95 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -32,7 +32,7 @@ fn download_ci_llvm() { assert!(!parse_llvm("llvm.download-ci-llvm = false")); assert_eq!(parse_llvm(""), if_unchanged); assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged); - assert!(!parse_llvm("rust.channel = \"stable\"")); + assert!(parse_llvm("rust.channel = \"stable\"")); assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged); assert_eq!( parse_llvm(