@@ -39,6 +39,16 @@ macro_rules! check_ci_llvm {
39
39
} ;
40
40
}
41
41
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
+
42
52
#[ derive( Clone , Default ) ]
43
53
pub enum DryRun {
44
54
/// This isn't a dry run.
@@ -1328,6 +1338,25 @@ impl Config {
1328
1338
let mut omit_git_hash = None ;
1329
1339
1330
1340
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
+
1331
1360
debug = rust. debug ;
1332
1361
debug_assertions = rust. debug_assertions ;
1333
1362
debug_assertions_std = rust. debug_assertions_std ;
@@ -1339,6 +1368,7 @@ impl Config {
1339
1368
debuginfo_level_std = rust. debuginfo_level_std ;
1340
1369
debuginfo_level_tools = rust. debuginfo_level_tools ;
1341
1370
debuginfo_level_tests = rust. debuginfo_level_tests ;
1371
+
1342
1372
config. rust_split_debuginfo = rust
1343
1373
. split_debuginfo
1344
1374
. as_deref ( )
@@ -1354,7 +1384,6 @@ impl Config {
1354
1384
set ( & mut config. jemalloc , rust. jemalloc ) ;
1355
1385
set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
1356
1386
set ( & mut config. backtrace , rust. backtrace ) ;
1357
- set ( & mut config. channel , rust. channel ) ;
1358
1387
config. description = rust. description ;
1359
1388
set ( & mut config. rust_dist_src , rust. dist_src ) ;
1360
1389
set ( & mut config. verbose_tests , rust. verbose_tests ) ;
@@ -1395,8 +1424,6 @@ impl Config {
1395
1424
config. rust_codegen_units_std = rust. codegen_units_std . map ( threads_from_config) ;
1396
1425
config. rust_profile_use = flags. rust_profile_use . or ( rust. profile_use ) ;
1397
1426
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
-
1400
1427
config. rust_lto = rust
1401
1428
. lto
1402
1429
. as_deref ( )
@@ -1491,6 +1518,10 @@ impl Config {
1491
1518
check_ci_llvm ! ( llvm. plugins) ;
1492
1519
}
1493
1520
1521
+ if config. download_rustc_commit . is_some ( ) {
1522
+ check_ci_rustc ! ( llvm. assertions) ;
1523
+ }
1524
+
1494
1525
// NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
1495
1526
if config. llvm_thin_lto && llvm. link_shared . is_none ( ) {
1496
1527
// If we're building with ThinLTO on, by default we want to link
@@ -1508,6 +1539,11 @@ impl Config {
1508
1539
let mut target = Target :: from_triple ( & triple) ;
1509
1540
1510
1541
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
+ }
1511
1547
target. llvm_config = Some ( config. src . join ( s) ) ;
1512
1548
}
1513
1549
target. llvm_has_rust_patches = cfg. llvm_has_rust_patches ;
0 commit comments