@@ -22,6 +22,7 @@ use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
22
22
use crate :: core:: build_steps:: llvm;
23
23
pub use crate :: core:: config:: flags:: Subcommand ;
24
24
use crate :: core:: config:: flags:: { Color , Flags , Warnings } ;
25
+ use crate :: core:: download:: is_download_ci_available;
25
26
use crate :: utils:: cache:: { INTERNER , Interned } ;
26
27
use crate :: utils:: channel:: { self , GitInfo } ;
27
28
use crate :: utils:: helpers:: { self , exe, output, t} ;
@@ -1627,9 +1628,11 @@ impl Config {
1627
1628
config. mandir = mandir. map ( PathBuf :: from) ;
1628
1629
}
1629
1630
1631
+ config. llvm_assertions =
1632
+ toml. llvm . as_ref ( ) . map_or ( false , |llvm| llvm. assertions . unwrap_or ( false ) ) ;
1633
+
1630
1634
// Store off these values as options because if they're not provided
1631
1635
// we'll infer default values for them later
1632
- let mut llvm_assertions = None ;
1633
1636
let mut llvm_tests = None ;
1634
1637
let mut llvm_enzyme = None ;
1635
1638
let mut llvm_plugins = None ;
@@ -1712,7 +1715,8 @@ impl Config {
1712
1715
is_user_configured_rust_channel = channel. is_some ( ) ;
1713
1716
set ( & mut config. channel , channel. clone ( ) ) ;
1714
1717
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 ) ;
1716
1720
1717
1721
debug = debug_toml;
1718
1722
debug_assertions = debug_assertions_toml;
@@ -1848,7 +1852,7 @@ impl Config {
1848
1852
optimize : optimize_toml,
1849
1853
thin_lto,
1850
1854
release_debuginfo,
1851
- assertions,
1855
+ assertions : _ ,
1852
1856
tests,
1853
1857
enzyme,
1854
1858
plugins,
@@ -1882,7 +1886,6 @@ impl Config {
1882
1886
Some ( StringOrBool :: Bool ( false ) ) | None => { }
1883
1887
}
1884
1888
set ( & mut config. ninja_in_file , ninja) ;
1885
- llvm_assertions = assertions;
1886
1889
llvm_tests = tests;
1887
1890
llvm_enzyme = enzyme;
1888
1891
llvm_plugins = plugins;
@@ -1911,8 +1914,8 @@ impl Config {
1911
1914
config. llvm_enable_warnings = enable_warnings. unwrap_or ( false ) ;
1912
1915
config. llvm_build_config = build_config. clone ( ) . unwrap_or ( Default :: default ( ) ) ;
1913
1916
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 ) ;
1916
1919
1917
1920
if config. llvm_from_ci {
1918
1921
let warn = |option : & str | {
@@ -2080,7 +2083,6 @@ impl Config {
2080
2083
// Now that we've reached the end of our configuration, infer the
2081
2084
// default values for all options that we haven't otherwise stored yet.
2082
2085
2083
- config. llvm_assertions = llvm_assertions. unwrap_or ( false ) ;
2084
2086
config. llvm_tests = llvm_tests. unwrap_or ( false ) ;
2085
2087
config. llvm_enzyme = llvm_enzyme. unwrap_or ( false ) ;
2086
2088
config. llvm_plugins = llvm_plugins. unwrap_or ( false ) ;
@@ -2711,12 +2713,18 @@ impl Config {
2711
2713
}
2712
2714
2713
2715
/// 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 > {
2715
2721
// If `download-rustc` is not set, default to rebuilding.
2716
2722
let if_unchanged = match download_rustc {
2717
2723
None | Some ( StringOrBool :: Bool ( false ) ) => return None ,
2718
2724
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
+ }
2720
2728
Some ( StringOrBool :: String ( other) ) => {
2721
2729
panic ! ( "unrecognized option for download-rustc: {other}" )
2722
2730
}
0 commit comments