Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Require the reference-types feature for component-model-async (#14121)

Alex Crichton80e19ca6c12a
diff --git a/crates/fuzzing/src/generators/config.rs b/crates/fuzzing/src/generators/config.rs
index a85a79d2cf..e41dbf6579 100644
--- a/crates/fuzzing/src/generators/config.rs
+++ b/crates/fuzzing/src/generators/config.rs
@@ -198,6 +198,7 @@ impl Config {
config.gc_enabled = gc.unwrap_or(false);
config.reference_types_enabled = config.gc_enabled
|| self.module_config.function_references_enabled
+ || self.module_config.component_model_async
|| reference_types.unwrap_or(false);
config.extended_const_enabled = extended_const.unwrap_or(false);
config.exceptions_enabled =
diff --git a/crates/test-util/src/wasmtime_wast.rs b/crates/test-util/src/wasmtime_wast.rs
index 25bb1fc348..53ef7f04e9 100644
--- a/crates/test-util/src/wasmtime_wast.rs
+++ b/crates/test-util/src/wasmtime_wast.rs
@@ -96,7 +96,8 @@ pub fn apply_test_config(config: &mut Config, test_config: &wast::TestConfig) {
// downstream proposals once the end proposal is enabled (e.g. when enabling
// gc that also enables function-references and reference-types).
let function_references = gc || function_references.unwrap_or(false);
- let reference_types = function_references || reference_types.unwrap_or(false);
+ let reference_types =
+ function_references || component_model_async || reference_types.unwrap_or(false);
let simd = relaxed_simd || simd.unwrap_or(false);
let exceptions = stack_switching || exceptions.unwrap_or(false);
diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index 05e4a63fcb..c8060d2f72 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -2786,6 +2786,15 @@ impl Config {
)
}
+ // Generated adapters between components will use `ref.func` in some
+ // async-related situations so `component-model-async` requires
+ // `reference-types`.
+ if features.contains(WasmFeatures::CM_ASYNC)
+ && !features.contains(WasmFeatures::REFERENCE_TYPES)
+ {
+ bail!("the component-model-async feature requires the wasm reference-types proposal");
+ }
+
// If the pooling allocator is used and GC is enabled, check that
// memories and the GC heap are configured identically, since the
// pooling allocator can't support differently-configured heaps.
diff --git a/tests/all/func.rs b/tests/all/func.rs
index 23d7034ba6..4c94c67e64 100644
--- a/tests/all/func.rs
+++ b/tests/all/func.rs
@@ -1140,6 +1140,7 @@ fn pass_cross_store_arg(config: &mut Config) -> wasmtime::Result<()> {
fn externref_signature_no_reference_types() -> wasmtime::Result<()> {
let mut config = Config::new();
config.wasm_reference_types(false);
+ config.wasm_component_model_async(false);
let mut store = Store::new(&Engine::new(&config)?, ());
Func::wrap(&mut store, |_: Option<Func>| {});
let func_ty = FuncType::new(
diff --git a/tests/rlimited-memory.rs b/tests/rlimited-memory.rs
index 54d2a44d9d..48fc50ff2a 100644
--- a/tests/rlimited-memory.rs
+++ b/tests/rlimited-memory.rs
@@ -58,6 +58,7 @@ fn custom_limiter_detect_os_oom_failure() -> Result<()> {
// memory grow will hit Linux for a larger mmap.
let mut config = Config::new();
config.wasm_reference_types(false);
+ config.wasm_component_model_async(false);
let engine = Engine::new(&config)?;
let linker = Linker::new(&engine);
let module = Module::new(&engine, r#"(module (memory (export "m") 0))"#).unwrap();