You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, WasmNode expects to take ownership over the config when it's passed from JS. Nothing stops JS from still holding the config reference it has though, which causes an exception on access.
does the same hold for JsValue or is it relevant for to types?
Make sure we're taking parameters from JS safely, potentially cloning or taking by reference instead
The text was updated successfully, but these errors were encountered:
Another observation: &mut borrows can also be problematic, as they can allow concurrent rw borrows from js, and these can only be checked at runtime.
Consider the example
structFoo;implFoo{asyncfnwait(&mutself){// do some computation}}
letfoo=newFoo();foo.wait();foo.wait();
Since second wait call will usually happen before the first promise is resolved, Foo is still mutably borrowed there. This results in runtime error from bindgen:
Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
This case is most easily tiggered with async fn which borrows &mut (as in example), but generally can happen anywhere where looser js rules violate Rust's single mutable borrow rule.
Currently,
WasmNode
expects to take ownership over the config when it's passed from JS. Nothing stops JS from still holding the config reference it has though, which causes an exception on access.JsValue
or is it relevant for to types?The text was updated successfully, but these errors were encountered: