@@ -423,6 +423,8 @@ impl Config {
423
423
/// WebAssembly will execute and what compute resources will be allotted to
424
424
/// it. If Wasmtime doesn't support exactly what you'd like just yet, please
425
425
/// feel free to open an issue!
426
+ ///
427
+ /// This feature is `false` by default.
426
428
#[ cfg( feature = "async" ) ]
427
429
pub fn async_support ( & mut self , enable : bool ) -> & mut Self {
428
430
self . async_support = enable;
@@ -837,13 +839,11 @@ impl Config {
837
839
/// Embeddings of Wasmtime are able to build their own custom threading
838
840
/// scheme on top of the core wasm threads proposal, however.
839
841
///
840
- /// The default value for this option is whether the `threads`
841
- /// crate feature of Wasmtime is enabled or not. By default this crate
842
- /// feature is enabled.
842
+ /// This feature is enabled by default as long as the `threads` crate feature
843
+ /// (enabled by default) is also enabled.
843
844
///
844
845
/// [threads]: https://github.com/webassembly/threads
845
846
/// [wasi-threads]: https://github.com/webassembly/wasi-threads
846
- #[ cfg( feature = "threads" ) ]
847
847
pub fn wasm_threads ( & mut self , enable : bool ) -> & mut Self {
848
848
self . wasm_feature ( WasmFeatures :: THREADS , enable) ;
849
849
self
@@ -857,15 +857,14 @@ impl Config {
857
857
///
858
858
/// Note that the reference types proposal depends on the bulk memory proposal.
859
859
///
860
- /// This feature is `true` by default.
860
+ /// This feature is enabled by default.
861
861
///
862
862
/// # Errors
863
863
///
864
864
/// The validation of this feature are deferred until the engine is being built,
865
865
/// and thus may cause `Engine::new` fail if the `bulk_memory` feature is disabled.
866
866
///
867
867
/// [proposal]: https://github.com/webassembly/reference-types
868
- #[ cfg( feature = "gc" ) ]
869
868
pub fn wasm_reference_types ( & mut self , enable : bool ) -> & mut Self {
870
869
self . wasm_feature ( WasmFeatures :: REFERENCE_TYPES , enable) ;
871
870
self
@@ -884,7 +883,6 @@ impl Config {
884
883
/// This feature is `false` by default.
885
884
///
886
885
/// [proposal]: https://github.com/WebAssembly/function-references
887
- #[ cfg( feature = "gc" ) ]
888
886
pub fn wasm_function_references ( & mut self , enable : bool ) -> & mut Self {
889
887
self . wasm_feature ( WasmFeatures :: FUNCTION_REFERENCES , enable) ;
890
888
self
@@ -916,7 +914,6 @@ impl Config {
916
914
/// progress and generally not ready for primetime.**
917
915
///
918
916
/// [proposal]: https://github.com/WebAssembly/gc
919
- #[ cfg( feature = "gc" ) ]
920
917
pub fn wasm_gc ( & mut self , enable : bool ) -> & mut Self {
921
918
self . wasm_feature ( WasmFeatures :: GC , enable) ;
922
919
self
@@ -1100,12 +1097,10 @@ impl Config {
1100
1097
/// [`Component`](crate::component::Component) instead of
1101
1098
/// [`Module`](crate::Module) for example anyway.
1102
1099
///
1103
- /// The default value for this option is whether the `component-model`
1104
- /// crate feature of Wasmtime is enabled or not. By default this crate
1105
- /// feature is enabled.
1100
+ /// This feature is enabled by default as long as the `component-model` crate
1101
+ /// feature (enabled by default) is also enabled.
1106
1102
///
1107
1103
/// [proposal]: https://github.com/webassembly/component-model
1108
- #[ cfg( feature = "component-model" ) ]
1109
1104
pub fn wasm_component_model ( & mut self , enable : bool ) -> & mut Self {
1110
1105
self . wasm_feature ( WasmFeatures :: COMPONENT_MODEL , enable) ;
1111
1106
self
@@ -1118,7 +1113,6 @@ impl Config {
1118
1113
/// Please note that Wasmtime's support for this feature is _very_ incomplete.
1119
1114
///
1120
1115
/// [proposal]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Async.md
1121
- #[ cfg( feature = "component-model-async" ) ]
1122
1116
pub fn wasm_component_model_async ( & mut self , enable : bool ) -> & mut Self {
1123
1117
self . wasm_feature ( WasmFeatures :: COMPONENT_MODEL_ASYNC , enable) ;
1124
1118
self
@@ -1837,8 +1831,8 @@ impl Config {
1837
1831
/// Disabling this will result in a single thread being used to compile
1838
1832
/// the wasm bytecode.
1839
1833
///
1840
- /// By default parallel compilation is enabled.
1841
- # [ cfg ( feature = "parallel-compilation" ) ]
1834
+ /// This feature is enabled by default as long as the `parallel-compilation`
1835
+ /// crate feature (enabled by default) is also enabled.
1842
1836
pub fn parallel_compilation ( & mut self , parallel : bool ) -> & mut Self {
1843
1837
self . parallel_compilation = parallel;
1844
1838
self
@@ -2165,6 +2159,26 @@ impl Config {
2165
2159
bail ! ( "wmemcheck (memory checker) was requested but is not enabled in this build" ) ;
2166
2160
}
2167
2161
2162
+ #[ cfg( not( feature = "component-model" ) ) ]
2163
+ if features. component_model ( ) {
2164
+ bail ! ( "component-model support was requested but is not enabled in this build (requires the `component-model` crate feature)" ) ;
2165
+ }
2166
+
2167
+ #[ cfg( not( feature = "component-model-async" ) ) ]
2168
+ if features. component_model_async ( ) {
2169
+ bail ! ( "component-model-async support was requested but is not enabled in this build (requires the `component-model-async` crate feature)" ) ;
2170
+ }
2171
+
2172
+ #[ cfg( not( feature = "gc" ) ) ]
2173
+ if features. gc_types ( ) || features. gc ( ) {
2174
+ bail ! ( "gc support was requested but is not enabled in this build (requires the `gc` crate feature)" ) ;
2175
+ }
2176
+
2177
+ #[ cfg( not( feature = "threads" ) ) ]
2178
+ if features. threads ( ) {
2179
+ bail ! ( "threads support was requested but is not enabled in this build (requires the `threads` crate feature)" ) ;
2180
+ }
2181
+
2168
2182
let mut tunables = Tunables :: default_for_target ( & self . compiler_target ( ) ) ?;
2169
2183
2170
2184
// If no target is explicitly specified then further refine `tunables`
0 commit comments