Fix Send/Sync of RequestDeviceErrorKind (#7122)

This commit is contained in:
Connor Fitzgerald authored and GitHub committed 2025-02-13 08:46:50 -05:00
1 parent c4b25b8794
commit c39d37fc36
2 files changed
+5 -11

No files matched your search

+3 -10
View File
@@ -530,15 +530,9 @@ pub(crate) enum RequestDeviceErrorKind {
///
/// (This is currently never used by the webgl backend, but it could be.)
#[cfg(webgpu)]
WebGpu(wasm_bindgen::JsValue),
WebGpu(String),
}
#[cfg(send_sync)]
unsafe impl Send for RequestDeviceErrorKind {}
#[cfg(send_sync)]
unsafe impl Sync for RequestDeviceErrorKind {}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(RequestDeviceError: Send, Sync);
impl fmt::Display for RequestDeviceError {
@@ -547,9 +541,8 @@ impl fmt::Display for RequestDeviceError {
#[cfg(wgpu_core)]
RequestDeviceErrorKind::Core(error) => error.fmt(_f),
#[cfg(webgpu)]
RequestDeviceErrorKind::WebGpu(error_js_value) => {
// wasm-bindgen provides a reasonable error stringification via `Debug` impl
write!(_f, "{error_js_value:?}")
RequestDeviceErrorKind::WebGpu(error) => {
write!(_f, "{error}")
}
#[cfg(not(any(webgpu, wgpu_core)))]
_ => unimplemented!("unknown `RequestDeviceErrorKind`"),
+2 -1
View File
@@ -927,7 +927,8 @@ fn future_request_device(
)
})
.map_err(|error_value| crate::RequestDeviceError {
inner: crate::RequestDeviceErrorKind::WebGpu(error_value),
// wasm-bindgen provides a reasonable error stringification via `Debug` impl
inner: crate::RequestDeviceErrorKind::WebGpu(format!("{error_value:?}")),
})
}