Skip to content

Commit 0fabbf3

Browse files
authored
Unrolled build for rust-lang#139574
Rollup merge of rust-lang#139574 - onur-ozkan:better-channel-handling, r=onur-ozkan bootstrap: improve `channel` handling Fixes rust-lang#139569 See [this comment](rust-lang#139574 (comment)) for the explanation of this bug.
2 parents e62d47d + b1053fd commit 0fabbf3

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/bootstrap/defaults/bootstrap.dist.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ download-ci-llvm = false
1717
[rust]
1818
# We have several defaults in bootstrap that depend on whether the channel is `dev` (e.g. `omit-git-hash` and `download-ci-llvm`).
1919
# Make sure they don't get set when installing from source.
20-
channel = "nightly"
20+
channel = "auto-detect"
2121
# Never download a rustc, distributions must build a fresh compiler.
2222
download-rustc = false
2323
lld = true

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

+18-15
Original file line numberDiff line numberDiff line change
@@ -1544,9 +1544,6 @@ impl Config {
15441544
}
15451545
}
15461546

1547-
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
1548-
let ci_channel = file_content.trim_end();
1549-
15501547
// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
15511548
// but not if `bootstrap.toml` hasn't been created.
15521549
let mut toml = if !using_default_path || toml_path.exists() {
@@ -1852,17 +1849,21 @@ impl Config {
18521849
let mut lld_enabled = None;
18531850
let mut std_features = None;
18541851

1855-
let is_user_configured_rust_channel =
1856-
if let Some(channel) = toml.rust.as_ref().and_then(|r| r.channel.clone()) {
1857-
if channel == "auto-detect" {
1858-
config.channel = ci_channel.into();
1859-
} else {
1860-
config.channel = channel;
1861-
}
1852+
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
1853+
let ci_channel = file_content.trim_end();
1854+
1855+
let toml_channel = toml.rust.as_ref().and_then(|r| r.channel.clone());
1856+
let is_user_configured_rust_channel = match toml_channel {
1857+
Some(channel) if channel == "auto-detect" => {
1858+
config.channel = ci_channel.into();
18621859
true
1863-
} else {
1864-
false
1865-
};
1860+
}
1861+
Some(channel) => {
1862+
config.channel = channel;
1863+
true
1864+
}
1865+
None => false,
1866+
};
18661867

18671868
let default = config.channel == "dev";
18681869
config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default);
@@ -1887,6 +1888,10 @@ impl Config {
18871888
&& config.src.join(".cargo/config.toml").exists(),
18881889
);
18891890

1891+
if !is_user_configured_rust_channel && config.rust_info.is_from_tarball() {
1892+
config.channel = ci_channel.into();
1893+
}
1894+
18901895
if let Some(rust) = toml.rust {
18911896
let Rust {
18921897
optimize: optimize_toml,
@@ -2090,8 +2095,6 @@ impl Config {
20902095

20912096
config.channel = channel;
20922097
}
2093-
} else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
2094-
ci_channel.clone_into(&mut config.channel);
20952098
}
20962099

20972100
if let Some(llvm) = toml.llvm {

0 commit comments

Comments
 (0)