about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-02-28 21:41:59 +0800
committerGitHub <noreply@github.com>2025-02-28 21:41:59 +0800
commitdedf61a29d25ce16211b3ed20e15968da7e7bb13 (patch)
tree00dfab037f9830f9b53e8ae0698ba11208749729
parent2ebf40719a6800ea9dbc29d65e10025fd5314389 (diff)
parent1ccff0e01a8dd25623b535bc80b4d5d791e8f62d (diff)
downloadrust-dedf61a29d25ce16211b3ed20e15968da7e7bb13.tar.gz
rust-dedf61a29d25ce16211b3ed20e15968da7e7bb13.zip
Rollup merge of #137220 - ferrocene:pa-channel-ci, r=Kobzol
Support `rust.channel = "auto-detect"`

As [discussed in Zulip](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/vibe.20check.20for.20a.20few.20config.20changes), this PR adds the new `"auto-detect"` value for `rust.channel`, to load the channel name from `src/ci/channel`.

Note that in a previous iteration of this PR the value was "ci" instead of "auto-detect".
-rw-r--r--config.example.toml9
-rw-r--r--src/bootstrap/src/core/config/config.rs6
-rw-r--r--src/bootstrap/src/utils/change_tracker.rs5
3 files changed, 15 insertions, 5 deletions
diff --git a/config.example.toml b/config.example.toml
index a17d3ec9f88..2e26c024865 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -608,11 +608,12 @@
 
 # The "channel" for the Rust build to produce. The stable/beta channels only
 # allow using stable features, whereas the nightly and dev channels allow using
-# nightly features
+# nightly features.
 #
-# If using tarball sources, default value for `channel` is taken from the `src/ci/channel` file;
-# otherwise, it's "dev".
-#channel = if "is a tarball source" { content of `src/ci/channel` file } else { "dev" }
+# You can set the channel to "auto-detect" to load the channel name from `src/ci/channel`.
+#
+# If using tarball sources, default value is "auto-detect", otherwise, it's "dev".
+#channel = if "is a tarball source" { "auto-detect" } else { "dev" }
 
 # A descriptive string to be appended to `rustc --version` output, which is
 # also used in places like debuginfo `DW_AT_producer`. This may be useful for
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 2be42f16e2a..d0e0ed50ad8 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1777,7 +1777,11 @@ impl Config {
 
         let is_user_configured_rust_channel =
             if let Some(channel) = toml.rust.as_ref().and_then(|r| r.channel.clone()) {
-                config.channel = channel;
+                if channel == "auto-detect" {
+                    config.channel = ci_channel.into();
+                } else {
+                    config.channel = channel;
+                }
                 true
             } else {
                 false
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index 8dfe0d3a35e..5f49c50c5ad 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -360,4 +360,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
         severity: ChangeSeverity::Info,
         summary: "Added `build.test-stage = 2` to 'tools' profile defaults",
     },
+    ChangeInfo {
+        change_id: 137220,
+        severity: ChangeSeverity::Info,
+        summary: "`rust.channel` now supports \"auto-detect\" to load the channel from `src/ci/channel`",
+    },
 ];