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
The following WIT file, implemented as an export in Wasmtime, results in a compilation error:
--> src/lib.rs:1:1
|
1 | wit_bindgen_wasmtime::export!("test.wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoFunc<T, _, _>` is not implemented for `[closure@src/lib.rs:1:1: 1:43]`
The peculiar aspect of this is that commenting out various fields seems to bypass the issue:
record param1 {
a:list<u8>,
b:list<u8>,// commenting one list field also makes this compile
c:list<u8>,}
record param2 {
g:bool,
h:bool,// commenting the following field makes this compile
i:bool,
j:param1,}
record ret {
d:list<u8>,
e:list<u8>,
f:list<u8>,}enum error {
fatal
}
testfunc:function(p1: param1, p2: option<param2>)-> expected<ret, error>
I think that the reason this is happening is that this is hitting the limit of the number of arguments for functions in Wasmtime. The IntoFunc trait is implemented for up to 16-argument functions, and this looks like it's trying to generate a function that has more than 16 arguments.
One thing we could consider is to place a limit on the maximum number of arguments for canonical abi functions to solve this, but then there's the other detail of finding space in linear memory to insert all the other arguments which can be tricky. Overall I don't think that there's a great solution for this right now, and it may mean that the current canonical ABI lowering needs to be improved.
radu-matei
changed the title
Various combinations of fundamental values and lists result in IntoFunc not implemented for Wasmtime
Canonical ABI functions with over 16 parameters result in IntoFunc not implemented for Wasmtime
Jan 24, 2022
The following WIT file, implemented as an export in Wasmtime, results in a compilation error:
The peculiar aspect of this is that commenting out various fields seems to bypass the issue:
The Rust implementation:
Here is the repository with the repro — https://github.com/radu-matei/wit-bindgen-wasmtime-intofunc-repro
Thanks to @flavio for initially raising this in fermyon/wasi-experimental-toolkit#9
The text was updated successfully, but these errors were encountered: