@@ -22,6 +22,7 @@ use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
2222use crate :: core:: build_steps:: llvm;
2323pub use crate :: core:: config:: flags:: Subcommand ;
2424use crate :: core:: config:: flags:: { Color , Flags , Warnings } ;
25+ use crate :: core:: download:: is_download_ci_available;
2526use crate :: utils:: cache:: { INTERNER , Interned } ;
2627use crate :: utils:: channel:: { self , GitInfo } ;
2728use crate :: utils:: helpers:: { self , exe, output, t} ;
@@ -1627,9 +1628,11 @@ impl Config {
16271628 config. mandir = mandir. map ( PathBuf :: from) ;
16281629 }
16291630
1631+ config. llvm_assertions =
1632+ toml. llvm . as_ref ( ) . map_or ( false , |llvm| llvm. assertions . unwrap_or ( false ) ) ;
1633+
16301634 // Store off these values as options because if they're not provided
16311635 // we'll infer default values for them later
1632- let mut llvm_assertions = None ;
16331636 let mut llvm_tests = None ;
16341637 let mut llvm_enzyme = None ;
16351638 let mut llvm_plugins = None ;
@@ -1712,7 +1715,8 @@ impl Config {
17121715 is_user_configured_rust_channel = channel. is_some ( ) ;
17131716 set ( & mut config. channel , channel. clone ( ) ) ;
17141717
1715- config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
1718+ config. download_rustc_commit =
1719+ config. download_ci_rustc_commit ( download_rustc, config. llvm_assertions ) ;
17161720
17171721 debug = debug_toml;
17181722 debug_assertions = debug_assertions_toml;
@@ -1848,7 +1852,7 @@ impl Config {
18481852 optimize : optimize_toml,
18491853 thin_lto,
18501854 release_debuginfo,
1851- assertions,
1855+ assertions : _ ,
18521856 tests,
18531857 enzyme,
18541858 plugins,
@@ -1882,7 +1886,6 @@ impl Config {
18821886 Some ( StringOrBool :: Bool ( false ) ) | None => { }
18831887 }
18841888 set ( & mut config. ninja_in_file , ninja) ;
1885- llvm_assertions = assertions;
18861889 llvm_tests = tests;
18871890 llvm_enzyme = enzyme;
18881891 llvm_plugins = plugins;
@@ -1911,8 +1914,8 @@ impl Config {
19111914 config. llvm_enable_warnings = enable_warnings. unwrap_or ( false ) ;
19121915 config. llvm_build_config = build_config. clone ( ) . unwrap_or ( Default :: default ( ) ) ;
19131916
1914- let asserts = llvm_assertions . unwrap_or ( false ) ;
1915- config . llvm_from_ci = config. parse_download_ci_llvm ( download_ci_llvm, asserts ) ;
1917+ config . llvm_from_ci =
1918+ config. parse_download_ci_llvm ( download_ci_llvm, config . llvm_assertions ) ;
19161919
19171920 if config. llvm_from_ci {
19181921 let warn = |option : & str | {
@@ -2080,7 +2083,6 @@ impl Config {
20802083 // Now that we've reached the end of our configuration, infer the
20812084 // default values for all options that we haven't otherwise stored yet.
20822085
2083- config. llvm_assertions = llvm_assertions. unwrap_or ( false ) ;
20842086 config. llvm_tests = llvm_tests. unwrap_or ( false ) ;
20852087 config. llvm_enzyme = llvm_enzyme. unwrap_or ( false ) ;
20862088 config. llvm_plugins = llvm_plugins. unwrap_or ( false ) ;
@@ -2711,12 +2713,18 @@ impl Config {
27112713 }
27122714
27132715 /// Returns the commit to download, or `None` if we shouldn't download CI artifacts.
2714- fn download_ci_rustc_commit ( & self , download_rustc : Option < StringOrBool > ) -> Option < String > {
2716+ fn download_ci_rustc_commit (
2717+ & self ,
2718+ download_rustc : Option < StringOrBool > ,
2719+ llvm_assertions : bool ,
2720+ ) -> Option < String > {
27152721 // If `download-rustc` is not set, default to rebuilding.
27162722 let if_unchanged = match download_rustc {
27172723 None | Some ( StringOrBool :: Bool ( false ) ) => return None ,
27182724 Some ( StringOrBool :: Bool ( true ) ) => false ,
2719- Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => true ,
2725+ Some ( StringOrBool :: String ( s) ) if s == "if-unchanged" => {
2726+ is_download_ci_available ( & self . build . triple , llvm_assertions)
2727+ }
27202728 Some ( StringOrBool :: String ( other) ) => {
27212729 panic ! ( "unrecognized option for download-rustc: {other}" )
27222730 }
0 commit comments