-
Notifications
You must be signed in to change notification settings - Fork 939
Description
Describe the bug
Using the latest published version of wai-bindgen-wasmer which is 0.4.0, doesn't work correctly. Trying to pass a list of structs is a compile error.
Steps to reproduce
Clone this repo at the list-of-structs-is-compile-error tag for a reproducible example. Run cargo run in the with-wai-sys folder to see the compile error.
In the example, this wai file is used:
pass-color-list: func(colors: list<color>) -> list<color>
record color {
r: float32,
b: float32,
g: float32,
}
And imported with:
wai_bindgen_wasmer::export!("../protocol-host.wai");Expected behavior
Bindings should generate correctly without an error.
Actual behavior
There is a compile error in the generated bindings: cannot borrow store as mutable because it is also borrowed as immutable
Additional context
Older version of wai-bindgen-wasmer worked correctly, but it used wasmer 3.1. The new version of wai-bindgen-wasmer is using wasmer 3.3, but is not migrated properly. There was a breaking change from wasmer 3.1 to 3.3:
Also, going from wasmer 3.1 to 3.3 is a breaking change. In 3.1, MemoryView::new (link):
impl<'a> MemoryView<'a> {
pub(crate) fn new(memory: &'a Memory, store: &impl AsStoreRef) -> Self { ... }But in 3.3 (link):
impl<'a> MemoryView<'a> {
pub(crate) fn new(memory: &Memory, store: &'a impl AsStoreRef) -> Self {