@@ -1307,6 +1307,9 @@ impl Config {
1307
1307
toml_path = config. src . join ( toml_path) ;
1308
1308
}
1309
1309
1310
+ let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1311
+ let ci_channel = file_content. trim_end ( ) ;
1312
+
1310
1313
// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
1311
1314
// but not if `config.toml` hasn't been created.
1312
1315
let mut toml = if !using_default_path || toml_path. exists ( ) {
@@ -1533,6 +1536,7 @@ impl Config {
1533
1536
let mut optimize = None ;
1534
1537
let mut omit_git_hash = None ;
1535
1538
1539
+ let mut is_user_configured_rust_channel = false ;
1536
1540
if let Some ( rust) = toml. rust {
1537
1541
let Rust {
1538
1542
optimize : optimize_toml,
@@ -1590,15 +1594,14 @@ impl Config {
1590
1594
lld_mode,
1591
1595
} = rust;
1592
1596
1597
+ is_user_configured_rust_channel = channel. is_some ( ) ;
1593
1598
set ( & mut config. channel , channel) ;
1594
1599
1595
1600
config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
1596
1601
// This list is incomplete, please help by expanding it!
1597
1602
if config. download_rustc_commit . is_some ( ) {
1598
1603
// We need the channel used by the downloaded compiler to match the one we set for rustdoc;
1599
1604
// otherwise rustdoc-ui tests break.
1600
- let ci_channel = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1601
- let ci_channel = ci_channel. trim_end ( ) ;
1602
1605
if config. channel != ci_channel
1603
1606
&& !( config. channel == "dev" && ci_channel == "nightly" )
1604
1607
{
@@ -1725,6 +1728,10 @@ impl Config {
1725
1728
config. omit_git_hash = omit_git_hash. unwrap_or ( default) ;
1726
1729
config. rust_info = GitInfo :: new ( config. omit_git_hash , & config. src ) ;
1727
1730
1731
+ if config. rust_info . is_from_tarball ( ) && !is_user_configured_rust_channel {
1732
+ config. channel = ci_channel. clone_into ( ) ;
1733
+ }
1734
+
1728
1735
if let Some ( llvm) = toml. llvm {
1729
1736
let Llvm {
1730
1737
optimize : optimize_toml,
0 commit comments