Skip to content

Commit 2e8a600

Browse files
kpreidcwfitzgerald
authored andcommitted
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.
1 parent 486c151 commit 2e8a600

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ By @Vecvec in [#7913](https://github.com/gfx-rs/wgpu/pull/7913).
7272
- Copies of depth/stencil formats must be 4B aligned.
7373
- 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).
7474
- 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).
75+
- The function you pass to `Device::on_uncaptured_error()` must now implement `Sync` in addition to `Send`.
76+
By @kpreid in [#8011](https://github.com/gfx-rs/wgpu/pull/8011).
7577

7678
#### Naga
7779

wgpu/src/api/device.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,11 @@ impl From<wgc::instance::RequestDeviceError> for RequestDeviceError {
714714
}
715715
}
716716

717-
/// Type for the callback of uncaptured error handler
718-
pub trait UncapturedErrorHandler: Fn(Error) + Send + 'static {}
719-
impl<T> UncapturedErrorHandler for T where T: Fn(Error) + Send + 'static {}
717+
/// The callback of [`Device::on_uncaptured_error()`].
718+
///
719+
/// It must be a function with this signature.
720+
pub trait UncapturedErrorHandler: Fn(Error) + Send + Sync + 'static {}
721+
impl<T> UncapturedErrorHandler for T where T: Fn(Error) + Send + Sync + 'static {}
720722

721723
/// Kinds of [`Error`]s a [`Device::push_error_scope()`] may be configured to catch.
722724
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)]

0 commit comments

Comments
 (0)