Reduce repo MSRV from 1.85 to 1.84 (#7425)

* Reduce repo MSRV from 1.85 to 1.84

Fixes https://github.com/gfx-rs/wgpu/issues/7409

* Replace usage of task::Waker::noop()

* Gate waker code to `noop` feature

* Remove unused copied waker function

* Remove doctest from copied code
This commit is contained in:
Christian Legnitto 2025-03-27 14:25:19 -04:00 committed by GitHub
parent 5a583b1fb7
commit 1ef9940114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 45 additions and 12 deletions

View File

@ -36,7 +36,7 @@ env:
CI_BINARY_BUILD: "build20"
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.85"
REPO_MSRV: "1.84"
# 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.82.0"

View File

@ -10,7 +10,7 @@ on:
env:
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.85"
REPO_MSRV: "1.84"
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always

View File

@ -13,7 +13,7 @@ env:
#
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.85"
REPO_MSRV: "1.84"
RUSTFLAGS: -D warnings
jobs:

View File

@ -50,7 +50,7 @@ ref_as_ptr = "warn"
[workspace.package]
edition = "2021"
rust-version = "1.85"
rust-version = "1.84"
keywords = ["graphics"]
license = "MIT OR Apache-2.0"
homepage = "https://wgpu.rs/"

View File

@ -149,7 +149,7 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
Due to complex dependants, we have two MSRV policies:
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.76**.
- The rest of the workspace has an MSRV of **1.85**.
- The rest of the workspace has an MSRV of **1.84**.
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
This version can only be upgraded in breaking releases, though we release a breaking version every three months.

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-01-hello-compute"
edition = "2021"
rust-version = "1.85"
rust-version = "1.84"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-02-hello-window"
edition = "2021"
rust-version = "1.85"
rust-version = "1.84"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-custom-backend"
edition = "2021"
rust-version = "1.85"
rust-version = "1.84"
publish = false
[dependencies]

View File

@ -3,7 +3,7 @@ name = "xtask"
version = "0.1.0"
edition = "2021"
publish = false
rust-version = "1.85"
rust-version = "1.84"
[dependencies]
anyhow = "1"

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.85"
channel = "1.84"
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]

View File

@ -51,7 +51,7 @@ impl Device {
use core::future::Future as _;
use core::pin::pin;
use core::task;
let ctx = &mut task::Context::from_waker(task::Waker::noop());
let ctx = &mut task::Context::from_waker(waker::noop_waker_ref());
let instance = Instance::new(&InstanceDescriptor {
backends: Backends::NOOP,
@ -695,3 +695,36 @@ impl fmt::Display for Error {
}
}
}
// Copied from [`futures::task::noop_waker`].
// Needed until MSRV is 1.85 with `task::Waker::noop()` available
#[cfg(feature = "noop")]
mod waker {
use core::ptr::null;
use core::task::{RawWaker, RawWakerVTable, Waker};
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
noop_raw_waker()
}
unsafe fn noop(_data: *const ()) {}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
const fn noop_raw_waker() -> RawWaker {
RawWaker::new(null(), &NOOP_WAKER_VTABLE)
}
/// Get a static reference to a [`Waker`] which
/// does nothing when `wake()` is called on it.
#[inline]
pub fn noop_waker_ref() -> &'static Waker {
struct SyncRawWaker(RawWaker);
unsafe impl Sync for SyncRawWaker {}
static NOOP_WAKER_INSTANCE: SyncRawWaker = SyncRawWaker(noop_raw_waker());
// SAFETY: `Waker` is #[repr(transparent)] over its `RawWaker`.
unsafe { &*(&NOOP_WAKER_INSTANCE.0 as *const RawWaker as *const Waker) }
}
}

View File

@ -2,7 +2,7 @@
name = "xtask"
version = "0.1.0"
edition = "2021"
rust-version = "1.85"
rust-version = "1.84"
publish = false
[lints.rust]