From 74ee56dd319ea958151d491fc602cd07ceea72d5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 24 Aug 2023 08:33:04 -0700 Subject: [PATCH 1/6] Update Rust in CI to 1.72.0 --- .github/actions/install-rust/action.yml | 3 ++- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index 04b227cbc60a..a41fdbec5c6f 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -5,7 +5,8 @@ inputs: toolchain: description: 'Default toolchan to install' required: false - default: '1.71.0' + # NB: when updating this additionally update `rust-version` in `Cargo.toml`. + default: '1.72.0' lockfiles: description: 'Path glob for Cargo.lock files to use as cache keys' required: false diff --git a/Cargo.toml b/Cargo.toml index 1a3620d8f88c..b68cf3738ecb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,7 @@ exclude = [ version = "13.0.0" authors = ["The Wasmtime Project Developers"] edition = "2021" -rust-version = "1.71.0" +rust-version = "1.72.0" [workspace.dependencies] wasmtime-wmemcheck = { path = "crates/wmemcheck", version = "=13.0.0" } From 2fe6222cbfa10d047e7865f8c0b3d73c6e1a3b6a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 31 Aug 2023 11:03:32 -0700 Subject: [PATCH 2/6] Update CI, tooling, and docs for MSRV This commit codifies an MSRV policy for Wasmtime at "stable minus two" meaning that the latest three releases of Rust will be supported. This is enforced on CI with a full test suite job running on Linux x86_64 with the minimum supported Rust version. The full test suite will use the latest stable version. A downside of this approach is that new changes may break MSRV support on non-Linux or non-x86_64 platforms and we won't know about it, but that's deemed a minor enough risk at this time. A minor fix is applied to Wasmtime's `Cargo.toml` to support Rust 1.70.0 instead of requiring Rust 1.71.0 --- .github/actions/install-rust/action.yml | 33 ++++++++++++++++++------- .github/workflows/main.yml | 2 ++ Cargo.toml | 2 +- ci/build-test-matrix.js | 15 +++++++++++ crates/wasmtime/Cargo.toml | 2 +- docs/contributing-coding-guidelines.md | 8 +++--- 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index a41fdbec5c6f..84f168a9f5a4 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -5,8 +5,7 @@ inputs: toolchain: description: 'Default toolchan to install' required: false - # NB: when updating this additionally update `rust-version` in `Cargo.toml`. - default: '1.72.0' + default: 'default' lockfiles: description: 'Path glob for Cargo.lock files to use as cache keys' required: false @@ -15,13 +14,33 @@ inputs: runs: using: composite steps: + - name: Install Rust + shell: bash + id: select + run: | + # This is Wasmtime's minimum supported rust version (MSRV). This is + # expressed as N in a version `1.N.0`. Wasmtime's current policy is that + # this number can be no larger than the current stable release of Rust + # minus 2. + # + # NB: when updating this additionally update `rust-version` in + # `Cargo.toml`. + msrv=70 + + if [ "${{ inputs.toolchain }}" = "default" ]; then + echo "version=1.$((msrv+2)).0" + elif [ "${{ inputs.toolchain }}" = "msrv" ]; then + echo "version=1.$msrv.0" + else + echo "version=${{ inputs.toolchain }}" + fi - name: Install Rust shell: bash run: | rustup set profile minimal - rustup update "${{ inputs.toolchain }}" --no-self-update - rustup default "${{ inputs.toolchain }}" + rustup update "${{ steps.select.outputs.version }}" --no-self-update + rustup default "${{ steps.select.outputs.version }}" # Save disk space by avoiding incremental compilation. Also turn down # debuginfo from 2 to 0 to help save disk space. @@ -32,11 +51,7 @@ runs: EOF # Deny warnings on CI to keep our code warning-free as it lands in-tree. - # Don't do this on nightly though, since there's a fair amount of - # warning churn there. - if [[ "${{ inputs.toolchain }}" != nightly* ]]; then - echo RUSTFLAGS="-D warnings" >> "$GITHUB_ENV" - fi + echo RUSTFLAGS="-D warnings" >> "$GITHUB_ENV" if [[ "${{ runner.os }}" = "macOS" ]]; then cat >> "$GITHUB_ENV" < Date: Thu, 31 Aug 2023 11:07:49 -0700 Subject: [PATCH 3/6] Fix installation of rust --- .github/actions/install-rust/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index 84f168a9f5a4..569c79e84935 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -28,11 +28,11 @@ runs: msrv=70 if [ "${{ inputs.toolchain }}" = "default" ]; then - echo "version=1.$((msrv+2)).0" + echo "version=1.$((msrv+2)).0" >> "$GITHUB_OUTPUT" elif [ "${{ inputs.toolchain }}" = "msrv" ]; then - echo "version=1.$msrv.0" + echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT" else - echo "version=${{ inputs.toolchain }}" + echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT" fi - name: Install Rust From 5fa63bea1d07e6c06b7793b56c07f80339e0047c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 31 Aug 2023 11:13:14 -0700 Subject: [PATCH 4/6] Scrape MSRV from Cargo.toml --- .github/actions/install-rust/action.yml | 11 +++-------- Cargo.toml | 2 ++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index 569c79e84935..003c994f6dfc 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -18,14 +18,9 @@ runs: shell: bash id: select run: | - # This is Wasmtime's minimum supported rust version (MSRV). This is - # expressed as N in a version `1.N.0`. Wasmtime's current policy is that - # this number can be no larger than the current stable release of Rust - # minus 2. - # - # NB: when updating this additionally update `rust-version` in - # `Cargo.toml`. - msrv=70 + # Determine MSRV as N in `1.N.0` by looking at the `rust-version` + # located in the root `Cargo.toml`. + msrv=$(grep 'rust-version.*1' Cargo.toml | sed 's/.*\.\([0-9]*\)\..*/\1/') if [ "${{ inputs.toolchain }}" = "default" ]; then echo "version=1.$((msrv+2)).0" >> "$GITHUB_OUTPUT" diff --git a/Cargo.toml b/Cargo.toml index dd8edb970cb6..5d33bfc78483 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,6 +123,8 @@ exclude = [ version = "13.0.0" authors = ["The Wasmtime Project Developers"] edition = "2021" +# Wasmtime's current policy is that this number can be no larger than the +# current stable release of Rust minus 2. rust-version = "1.70.0" [workspace.dependencies] From 46c728bc12fd445949444775503d44e100472a4a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 31 Aug 2023 11:21:11 -0700 Subject: [PATCH 5/6] Cranelift is the same as Wasmtime's MSRV now, more words too --- docs/contributing-coding-guidelines.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/contributing-coding-guidelines.md b/docs/contributing-coding-guidelines.md index 145502caa3b7..f092a886cf13 100644 --- a/docs/contributing-coding-guidelines.md +++ b/docs/contributing-coding-guidelines.md @@ -21,13 +21,16 @@ your editor. ### Minimum Supported `rustc` Version -Wasmtime supports the latest three stable releases of Rust. - -Cranelift supports stable Rust, and follows the [Rust Update Policy for -Firefox]. +Wasmtime and Cranelift supports the latest three stable releases of Rust. This +means that if the latest version of Rust is 1.72.0 then Wasmtime supports Rust +1.70.0, 1.71.0, and 1.72.0. CI will test by default with 1.72.0 and there will +be one job running the full test suite on Linux x86\_64 on 1.70.0. Some of the CI jobs depend on nightly Rust, for example to run rustdoc with nightly features, however these use pinned versions in CI that are updated periodically and the general repository does not depend on nightly features. +Updating Wasmtime's MSRV is done by editing the `rust-version` field in the +workspace root's `Cargo.toml` + [Rust Update Policy for Firefox]: https://wiki.mozilla.org/Rust_Update_Policy_for_Firefox#Schedule From 1342622febecc4325d677a7e5417add9c6415326 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 31 Aug 2023 12:36:45 -0700 Subject: [PATCH 6/6] Fix a typo --- docs/contributing-coding-guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing-coding-guidelines.md b/docs/contributing-coding-guidelines.md index f092a886cf13..40d4f0543044 100644 --- a/docs/contributing-coding-guidelines.md +++ b/docs/contributing-coding-guidelines.md @@ -21,7 +21,7 @@ your editor. ### Minimum Supported `rustc` Version -Wasmtime and Cranelift supports the latest three stable releases of Rust. This +Wasmtime and Cranelift support the latest three stable releases of Rust. This means that if the latest version of Rust is 1.72.0 then Wasmtime supports Rust 1.70.0, 1.71.0, and 1.72.0. CI will test by default with 1.72.0 and there will be one job running the full test suite on Linux x86\_64 on 1.70.0.