abrown opened PR #5428 from wiggle-mutability
to main
:
Previously, all Wiggle-generated traits were generated with
&mut self
signatures. With the addition of themutable
configuration option tofrom_witx!
andwasmtime_integration!
, one can disable this, emitting instead traits that use&self
(i.e.,mutable: false
). This change is helpful for implementing wasi-threads: WASI implementations with interior mutability will now be able to communitcate this to their Wiggle-generated code.The other side of this change is the
get_cx
closure passed to Wiggle's generatedadd_to_linker
function. Whenmutability
is set totrue
(default), theget_cx
function takes a&mut
data structure from the store and returns a corresponding&mut
reference, usually to a field of the passed-in structure. Whenmutability: false
, theget_cx
closure will still take a&mut
data structure but now will return a&
reference.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
abrown has marked PR #5428 as ready for review.
abrown requested alexcrichton for a review on PR #5428.
alexcrichton submitted PR review.
abrown updated PR #5428 from wiggle-mutability
to main
.
abrown merged PR #5428.
Last updated: Dec 23 2024 at 13:07 UTC