Skip to content

Commit 1ef9940

Browse files
authored
Reduce repo MSRV from 1.85 to 1.84 (#7425)
* Reduce repo MSRV from 1.85 to 1.84 Fixes #7409 * Replace usage of task::Waker::noop() * Gate waker code to `noop` feature * Remove unused copied waker function * Remove doctest from copied code
1 parent 5a583b1 commit 1ef9940

File tree

12 files changed

+45
-12
lines changed

12 files changed

+45
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ env:
3636
CI_BINARY_BUILD: "build20"
3737

3838
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
39-
REPO_MSRV: "1.85"
39+
REPO_MSRV: "1.84"
4040
# This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates,
4141
# to ensure that they can be used with firefox.
4242
CORE_MSRV: "1.82.0"

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
env:
1212
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
13-
REPO_MSRV: "1.85"
13+
REPO_MSRV: "1.84"
1414

1515
CARGO_INCREMENTAL: false
1616
CARGO_TERM_COLOR: always

.github/workflows/generate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
#
1414

1515
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
16-
REPO_MSRV: "1.85"
16+
REPO_MSRV: "1.84"
1717
RUSTFLAGS: -D warnings
1818

1919
jobs:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ref_as_ptr = "warn"
5050

5151
[workspace.package]
5252
edition = "2021"
53-
rust-version = "1.85"
53+
rust-version = "1.84"
5454
keywords = ["graphics"]
5555
license = "MIT OR Apache-2.0"
5656
homepage = "https://wgpu.rs/"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
149149
Due to complex dependants, we have two MSRV policies:
150150

151151
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.76**.
152-
- The rest of the workspace has an MSRV of **1.85**.
152+
- The rest of the workspace has an MSRV of **1.84**.
153153

154154
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
155155
This version can only be upgraded in breaking releases, though we release a breaking version every three months.

examples/standalone/01_hello_compute/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-01-hello-compute"
33
edition = "2021"
4-
rust-version = "1.85"
4+
rust-version = "1.84"
55
publish = false
66

77
[dependencies]

examples/standalone/02_hello_window/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-02-hello-window"
33
edition = "2021"
4-
rust-version = "1.85"
4+
rust-version = "1.84"
55
publish = false
66

77
[dependencies]

examples/standalone/custom_backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wgpu-example-custom-backend"
33
edition = "2021"
4-
rust-version = "1.85"
4+
rust-version = "1.84"
55
publish = false
66

77
[dependencies]

naga/xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "xtask"
33
version = "0.1.0"
44
edition = "2021"
55
publish = false
6-
rust-version = "1.85"
6+
rust-version = "1.84"
77

88
[dependencies]
99
anyhow = "1"

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.85"
2+
channel = "1.84"
33
components = ["rustfmt", "clippy"]
44
targets = ["wasm32-unknown-unknown"]

wgpu/src/api/device.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl Device {
5151
use core::future::Future as _;
5252
use core::pin::pin;
5353
use core::task;
54-
let ctx = &mut task::Context::from_waker(task::Waker::noop());
54+
let ctx = &mut task::Context::from_waker(waker::noop_waker_ref());
5555

5656
let instance = Instance::new(&InstanceDescriptor {
5757
backends: Backends::NOOP,
@@ -695,3 +695,36 @@ impl fmt::Display for Error {
695695
}
696696
}
697697
}
698+
699+
// Copied from [`futures::task::noop_waker`].
700+
// Needed until MSRV is 1.85 with `task::Waker::noop()` available
701+
#[cfg(feature = "noop")]
702+
mod waker {
703+
use core::ptr::null;
704+
use core::task::{RawWaker, RawWakerVTable, Waker};
705+
706+
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
707+
noop_raw_waker()
708+
}
709+
710+
unsafe fn noop(_data: *const ()) {}
711+
712+
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
713+
714+
const fn noop_raw_waker() -> RawWaker {
715+
RawWaker::new(null(), &NOOP_WAKER_VTABLE)
716+
}
717+
718+
/// Get a static reference to a [`Waker`] which
719+
/// does nothing when `wake()` is called on it.
720+
#[inline]
721+
pub fn noop_waker_ref() -> &'static Waker {
722+
struct SyncRawWaker(RawWaker);
723+
unsafe impl Sync for SyncRawWaker {}
724+
725+
static NOOP_WAKER_INSTANCE: SyncRawWaker = SyncRawWaker(noop_raw_waker());
726+
727+
// SAFETY: `Waker` is #[repr(transparent)] over its `RawWaker`.
728+
unsafe { &*(&NOOP_WAKER_INSTANCE.0 as *const RawWaker as *const Waker) }
729+
}
730+
}

xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "xtask"
33
version = "0.1.0"
44
edition = "2021"
5-
rust-version = "1.85"
5+
rust-version = "1.84"
66
publish = false
77

88
[lints.rust]

0 commit comments

Comments
 (0)