Clarify cfg(send_sync) gating in this backend/webgpu comment. (#6274)

Addresses the confusion in #6267.
This commit is contained in:
Ben Reeves 2024-09-14 23:44:17 -05:00 committed by GitHub
parent eb18854b46
commit a21c0e2696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,9 +26,10 @@ use crate::{
// implement `Send` and `Sync` to match native. // implement `Send` and `Sync` to match native.
// //
// SAFETY: All webgpu handle types in wasm32 are internally a `JsValue`, and `JsValue` is neither // SAFETY: All webgpu handle types in wasm32 are internally a `JsValue`, and `JsValue` is neither
// Send nor Sync. Currently, wasm32 has no threading support so implementing `Send` or `Sync` for a // Send nor Sync. Currently, wasm32 has no threading support by default, so implementing `Send` or
// type is (for now) harmless. Eventually wasm32 will support threading, and depending on how this // `Sync` for a type is harmless. However, nightly Rust supports compiling wasm with experimental
// is integrated (or not integrated) with values like those in webgpu, this may become unsound. // threading support via `--target-features`. If `wgpu` is being compiled with those features, we do
// not implement `Send` and `Sync` on the webgpu handle types.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct Sendable<T>(T); pub(crate) struct Sendable<T>(T);