From 04746e747e2452efe8108cc6b1d092c43cd2df56 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Sun, 8 Feb 2026 17:04:36 -0500 Subject: [PATCH] Implement 3 part MSRV policy (#8999) --- .github/workflows/changelog.yml | 2 +- .github/workflows/ci.yml | 94 +++++++++++++++++-- .github/workflows/docs.yml | 2 +- .github/workflows/generate.yml | 8 +- CHANGELOG.md | 6 ++ README.md | 28 ++++-- .../standalone/01_hello_compute/Cargo.toml | 2 +- .../standalone/02_hello_window/Cargo.toml | 2 +- examples/standalone/custom_backend/Cargo.toml | 2 +- naga/Cargo.toml | 2 +- wgpu-core/Cargo.toml | 10 +- wgpu-hal/Cargo.toml | 10 +- wgpu-types/Cargo.toml | 10 +- wgpu/Cargo.toml | 7 +- wgpu/src/lib.rs | 2 +- 15 files changed, 143 insertions(+), 44 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index f1ebcd635..0f045770a 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -18,7 +18,7 @@ env: # Dependency versioning # - # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. + # This is the MSRV used by all repository infrastructure. REPO_MSRV: "1.93" # diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f24173a88..d3e34d3ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,13 @@ env: # Dependency versioning # - # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. + # This is the MSRV used by all repository infrastructure. REPO_MSRV: "1.93" + # This is the MSRV used by `wgpu` itself. + WGPU_MSRV: "1.87" # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, # to ensure that they can be used with firefox. - CORE_MSRV: "1.90.0" + CORE_MSRV: "1.87" # # Environment variables @@ -350,6 +352,83 @@ jobs: --package wgpu \ --all-features --no-deps --document-private-items + # We run minimal checks on the MSRV of the `wgpu` crate, ensuring that + # its dependency tree does not cause issues for servo or other users. + # + # We don't test all platforms, just ones with different dependency stacks. + check-wgpu-msrv: + # runtime is normally 1-3 minutes + timeout-minutes: 10 + + strategy: + fail-fast: false + matrix: + include: + # Windows + - name: Windows x86_64 + os: windows-2022 + target: x86_64-pc-windows-msvc + + # MacOS + - name: MacOS x86_64 + os: macos-14 + target: x86_64-apple-darwin + + # Linux + - name: Linux x86_64 + os: ubuntu-24.04 + target: x86_64-unknown-linux-gnu + + # WebGPU + - name: WebAssembly + os: ubuntu-24.04 + target: wasm32-unknown-unknown + + name: wgpu MSRV Check ${{ matrix.name }} + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Install core MSRV toolchain + run: | + rustup toolchain install ${{ env.WGPU_MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }} + rustup override set ${{ env.WGPU_MSRV }} + cargo -V + + - name: Disable debug symbols + shell: bash + run: | + mkdir -p .cargo + + cat <> .cargo/config.toml + [profile.dev] + debug = false + EOF + + - name: Caching + uses: Swatinem/rust-cache@v2 + with: + key: wgpu-msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }} + + - name: Reduce MSRV on dependencies + shell: bash + run: | + set -e + + # No needed operations currently. + # If we find a dependency that needs to be downgraded to achieve + # the MSRV, we can do it here with `cargo update -p --precise ` + + - name: Check native + shell: bash + run: | + set -e + + # check `wgpu` with all features. + cargo check --target ${{ matrix.target }} --all-features -p wgpu + # We run minimal checks on the MSRV of the core crates, ensuring that # its dependency tree does not cause issues for firefox. # @@ -377,7 +456,7 @@ jobs: os: ubuntu-24.04 target: x86_64-unknown-linux-gnu - name: MSRV Check ${{ matrix.name }} + name: Core MSRV Check ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: @@ -403,17 +482,16 @@ jobs: - name: Caching uses: Swatinem/rust-cache@v2 with: - key: msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }} + key: core-msrv-check-${{ matrix.target }}-${{ env.CACHE_SUFFIX }} - name: Reduce MSRV on dependencies shell: bash run: | set -e - # 1.23.2 requires bytemuck_derive 1.10.1 - cargo update -p bytemuck --precise 1.23.1 - # 1.9.0 requires MSRV 1.84 - cargo update -p bytemuck_derive --precise 1.8.1 + # No needed operations currently. + # If we find a dependency that needs to be downgraded to achieve + # the MSRV, we can do it here with `cargo update -p --precise ` - name: Check native shell: bash diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5c96fa331..4c14ea0b6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,7 +14,7 @@ on: merge_group: env: - # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. + # This is the MSRV used by all repository infrastructure. REPO_MSRV: "1.93" CARGO_INCREMENTAL: false diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 5c253f2bb..9fab5af87 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -18,8 +18,8 @@ env: # Dependency versioning # - # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. - REPO_MSRV: "1.93" + # This is the MSRV used by `wgpu` itself. + WGPU_MSRV: "1.87" RUSTFLAGS: -D warnings # Every time a PR is pushed to, cancel any previous jobs. This @@ -55,7 +55,7 @@ jobs: # the toolchain for the current directory, not the newly generated project. - name: Install repo MSRV toolchain run: | - rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal + rustup toolchain install ${{ env.WGPU_MSRV }} --no-self-update --profile=minimal cargo -V - name: Disable debug symbols @@ -90,4 +90,4 @@ jobs: [patch.crates-io] wgpu = { path = "../wgpu/wgpu" } EOF - cargo +${{ env.REPO_MSRV }} check + cargo +${{ env.WGPU_MSRV }} check diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a2461bb..a85c1b152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,12 @@ Bottom level categories: ## Unreleased +### Major Changes + +`wgpu` now has a new MSRV policy. This release has an MSRV of **1.87**. This is lower than v27's 1.88 and v28's 1.92. Going forward, we will only bump wgpu's MSRV if it has tangible benefits for the code, and we will never bump to an MSRV higher than `stable - 3`. So if stable is at 1.97 and 1.94 brought benefit to our code, we could bump it no higher than 1.94. As before, MSRV bumps will always be breaking changes. + +By @cwfitzgerald in [#8999](https://github.com/gfx-rs/wgpu/pull/8999). + ### New Features #### General diff --git a/README.md b/README.md index d6439b95f..f3ac44aac 100644 --- a/README.md +++ b/README.md @@ -96,25 +96,35 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict ## MSRV policy -TL;DR: If you're using `wgpu`, our MSRV is **1.93**. +TL;DR: If you're using `wgpu`, our MSRV is **1.87**. If you're running our tests or examples, our MSRV is **1.93**. + +We will avoid bumping the MSRV of `wgpu` without good reason, and such a change is considered breaking.
Specific Details -Due to complex dependants, we have two MSRV policies: +Due to complex dependants, we have three MSRV policies: -- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.90**. +- `wgpu`'s MSRV is **1.87** +- `wgpu-core` (and hence `wgpu-hal`, `naga`, and `wgpu-types`)'s MSRV is **1.87**. - The rest of the workspace has an MSRV of **1.93**. -It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables. +It is enforced on CI (in "/.github/workflows/ci.yml") with the `WGPU_MSRV`, `CORE_MSRV`, and `REPO_MSRV` variables, respectively. This version can only be upgraded in breaking releases, though we release a breaking version every three months. -The `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates should never -require an MSRV ahead of Firefox's MSRV for nightly builds, as -determined by the value of `MINIMUM_RUST_VERSION` in -[`python/mozboot/mozboot/util.py`][util]. +The following rules apply: +- The `wgpu-core` crate should never require an MSRV ahead of Firefox's MSRV for nightly builds, as +determined by the value of `MINIMUM_RUST_VERSION` in [`python/mozboot/mozboot/util.py`][moz-msrv]. +- The `wgpu` crate should never require an MSRV ahead of Servo's MSRV, as determined by the value of +their rust-version declaration in [`Cargo.toml`][servo-msrv] +- The repository MSRV should never require an MSRV higher than `stable - 3`. For example, if stable is +at 1.97, the repository MSRV should be no higher than 1.94. This is to allow people who are using a decently-updated +OS-provided rust to be able to build our repository. Consider cross checking with [NixOS][nixos-msrv], though this +is not required. -[util]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py +[moz-msrv]: https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py +[servo-msrv]: https://github.com/servo/servo/blob/main/Cargo.toml#L23 +[nixos-msrv]: https://search.nixos.org/packages?show=rustc
diff --git a/examples/standalone/01_hello_compute/Cargo.toml b/examples/standalone/01_hello_compute/Cargo.toml index ca323fa72..531cdee08 100644 --- a/examples/standalone/01_hello_compute/Cargo.toml +++ b/examples/standalone/01_hello_compute/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wgpu-example-01-hello-compute" edition = "2021" -rust-version = "1.93" +rust-version = "1.87" publish = false [dependencies] diff --git a/examples/standalone/02_hello_window/Cargo.toml b/examples/standalone/02_hello_window/Cargo.toml index 9f6483cbd..bcf0c67dd 100644 --- a/examples/standalone/02_hello_window/Cargo.toml +++ b/examples/standalone/02_hello_window/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wgpu-example-02-hello-window" edition = "2021" -rust-version = "1.93" +rust-version = "1.87" publish = false [dependencies] diff --git a/examples/standalone/custom_backend/Cargo.toml b/examples/standalone/custom_backend/Cargo.toml index 82607c475..b7354dd63 100644 --- a/examples/standalone/custom_backend/Cargo.toml +++ b/examples/standalone/custom_backend/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wgpu-example-custom-backend" edition = "2021" -rust-version = "1.93" +rust-version = "1.87" publish = false [features] diff --git a/naga/Cargo.toml b/naga/Cargo.toml index d6114245d..d3f592284 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -13,7 +13,7 @@ exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"] # copy the crates it actually uses out of the workspace, so it's meaningful for # them to have less restrictive MSRVs individually than the workspace as a # whole, if their code permits. See `../README.md` for details. -rust-version = "1.90.0" +rust-version = "1.87" [package.metadata.docs.rs] all-features = true diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 027725ef0..0bfcff6ee 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -9,11 +9,11 @@ repository.workspace = true keywords.workspace = true license.workspace = true -# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to -# copy the crates it actually uses out of the workspace, so it's meaningful for -# them to have less restrictive MSRVs individually than the workspace as a -# whole, if their code permits. See `../README.md` for details. -rust-version = "1.90.0" +# Override the workspace's `rust-version` key. `wgpu-core` and its dependencies +# have a less strict MSRV, to allow firefox more leeway in updating their Rust toolchain. +# +# See the repo README for more information on MSRV policy. +rust-version = "1.87" [package.metadata.docs.rs] all-features = true diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 8f2fa873a..8c1800840 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -9,11 +9,11 @@ repository.workspace = true keywords.workspace = true license.workspace = true -# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to -# copy the crates it actually uses out of the workspace, so it's meaningful for -# them to have less restrictive MSRVs individually than the workspace as a -# whole, if their code permits. See `../README.md` for details. -rust-version = "1.90.0" +# Override the workspace's `rust-version` key. `wgpu-core` and its dependencies +# have a less strict MSRV, to allow firefox more leeway in updating their Rust toolchain. +# +# See the repo README for more information on MSRV policy. +rust-version = "1.87" [package.metadata.docs.rs] # Ideally we would enable all the features. diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index 2ed4caaf1..5bd095e1a 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -9,11 +9,11 @@ repository.workspace = true keywords.workspace = true license.workspace = true -# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to -# copy the crates it actually uses out of the workspace, so it's meaningful for -# them to have less restrictive MSRVs individually than the workspace as a -# whole, if their code permits. See `../README.md` for details. -rust-version = "1.90.0" +# Override the workspace's `rust-version` key. `wgpu-core` and its dependencies +# have a less strict MSRV, to allow firefox more leeway in updating their Rust toolchain. +# +# See the repo README for more information on MSRV policy. +rust-version = "1.87" [package.metadata.docs.rs] all-features = true diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 5f07c26b1..35d827254 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -8,10 +8,15 @@ homepage.workspace = true repository.workspace = true keywords.workspace = true license.workspace = true -rust-version.workspace = true readme = "../README.md" exclude = ["Cargo.lock"] +# Override the workspace's `rust-version` key. `wgpu` and its dependencies +# have a less strict MSRV, to allow users more leeway in updating their Rust toolchain. +# +# See the repo README for more information on MSRV policy. +rust-version = "1.87.0" + [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 7f8dad864..8e8005abf 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -28,7 +28,7 @@ //! | --------------------- | ---------------------- | //! | ![render_coordinates] | ![texture_coordinates] | //! -//! `wgpu`'s MSRV is **1.93**. +//! `wgpu`'s MSRV is **1.87**. //! //! [Learn Wgpu]: https://sotrh.github.io/learn-wgpu/ //! [WebGPU Fundamentals]: https://webgpufundamentals.org/