Skip to content

Commit f55ef48

Browse files
committed
set rust.channel properly in source tarballs
This change sets the appropriate channel by default when using nightly, beta or stable source tarballs. Signed-off-by: onur-ozkan <[email protected]>
1 parent ade234d commit f55ef48

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() {
@@ -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+
config.channel = ci_channel.clone_into();
1733+
}
1734+
17281735
if let Some(llvm) = toml.llvm {
17291736
let Llvm {
17301737
optimize: optimize_toml,

0 commit comments

Comments
 (0)