Skip to content

Commit

Permalink
ensure that wgpu::Error is Sync (#5820)
Browse files Browse the repository at this point in the history
* ensure that `wgpu::Error` is `Sync`

This makes it possible to wrap the error in `anyhow::Error` and
`eyre::Report`, which require the inner error to be `Sync`.

* update changelog
  • Loading branch information
nolanderc authored Jun 16, 2024
1 parent e78c33b commit fe31966
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ By @atlv24 in [#5383](https://github.com/gfx-rs/wgpu/pull/5383)
#### General

- Avoid introducing spurious features for optional dependencies. By @bjorn3 in [#5691](https://github.com/gfx-rs/wgpu/pull/5691)
- `wgpu::Error` is now `Sync`, making it possible to be wrapped in `anyhow::Error` or `eyre::Report`. By @nolanderc in [#5820](https://github.com/gfx-rs/wgpu/pull/5820)

#### Metal
- Removed the `link` Cargo feature.
Expand Down
8 changes: 4 additions & 4 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5873,7 +5873,7 @@ pub enum Error {
/// Lower level source of the error.
#[cfg(send_sync)]
#[cfg_attr(docsrs, doc(cfg(all())))]
source: Box<dyn error::Error + Send + 'static>,
source: Box<dyn error::Error + Send + Sync + 'static>,
/// Lower level source of the error.
#[cfg(not(send_sync))]
#[cfg_attr(docsrs, doc(cfg(all())))]
Expand All @@ -5884,7 +5884,7 @@ pub enum Error {
/// Lower level source of the error.
#[cfg(send_sync)]
#[cfg_attr(docsrs, doc(cfg(all())))]
source: Box<dyn error::Error + Send + 'static>,
source: Box<dyn error::Error + Send + Sync + 'static>,
/// Lower level source of the error.
#[cfg(not(send_sync))]
#[cfg_attr(docsrs, doc(cfg(all())))]
Expand All @@ -5899,7 +5899,7 @@ pub enum Error {
/// Lower level source of the error.
#[cfg(send_sync)]
#[cfg_attr(docsrs, doc(cfg(all())))]
source: Box<dyn error::Error + Send + 'static>,
source: Box<dyn error::Error + Send + Sync + 'static>,
/// Lower level source of the error.
#[cfg(not(send_sync))]
#[cfg_attr(docsrs, doc(cfg(all())))]
Expand All @@ -5909,7 +5909,7 @@ pub enum Error {
},
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(Error: Send);
static_assertions::assert_impl_all!(Error: Send, Sync);

impl error::Error for Error {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
Expand Down

0 comments on commit fe31966

Please sign in to comment.