gfx-rs / wgpu-native

Native WebGPU implementation based on wgpu-core
Apache License 2.0
850 stars 98 forks source link

`Arc` and not `Send` / `Sync` #344

Closed waywardmonkeys closed 7 months ago

waywardmonkeys commented 8 months ago

Clippy reports 4 instances of this:

warning: usage of an `Arc` that is not `Send` and `Sync`
    --> src/lib.rs:2738:37
     |
2738 |               temp[i] = Arc::into_raw(Arc::new(WGPUAdapterImpl {
     |  _____________________________________^
2739 | |                 context: context.clone(),
2740 | |                 id: *id,
2741 | |                 properties: OnceCell::default(),
2742 | |             }));
     | |______________^
     |
     = note: `Arc<WGPUAdapterImpl>` is not `Send` and `Sync` as:
     = note: - the trait `Sync` is not implemented for `WGPUAdapterImpl`
     = help: consider using an `Rc` instead. `Arc` does not provide benefits for non `Send` and `Sync` types
     = note: if you intend to use `Arc` with `Send` and `Sync` traits
     = note: wrap the inner type with a `Mutex` or implement `Send` and `Sync` for `WGPUAdapterImpl`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync

The other types are: WGPUBufferImpl and WGPURenderBundleEncoderImpl.

Not sure what the right fix for this in context, but if there's a good suggestion, I'm happy to submit a PR for it.