Add Sync bound to uncaptured error handler.

It makes sense for a function to be `FnMut + Send`, or `Fn + Send + Sync`,
but not `Fn + Send` because that is overly restrictive for the caller and
the callee.
This commit is contained in:
Kevin Reid 2025-07-26 08:50:58 -07:00 committed by Connor Fitzgerald
parent 486c151772
commit 2e8a600e35
2 changed files with 7 additions and 3 deletions

View File

@ -72,6 +72,8 @@ By @Vecvec in [#7913](https://github.com/gfx-rs/wgpu/pull/7913).
- Copies of depth/stencil formats must be 4B aligned.
- The offset for `set_vertex_buffer` and `set_index_buffer` must be 4B aligned. By @andyleiserson in [#7929](https://github.com/gfx-rs/wgpu/pull/7929).
- The offset and size of bindings are validated as fitting within the underlying buffer in more cases. By @andyleiserson in [#7911](https://github.com/gfx-rs/wgpu/pull/7911).
- The function you pass to `Device::on_uncaptured_error()` must now implement `Sync` in addition to `Send`.
By @kpreid in [#8011](https://github.com/gfx-rs/wgpu/pull/8011).
#### Naga

View File

@ -714,9 +714,11 @@ impl From<wgc::instance::RequestDeviceError> for RequestDeviceError {
}
}
/// Type for the callback of uncaptured error handler
pub trait UncapturedErrorHandler: Fn(Error) + Send + 'static {}
impl<T> UncapturedErrorHandler for T where T: Fn(Error) + Send + 'static {}
/// The callback of [`Device::on_uncaptured_error()`].
///
/// It must be a function with this signature.
pub trait UncapturedErrorHandler: Fn(Error) + Send + Sync + 'static {}
impl<T> UncapturedErrorHandler for T where T: Fn(Error) + Send + Sync + 'static {}
/// Kinds of [`Error`]s a [`Device::push_error_scope()`] may be configured to catch.
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)]