Skip to content

Commit 207c5bc

Browse files
committed
override user defined channel when using precompiled rustc
Signed-off-by: onur-ozkan <[email protected]>
1 parent e794b0f commit 207c5bc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

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

+17-1
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,23 @@ impl Config {
17181718
config.omit_git_hash = omit_git_hash.unwrap_or(default);
17191719
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
17201720

1721-
if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
1721+
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
1722+
// This is because if the compiler uses a different channel than the one specified in config.toml,
1723+
// tests may fail due to using a different channel than the one used by the compiler during tests.
1724+
if let Some(commit) = &config.download_rustc_commit {
1725+
if is_user_configured_rust_channel {
1726+
println!(
1727+
"WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
1728+
);
1729+
1730+
let channel = config
1731+
.read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
1732+
.trim()
1733+
.to_owned();
1734+
1735+
config.channel = channel;
1736+
}
1737+
} else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
17221738
ci_channel.clone_into(&mut config.channel);
17231739
}
17241740

0 commit comments

Comments
 (0)