@@ -1375,6 +1375,25 @@ impl Config {
1375
1375
let mut omit_git_hash = None ;
1376
1376
1377
1377
if let Some ( rust) = toml. rust {
1378
+ set ( & mut config. channel , rust. channel ) ;
1379
+
1380
+ config. download_rustc_commit = config. download_ci_rustc_commit ( rust. download_rustc ) ;
1381
+ // This list is incomplete, please help by expanding it!
1382
+ if config. download_rustc_commit . is_some ( ) {
1383
+ // We need the channel used by the downloaded compiler to match the one we set for rustdoc;
1384
+ // otherwise rustdoc-ui tests break.
1385
+ let ci_channel = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1386
+ let ci_channel = ci_channel. trim_end ( ) ;
1387
+ if config. channel != ci_channel
1388
+ && !( config. channel == "dev" && ci_channel == "nightly" )
1389
+ {
1390
+ panic ! (
1391
+ "setting rust.channel={} is incompatible with download-rustc" ,
1392
+ config. channel
1393
+ ) ;
1394
+ }
1395
+ }
1396
+
1378
1397
debug = rust. debug ;
1379
1398
debug_assertions = rust. debug_assertions ;
1380
1399
debug_assertions_std = rust. debug_assertions_std ;
@@ -1386,6 +1405,7 @@ impl Config {
1386
1405
debuginfo_level_std = rust. debuginfo_level_std ;
1387
1406
debuginfo_level_tools = rust. debuginfo_level_tools ;
1388
1407
debuginfo_level_tests = rust. debuginfo_level_tests ;
1408
+
1389
1409
config. rust_split_debuginfo = rust
1390
1410
. split_debuginfo
1391
1411
. as_deref ( )
@@ -1401,7 +1421,6 @@ impl Config {
1401
1421
set ( & mut config. jemalloc , rust. jemalloc ) ;
1402
1422
set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
1403
1423
set ( & mut config. backtrace , rust. backtrace ) ;
1404
- set ( & mut config. channel , rust. channel ) ;
1405
1424
config. description = rust. description ;
1406
1425
set ( & mut config. rust_dist_src , rust. dist_src ) ;
1407
1426
set ( & mut config. verbose_tests , rust. verbose_tests ) ;
@@ -1442,8 +1461,6 @@ impl Config {
1442
1461
config. rust_codegen_units_std = rust. codegen_units_std . map ( threads_from_config) ;
1443
1462
config. rust_profile_use = flags. rust_profile_use . or ( rust. profile_use ) ;
1444
1463
config. rust_profile_generate = flags. rust_profile_generate . or ( rust. profile_generate ) ;
1445
- config. download_rustc_commit = config. download_ci_rustc_commit ( rust. download_rustc ) ;
1446
-
1447
1464
config. rust_lto = rust
1448
1465
. lto
1449
1466
. as_deref ( )
@@ -1555,6 +1572,11 @@ impl Config {
1555
1572
let mut target = Target :: from_triple ( & triple) ;
1556
1573
1557
1574
if let Some ( ref s) = cfg. llvm_config {
1575
+ if config. download_rustc_commit . is_some ( ) && triple == & * config. build . triple {
1576
+ panic ! (
1577
+ "setting llvm_config for the host is incompatible with download-rustc"
1578
+ ) ;
1579
+ }
1558
1580
target. llvm_config = Some ( config. src . join ( s) ) ;
1559
1581
}
1560
1582
target. llvm_has_rust_patches = cfg. llvm_has_rust_patches ;
@@ -1825,6 +1847,12 @@ impl Config {
1825
1847
self . out . join ( & * self . build . triple ) . join ( "ci-llvm" )
1826
1848
}
1827
1849
1850
+ /// Directory where the extracted `rustc-dev` component is stored.
1851
+ pub ( crate ) fn ci_rustc_dir ( & self ) -> PathBuf {
1852
+ assert ! ( self . download_rustc( ) ) ;
1853
+ self . out . join ( self . build . triple ) . join ( "ci-rustc" )
1854
+ }
1855
+
1828
1856
/// Determine whether llvm should be linked dynamically.
1829
1857
///
1830
1858
/// If `false`, llvm should be linked statically.
@@ -1860,11 +1888,11 @@ impl Config {
1860
1888
self . download_rustc_commit ( ) . is_some ( )
1861
1889
}
1862
1890
1863
- pub ( crate ) fn download_rustc_commit ( & self ) -> Option < & ' static str > {
1891
+ pub ( crate ) fn download_rustc_commit ( & self ) -> Option < & str > {
1864
1892
static DOWNLOAD_RUSTC : OnceCell < Option < String > > = OnceCell :: new ( ) ;
1865
1893
if self . dry_run ( ) && DOWNLOAD_RUSTC . get ( ) . is_none ( ) {
1866
1894
// avoid trying to actually download the commit
1867
- return None ;
1895
+ return self . download_rustc_commit . as_deref ( ) ;
1868
1896
}
1869
1897
1870
1898
DOWNLOAD_RUSTC
0 commit comments