@@ -39,6 +39,16 @@ macro_rules! check_ci_llvm {
3939 } ;
4040}
4141
42+ macro_rules! check_ci_rustc {
43+ ( $name: expr) => {
44+ assert!(
45+ $name. is_none( ) ,
46+ "setting {} is incompatible with download-ci-rustc." ,
47+ stringify!( $name)
48+ ) ;
49+ } ;
50+ }
51+
4252#[ derive( Clone , Default ) ]
4353pub enum DryRun {
4454 /// This isn't a dry run.
@@ -1328,6 +1338,25 @@ impl Config {
13281338 let mut omit_git_hash = None ;
13291339
13301340 if let Some ( rust) = toml. rust {
1341+ set ( & mut config. channel , rust. channel ) ;
1342+
1343+ config. download_rustc_commit = config. download_ci_rustc_commit ( rust. download_rustc ) ;
1344+ // This list is incomplete, please help by expanding it!
1345+ if config. download_rustc_commit . is_some ( ) {
1346+ // We need the channel used by the downloaded compiler to match the one we set for rustdoc;
1347+ // otherwise rustdoc-ui tests break.
1348+ let ci_channel = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1349+ let ci_channel = ci_channel. trim_end ( ) ;
1350+ if config. channel != ci_channel
1351+ && !( config. channel == "dev" && ci_channel == "nightly" )
1352+ {
1353+ panic ! (
1354+ "setting rust.channel={} is incompatible with download-rustc" ,
1355+ config. channel
1356+ ) ;
1357+ }
1358+ }
1359+
13311360 debug = rust. debug ;
13321361 debug_assertions = rust. debug_assertions ;
13331362 debug_assertions_std = rust. debug_assertions_std ;
@@ -1339,6 +1368,7 @@ impl Config {
13391368 debuginfo_level_std = rust. debuginfo_level_std ;
13401369 debuginfo_level_tools = rust. debuginfo_level_tools ;
13411370 debuginfo_level_tests = rust. debuginfo_level_tests ;
1371+
13421372 config. rust_split_debuginfo = rust
13431373 . split_debuginfo
13441374 . as_deref ( )
@@ -1354,7 +1384,6 @@ impl Config {
13541384 set ( & mut config. jemalloc , rust. jemalloc ) ;
13551385 set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
13561386 set ( & mut config. backtrace , rust. backtrace ) ;
1357- set ( & mut config. channel , rust. channel ) ;
13581387 config. description = rust. description ;
13591388 set ( & mut config. rust_dist_src , rust. dist_src ) ;
13601389 set ( & mut config. verbose_tests , rust. verbose_tests ) ;
@@ -1395,8 +1424,6 @@ impl Config {
13951424 config. rust_codegen_units_std = rust. codegen_units_std . map ( threads_from_config) ;
13961425 config. rust_profile_use = flags. rust_profile_use . or ( rust. profile_use ) ;
13971426 config. rust_profile_generate = flags. rust_profile_generate . or ( rust. profile_generate ) ;
1398- config. download_rustc_commit = config. download_ci_rustc_commit ( rust. download_rustc ) ;
1399-
14001427 config. rust_lto = rust
14011428 . lto
14021429 . as_deref ( )
@@ -1491,6 +1518,10 @@ impl Config {
14911518 check_ci_llvm ! ( llvm. plugins) ;
14921519 }
14931520
1521+ if config. download_rustc_commit . is_some ( ) {
1522+ check_ci_rustc ! ( llvm. assertions) ;
1523+ }
1524+
14941525 // NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
14951526 if config. llvm_thin_lto && llvm. link_shared . is_none ( ) {
14961527 // If we're building with ThinLTO on, by default we want to link
@@ -1508,6 +1539,11 @@ impl Config {
15081539 let mut target = Target :: from_triple ( & triple) ;
15091540
15101541 if let Some ( ref s) = cfg. llvm_config {
1542+ if config. download_rustc_commit . is_some ( ) && triple == & * config. build . triple {
1543+ panic ! (
1544+ "setting llvm_config for the host is incompatible with download-rustc"
1545+ ) ;
1546+ }
15111547 target. llvm_config = Some ( config. src . join ( s) ) ;
15121548 }
15131549 target. llvm_has_rust_patches = cfg. llvm_has_rust_patches ;
0 commit comments