Description
Feature
Provide some mechanism for disabling on-by-default config options without having to enable their associated cargo feature flags.
Benefit
The wasmtime Config has a bunch of options like Config::wasm_reference_types that are enabled by-default if the corresponding cargo feature is enabled. Unfortunately, these config options are gated by the same feature flags making it impossible to turn them off without enabling the underlying cargo feature.
This is fine when building an application, but is a problem for library authors. If a library author wants to configure wasmtime in a specific way, they need to enable features (in cargo) they don't actually want so they can disable them in the config. Unfortunately, there's no way to actually detect if the feature has been enabled.
Implementation
The simplest solution is to provide some form of Config::minimal()
constructor (or something like that) that turns off all optional features. New versions of wasmtime may make some of these features mandatory, but, IMO, that's fine. I'm mostly looking for predictability.
Alternatives
Another option is to let users call all config methods even if the associated capabilities are disabled via cargo features:
- Remove the
#[cfg(feature = ...)]
gates on allConfig
methods and their associated fields in the config. - Return an error from
Engine::new
if unsupported features are requested.
The main drawback is that we'll lose the compile-time check on whether or not the feature is enabled.