mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
Prefer Arc::into_inner
over Arc::try_unwrap
. (#5018)
This commit is contained in:
parent
a24bdbaa25
commit
8af6975d5e
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -43,7 +43,7 @@ env:
|
||||
REPO_MSRV: "1.71"
|
||||
# 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.65"
|
||||
CORE_MSRV: "1.70"
|
||||
|
||||
#
|
||||
# Environment variables
|
||||
|
@ -119,7 +119,7 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
|
||||
### MSRV policy
|
||||
|
||||
Due to complex dependants, we have two MSRV policies:
|
||||
- `d3d12`, `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**.
|
||||
- `d3d12`, `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.70**.
|
||||
- The rest of the workspace has an MSRV of **1.71**.
|
||||
|
||||
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
|
||||
|
@ -9,7 +9,7 @@ keywords = ["shader", "SPIR-V", "GLSL", "MSL"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"]
|
||||
resolver = "2"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.70"
|
||||
autotests = false
|
||||
|
||||
[[test]]
|
||||
|
@ -4,7 +4,7 @@
|
||||
[![Crates.io](https://img.shields.io/crates/v/naga.svg?label=naga)](https://crates.io/crates/naga)
|
||||
[![Docs.rs](https://docs.rs/naga/badge.svg)](https://docs.rs/naga)
|
||||
[![Build Status](https://github.com/gfx-rs/naga/workflows/pipeline/badge.svg)](https://github.com/gfx-rs/naga/actions)
|
||||
![MSRV](https://img.shields.io/badge/rustc-1.65+-blue.svg)
|
||||
![MSRV](https://img.shields.io/badge/rustc-1.70+-blue.svg)
|
||||
[![codecov.io](https://codecov.io/gh/gfx-rs/naga/branch/master/graph/badge.svg?token=9VOKYO8BM2)](https://codecov.io/gh/gfx-rs/naga)
|
||||
|
||||
The shader translation library for the needs of [wgpu](https://github.com/gfx-rs/wgpu).
|
||||
|
@ -5,6 +5,6 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "1.71" # Needed for deno & cts_runner. Firefox's MSRV is 1.65
|
||||
channel = "1.71" # Needed for deno & cts_runner. Firefox's MSRV is 1.70
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = ["wasm32-unknown-unknown"]
|
||||
|
@ -77,7 +77,7 @@ static QUEUE_SUBMITTED_CALLBACK_ORDERING: GpuTestConfiguration = GpuTestConfigur
|
||||
ctx.device.poll(MaintainBase::Poll);
|
||||
|
||||
// Extract the ordering out of the arc.
|
||||
let ordering = Arc::try_unwrap(ordering).unwrap().into_inner();
|
||||
let ordering = Arc::into_inner(ordering).unwrap().into_inner();
|
||||
|
||||
// There were two callbacks invoked
|
||||
assert_eq!(ordering.counter, 2);
|
||||
|
@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
|
||||
# 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.65"
|
||||
rust-version = "1.70"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
@ -288,7 +288,7 @@ impl<A: HalApi> CommandBuffer<A> {
|
||||
}
|
||||
|
||||
pub(crate) fn from_arc_into_baked(self: Arc<Self>) -> BakedCommands<A> {
|
||||
if let Ok(mut command_buffer) = Arc::try_unwrap(self) {
|
||||
if let Some(mut command_buffer) = Arc::into_inner(self) {
|
||||
command_buffer.extract_baked_commands()
|
||||
} else {
|
||||
panic!("CommandBuffer cannot be destroyed because is still in use");
|
||||
|
@ -1185,7 +1185,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
));
|
||||
}
|
||||
if !cmdbuf.is_finished() {
|
||||
if let Ok(cmdbuf) = Arc::try_unwrap(cmdbuf) {
|
||||
if let Some(cmdbuf) = Arc::into_inner(cmdbuf) {
|
||||
device.destroy_command_buffer(cmdbuf);
|
||||
} else {
|
||||
panic!(
|
||||
|
@ -165,7 +165,7 @@ impl<G: GlobalIdentityHandlerFactory> Drop for Global<G> {
|
||||
// destroy surfaces
|
||||
for element in surfaces_locked.map.drain(..) {
|
||||
if let Element::Occupied(arc_surface, _) = element {
|
||||
if let Ok(surface) = Arc::try_unwrap(arc_surface) {
|
||||
if let Some(surface) = Arc::into_inner(arc_surface) {
|
||||
self.instance.destroy_surface(surface);
|
||||
} else {
|
||||
panic!("Surface cannot be destroyed because is still in use");
|
||||
|
@ -121,8 +121,8 @@ impl Instance {
|
||||
fn destroy<A: HalApi>(_: A, instance: &Option<A::Instance>, surface: AnySurface) {
|
||||
unsafe {
|
||||
if let Some(surface) = surface.take::<A>() {
|
||||
if let Ok(suf) = Arc::try_unwrap(surface) {
|
||||
if let Ok(raw) = Arc::try_unwrap(suf.raw) {
|
||||
if let Some(suf) = Arc::into_inner(surface) {
|
||||
if let Some(raw) = Arc::into_inner(suf.raw) {
|
||||
instance.as_ref().unwrap().destroy_surface(raw);
|
||||
} else {
|
||||
panic!("Surface cannot be destroyed because is still in use");
|
||||
@ -766,7 +766,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
}
|
||||
|
||||
let surface = self.surfaces.unregister(id);
|
||||
if let Ok(surface) = Arc::try_unwrap(surface.unwrap()) {
|
||||
if let Some(surface) = Arc::into_inner(surface.unwrap()) {
|
||||
if let Some(present) = surface.presentation.lock().take() {
|
||||
#[cfg(all(feature = "vulkan", not(target_arch = "wasm32")))]
|
||||
unconfigure::<_, hal::api::Vulkan>(self, &surface.raw, &present);
|
||||
|
@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
|
||||
# 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.65"
|
||||
rust-version = "1.70"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
# Ideally we would enable all the features.
|
||||
|
@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
|
||||
# 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.65"
|
||||
rust-version = "1.70"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
Loading…
Reference in New Issue
Block a user