@@ -1307,6 +1307,9 @@ impl Config {
13071307 toml_path = config. src . join ( toml_path) ;
13081308 }
13091309
1310+ let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1311+ let ci_channel = file_content. trim_end ( ) ;
1312+
13101313 // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
13111314 // but not if `config.toml` hasn't been created.
13121315 let mut toml = if !using_default_path || toml_path. exists ( ) {
@@ -1533,6 +1536,7 @@ impl Config {
15331536 let mut optimize = None ;
15341537 let mut omit_git_hash = None ;
15351538
1539+ let mut is_user_configured_rust_channel = false ;
15361540 if let Some ( rust) = toml. rust {
15371541 let Rust {
15381542 optimize : optimize_toml,
@@ -1590,15 +1594,14 @@ impl Config {
15901594 lld_mode,
15911595 } = rust;
15921596
1597+ is_user_configured_rust_channel = channel. is_some ( ) ;
15931598 set ( & mut config. channel , channel) ;
15941599
15951600 config. download_rustc_commit = config. download_ci_rustc_commit ( download_rustc) ;
15961601 // This list is incomplete, please help by expanding it!
15971602 if config. download_rustc_commit . is_some ( ) {
15981603 // We need the channel used by the downloaded compiler to match the one we set for rustdoc;
15991604 // 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 ( ) ;
16021605 if config. channel != ci_channel
16031606 && !( config. channel == "dev" && ci_channel == "nightly" )
16041607 {
@@ -1725,6 +1728,10 @@ impl Config {
17251728 config. omit_git_hash = omit_git_hash. unwrap_or ( default) ;
17261729 config. rust_info = GitInfo :: new ( config. omit_git_hash , & config. src ) ;
17271730
1731+ if config. rust_info . is_from_tarball ( ) && !is_user_configured_rust_channel {
1732+ ci_channel. clone_into ( & mut config. channel ) ;
1733+ }
1734+
17281735 if let Some ( llvm) = toml. llvm {
17291736 let Llvm {
17301737 optimize : optimize_toml,
0 commit comments