From 5f372fe7d18efd9770d0f9b23895a049c28dcc41 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Sat, 6 Sep 2025 16:29:26 +0800 Subject: bump-stage0: pick highest common `toml` version, add a workaround - We pick the higest common `toml` version used in the r-l/r workspace to avoid introducing Yet Another `toml` `0.x` version, which happens to be `0.8.23` as of the time of writing. - We introduce a byte-buffer-to-string workaround for the `toml 0.8.*` series that do not have the `toml 0.9.*` series's `toml::from_slice` API yet. Not efficient, but this is not perf-critical so it's fine. --- Cargo.lock | 2 +- src/tools/bump-stage0/Cargo.toml | 2 +- src/tools/bump-stage0/src/main.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4c96f1569b..aa2bdb38536 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,7 +336,7 @@ dependencies = [ "curl", "indexmap", "serde", - "toml 0.7.8", + "toml 0.8.23", ] [[package]] diff --git a/src/tools/bump-stage0/Cargo.toml b/src/tools/bump-stage0/Cargo.toml index b7f3625da91..79097f2c189 100644 --- a/src/tools/bump-stage0/Cargo.toml +++ b/src/tools/bump-stage0/Cargo.toml @@ -11,4 +11,4 @@ build_helper = { path = "../../build_helper" } curl = "0.4.38" indexmap = { version = "2.0.0", features = ["serde"] } serde = { version = "1.0.125", features = ["derive"] } -toml = "0.7" +toml = "0.8.23" diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs index 680437cce4f..faed748785f 100644 --- a/src/tools/bump-stage0/src/main.rs +++ b/src/tools/bump-stage0/src/main.rs @@ -185,7 +185,11 @@ fn fetch_manifest( format!("{}/dist/channel-rust-{}.toml", config.dist_server, channel) }; - Ok(toml::from_slice(&http_get(&url)?)?) + // FIXME: on newer `toml` (>= `0.9.*`), use `toml::from_slice`. For now, we use the most recent + // `toml` available in-tree which is `0.8.*`, so we have to do an additional dance here. + let response = http_get(&url)?; + let response = String::from_utf8(response)?; + Ok(toml::from_str(&response)?) } fn http_get(url: &str) -> Result, Error> { -- cgit 1.4.1-3-g733a5 From d5e61216a74efede682f88c65a9fe59769848c76 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Sat, 6 Sep 2025 16:11:26 +0800 Subject: bootstrap: add check step for `src/tools/bump-stage0` --- src/bootstrap/src/core/build_steps/check.rs | 6 ++++++ src/bootstrap/src/core/builder/mod.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index 49d12b64da5..043457f64e5 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -839,3 +839,9 @@ tool_check_step!(Linkchecker { mode: |_builder| Mode::ToolBootstrap, default: false }); + +tool_check_step!(BumpStage0 { + path: "src/tools/bump-stage0", + mode: |_builder| Mode::ToolBootstrap, + default: false +}); diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 627085df812..a818a5c756c 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -1061,6 +1061,7 @@ impl<'a> Builder<'a> { check::FeaturesStatusDump, check::CoverageDump, check::Linkchecker, + check::BumpStage0, // This has special staging logic, it may run on stage 1 while others run on stage 0. // It takes quite some time to build stage 1, so put this at the end. // -- cgit 1.4.1-3-g733a5 From 312a1240a3cde43ca16e5275457688e47d7bccd8 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Sat, 6 Sep 2025 16:12:08 +0800 Subject: ci: check `src/tools/bump-stage0` in `pr-check-2` To catch obvious build failures of the `src/tools/bump-stage0` early, before we find out it can't even build when we really need it to work. --- src/ci/docker/host-x86_64/pr-check-2/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile index 8073b8efb46..d6470e4deb8 100644 --- a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile @@ -28,6 +28,7 @@ RUN sh /scripts/sccache.sh ENV SCRIPT \ python3 ../x.py check && \ + python3 ../x.py check src/tools/bump-stage0 && \ python3 ../x.py clippy ci --stage 2 && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ python3 ../x.py test --stage 1 src/tools/compiletest && \ -- cgit 1.4.1-3-g733a5