-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: allow dynamic owned resources to be used as borrowed parameters #7783
fix: allow dynamic owned resources to be used as borrowed parameters #7783
Conversation
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me, thanks! Mind adding a test as well for this?
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
e2d05de
to
f38af4c
Compare
Added a test case, but also uncovered a bug while doing that #7793 Honestly, I'm not sure what's the use case for using the resource borrows pointing to non-existent resources and it appears to me that neither of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test! I believe that issue is orthogonal to this, so I'm going to mark this for merge while that other issue is sorted out.
…ytecodealliance#7783) * fix: allow dynamic owned resources to be used as borrowed parameters Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * tests: add `can_use_own_for_borrow` test Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> (cherry picked from commit 2c86e26)
This enables using owned resources in places where borrowed resources of the same type are expected (e.g. dynamically-typed functions/methods defined in
Linker::func_new
)Note, that this is already possible in e.g.
wasmtime/crates/wasmtime/src/component/resources.rs
Lines 340 to 352 in 4b2425d
cc @alexcrichton , we discussed this on a call, I believe this is the changeset we agreed upon