Skip to content

Fix generated bindings for list-of-borrows #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

alexcrichton
Copy link
Member

This commit fixes an issue for imported functions taking list<borrow<T>> arguments. Previously they were erroneously passed through as lists-of-pointers and now they're correctly mapped to list-of-handle-indexes in the ABI. This required rejiggering a bit how types are generated and what's considered owned when, namely requiring that all own handles use Vec<T> at the boundary since they need to take ownership.

This commit fixes an issue for imported functions taking
`list<borrow<T>>` arguments. Previously they were erroneously passed
through as lists-of-pointers and now they're correctly mapped to
list-of-handle-indexes in the ABI. This required rejiggering a bit how
types are generated and what's considered owned when, namely requiring
that all own handles use `Vec<T>` at the boundary since they need to
take ownership.
@alexcrichton
Copy link
Member Author

I'll note that testing-wise the existing codegen tests cover a good deal, and otherwise tests for resources are not present at the moment as this requires wasmtime support which is still nascent.

@sunfishcode
Copy link
Member

I tested this by copying the bindings generated with this patch into bytecodealliance/wasmtime#7029 and it fixes the bug I was seeing.

@sunfishcode sunfishcode merged commit 0b19bc3 into bytecodealliance:main Sep 18, 2023
sunfishcode added a commit to sunfishcode/wit-abi-up-to-date that referenced this pull request Sep 29, 2023
In particular, this has bytecodealliance/wit-bindgen#670, which fixes a
bug hit by `poll-list`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants