mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-30 13:11:33 +00:00
Ensure that JsValue
isn't considered Send
The `JsValue` type wraps a slab/heap of js objects which is managed by the wasm-bindgen shim, and everything here is not actually able to cross any thread boundaries. When wasm actually has threads, for example, each thread will have to have its own slab of objects generated by wasm-bindgen, and indices in one slab aren't valid in any other slabs. This is technically a breaking change because `JsValue` was previously `Send` and `Sync`, but I'm hoping that in practice this isn't actually a breaking change because nothing in wasm can be using threads which in theory shouldn't activate the `Send` and/or `Sync` bounds.
This commit is contained in:
@ -337,7 +337,7 @@ impl FromWasmAbi for JsValue {
|
||||
|
||||
#[inline]
|
||||
unsafe fn from_abi(js: u32, _extra: &mut Stack) -> JsValue {
|
||||
JsValue { idx: js }
|
||||
JsValue::_new(js)
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ impl RefFromWasmAbi for JsValue {
|
||||
|
||||
#[inline]
|
||||
unsafe fn ref_from_abi(js: u32, _extra: &mut Stack) -> Self::Anchor {
|
||||
ManuallyDrop::new(JsValue { idx: js })
|
||||
ManuallyDrop::new(JsValue::_new(js))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user