-
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
Configure WIT feature gates at runtime & implement wasi-cli exit-with-code
#9381
Configure WIT feature gates at runtime & implement wasi-cli exit-with-code
#9381
Conversation
…mit all unstable members. These features will be gated at runtime.
…ns in for worlds/interfaces that use any unstable feature.
4fcfe6f
to
050d5f7
Compare
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.
This looks great to me, thanks for this!
In retrospect though given the large number of changes related to add_to_linker
what do you think about:
- Interface/world-level
add_to_linker
retains theLinkOptions
parameter - Top-level
add_to_linker
loses theLinkOptions
parameter, and there's a new top-leveladd_to_linker_with_options
function?
Or perhaps this would only affect the helpers we have in wasmtime-wasi
and wasmtime-wasi-http
? Basically it looks like there should be a convenience function for "default options" rather than requiring all callers to call it.
…it was and add new variants that take the option parameters.
Don't know what top-level function you're referring to. I think the Interface/world-level add_to_linker functions are the only ones generated by the bindgen? I have just updated the wasmtime-wasi's functions back to their old signature and added an extra set 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.
Ah sorry for my rambling, this is exactly what I was thinking 👍
Try again please |
Sigh. Try again, again? |
For extra context, see: #9276
This PR adds the ability to enable/disable WIT APIs gated by
@unstable(feature = ...)
at link-time.Previously, unstable features could only be controlled at compile-time through the
features
option ofwasmtime::component::bindgen!
. That option has been removed. Bindings for unstable APIs are now generated unconditionally. Instead, the generatedadd_to_linker***
functions take an additionalLinkOptions
parameter if the world/interface has any unstable features. The availability of unstable features is now controlled through that.The component bindgen generates a fresh
LinkOptions
type for eachinterface
that needs it and a singleLinkOptions
type for the entire world, which is a union of all the options contained in that world. An example is included in the component-macro tests:unstable-features.wit
produces:https://github.com/badeend/wasmtime/compare/245dcab34c2fcae69e0f6c3f2daa15837ea6ff61..4fcfe6f866f36ed663f24199e1744bed3cf0bc2c#diff-ad635965474c257cbafce510463aaf52c1ac813f22168045ae22546d3b3ebfc6
A happy coincidence is that WASI-0.2.1 already includes a tiny but practical first use case:
exit-with-code
.I've implemented that function and is gated behind the
-Scli-exit-with-code
CLI flag.@sunfishcode, if I interpret WebAssembly/wasi-cli#11 correctly, you were OK with removing the Windows-specific restriction, right? See: badeend@2f48c77