Skip to content

Commit f71219f

Browse files
committed
parse config.channel earlier
Signed-off-by: onur-ozkan <[email protected]>
1 parent 75b451b commit f71219f

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

Diff for: src/bootstrap/src/core/config/config.rs

+22-17
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,6 @@ impl Config {
15401540
}
15411541
}
15421542

1543-
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
1544-
let ci_channel = file_content.trim_end();
1545-
15461543
// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
15471544
// but not if `bootstrap.toml` hasn't been created.
15481545
let mut toml = if !using_default_path || toml_path.exists() {
@@ -1847,18 +1844,6 @@ impl Config {
18471844
let mut lld_enabled = None;
18481845
let mut std_features = None;
18491846

1850-
let is_user_configured_rust_channel =
1851-
if let Some(channel) = toml.rust.as_ref().and_then(|r| r.channel.clone()) {
1852-
if channel == "auto-detect" {
1853-
config.channel = ci_channel.into();
1854-
} else {
1855-
config.channel = channel;
1856-
}
1857-
true
1858-
} else {
1859-
false
1860-
};
1861-
18621847
let default = config.channel == "dev";
18631848
config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default);
18641849

@@ -1882,6 +1867,28 @@ impl Config {
18821867
&& config.src.join(".cargo/config.toml").exists(),
18831868
);
18841869

1870+
let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel")));
1871+
let ci_channel = file_content.trim_end();
1872+
1873+
let is_user_configured_rust_channel =
1874+
match toml.rust.as_ref().and_then(|r| r.channel.clone()) {
1875+
Some(channel) => {
1876+
if channel == "auto-detect" {
1877+
config.channel = ci_channel.into();
1878+
} else {
1879+
config.channel = channel;
1880+
}
1881+
1882+
true
1883+
}
1884+
None => {
1885+
if config.rust_info.is_from_tarball() {
1886+
config.channel = ci_channel.into();
1887+
}
1888+
false
1889+
}
1890+
};
1891+
18851892
if let Some(rust) = toml.rust {
18861893
let Rust {
18871894
optimize: optimize_toml,
@@ -2085,8 +2092,6 @@ impl Config {
20852092

20862093
config.channel = channel;
20872094
}
2088-
} else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
2089-
ci_channel.clone_into(&mut config.channel);
20902095
}
20912096

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

0 commit comments

Comments
 (0)