From afd912e8e1ffb8bf21351c19db15635d9162f3a8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 19 Nov 2024 08:28:38 -0800 Subject: [PATCH] Remove feature validation from Wasmtime Some of this originated in #917 but nowadays it shouldn't be necessary to control proposals like this. Instead it's probably best nowadays to throw configuration at `wasmparser` and use its definition of features to determine whether constructs make sense or not. This reduces the amount of bits and pieces Wasmtime has to do and avoids interactions such as #9622. Closes #9622 --- crates/wasmtime/src/config.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index b28c72dca82d..108ab48eb1f3 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -2016,25 +2016,6 @@ impl Config { panic!("should have returned an error by now") } - if features.contains(WasmFeatures::REFERENCE_TYPES) - && !features.contains(WasmFeatures::BULK_MEMORY) - { - bail!("feature 'reference_types' requires 'bulk_memory' to be enabled"); - } - if features.contains(WasmFeatures::THREADS) && !features.contains(WasmFeatures::BULK_MEMORY) - { - bail!("feature 'threads' requires 'bulk_memory' to be enabled"); - } - if features.contains(WasmFeatures::FUNCTION_REFERENCES) - && !features.contains(WasmFeatures::REFERENCE_TYPES) - { - bail!("feature 'function_references' requires 'reference_types' to be enabled"); - } - if features.contains(WasmFeatures::GC) - && !features.contains(WasmFeatures::FUNCTION_REFERENCES) - { - bail!("feature 'gc' requires 'function_references' to be enabled"); - } #[cfg(feature = "async")] if self.async_support && self.max_wasm_stack > self.async_stack_size { bail!("max_wasm_stack size cannot exceed the async_stack_size");