Skip to content

Bound of UncapturedErrorHandler is more restrictive than it should be #5395

@kpreid

Description

@kpreid

The definition of UncapturedErrorHandler, the callback given to Device::on_uncaptured_error(), is an alias for

Fn(Error) + Send + 'static

The combination of Fn, Send, and no Sync is weird. I believe that it should be replaced with either:

Fn(Error) + Send + Sync + 'static

implying that the callback could be called simultaneously from multiple threads, where it currently cannot*, or

FnMut(Error) + Send + 'static

allowing the callback to take advantage of not being called simultaneously. This is not a soundness issue, just an unnecessary empty space in between what is permitted for wgpu and what is permitted for its callers.


* Say, what happens if the uncaptured error handler itself performs a wgpu operation that errors? Deadlock? Possibly the error handler ought to be in an Arc so it can be called outside the lock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions