Skip to content

Commit 52de709

Browse files
authored
Rollup merge of #125181 - onur-ozkan:set-rust-channel-properly, r=clubby789
set `rust.channel` properly in source tarballs This change sets the appropriate channel by default when using nightly, beta or stable source tarballs. Fixes #124618
2 parents 7a8d222 + e9c8273 commit 52de709

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/bootstrap/src/core/config/config.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -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() {
@@ -1534,6 +1537,7 @@ impl Config {
15341537
let mut omit_git_hash = None;
15351538
let mut lld_enabled = None;
15361539

1540+
let mut is_user_configured_rust_channel = false;
15371541
if let Some(rust) = toml.rust {
15381542
let Rust {
15391543
optimize: optimize_toml,
@@ -1591,15 +1595,14 @@ impl Config {
15911595
lld_mode,
15921596
} = rust;
15931597

1598+
is_user_configured_rust_channel = channel.is_some();
15941599
set(&mut config.channel, channel);
15951600

15961601
config.download_rustc_commit = config.download_ci_rustc_commit(download_rustc);
15971602
// This list is incomplete, please help by expanding it!
15981603
if config.download_rustc_commit.is_some() {
15991604
// We need the channel used by the downloaded compiler to match the one we set for rustdoc;
16001605
// otherwise rustdoc-ui tests break.
1601-
let ci_channel = t!(fs::read_to_string(config.src.join("src/ci/channel")));
1602-
let ci_channel = ci_channel.trim_end();
16031606
if config.channel != ci_channel
16041607
&& !(config.channel == "dev" && ci_channel == "nightly")
16051608
{
@@ -1717,6 +1720,10 @@ impl Config {
17171720
config.omit_git_hash = omit_git_hash.unwrap_or(default);
17181721
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
17191722

1723+
if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
1724+
ci_channel.clone_into(&mut config.channel);
1725+
}
1726+
17201727
if let Some(llvm) = toml.llvm {
17211728
let Llvm {
17221729
optimize: optimize_toml,

0 commit comments

Comments
 (0)