about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-06-17 08:48:49 +0300
committeronur-ozkan <work@onurozkan.dev>2024-06-17 08:48:49 +0300
commit207c5bc5a9007acd5bf3dbd58ef361bbb3ff3866 (patch)
treedfb82ed34ff88bf26cb767b2e9f3eaafbd1cd55a /src
parente794b0f8557c187b5909d889aa35071f81e0a4cc (diff)
downloadrust-207c5bc5a9007acd5bf3dbd58ef361bbb3ff3866.tar.gz
rust-207c5bc5a9007acd5bf3dbd58ef361bbb3ff3866.zip
override user defined channel when using precompiled rustc
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/config/config.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index a1d8ca3cbca..0438dee7241 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1718,7 +1718,23 @@ impl Config {
         config.omit_git_hash = omit_git_hash.unwrap_or(default);
         config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
 
-        if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
+        // We need to override `rust.channel` if it's manually specified when using the CI rustc.
+        // This is because if the compiler uses a different channel than the one specified in config.toml,
+        // tests may fail due to using a different channel than the one used by the compiler during tests.
+        if let Some(commit) = &config.download_rustc_commit {
+            if is_user_configured_rust_channel {
+                println!(
+                    "WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
+                );
+
+                let channel = config
+                    .read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
+                    .trim()
+                    .to_owned();
+
+                config.channel = channel;
+            }
+        } else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
             ci_channel.clone_into(&mut config.channel);
         }