Skip to content

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

Fix build without `wat` feature. (#12706)

Piotr Sikora7a4f53a34346
diff --git a/crates/c-api/include/wasmtime/component/component.hh b/crates/c-api/include/wasmtime/component/component.hh
index 0463516d19..10df55abb0 100644
--- a/crates/c-api/include/wasmtime/component/component.hh
+++ b/crates/c-api/include/wasmtime/component/component.hh
@@ -40,6 +40,8 @@ class Component {
WASMTIME_CLONE_WRAPPER(Component, wasmtime_component);
#ifdef WASMTIME_FEATURE_COMPILER
+
+#ifdef WASMTIME_FEATURE_WAT
/**
* \brief Compiles a component from the WebAssembly text format.
*
@@ -54,6 +56,7 @@ class Component {
auto bytes = wasm.ok();
return compile(engine, bytes);
}
+#endif // WASMTIME_FEATURE_WAT
/**
* \brief Compiles a component from the WebAssembly binary format.
diff --git a/crates/c-api/include/wasmtime/module.hh b/crates/c-api/include/wasmtime/module.hh
index 4a28439de8..efdaeba5d1 100644
--- a/crates/c-api/include/wasmtime/module.hh
+++ b/crates/c-api/include/wasmtime/module.hh
@@ -29,6 +29,8 @@ class Module {
WASMTIME_CLONE_WRAPPER(Module, wasmtime_module);
#ifdef WASMTIME_FEATURE_COMPILER
+
+#ifdef WASMTIME_FEATURE_WAT
/**
* \brief Compiles a module from the WebAssembly text format.
*
@@ -43,6 +45,7 @@ class Module {
auto bytes = wasm.ok();
return compile(engine, bytes);
}
+#endif // WASMTIME_FEATURE_WAT
/**
* \brief Compiles a module from the WebAssembly binary format.
diff --git a/crates/wasmtime/src/compile/code_builder/compile_time_builtins.rs b/crates/wasmtime/src/compile/code_builder/compile_time_builtins.rs
index c06ccd7151..dd572d8932 100644
--- a/crates/wasmtime/src/compile/code_builder/compile_time_builtins.rs
+++ b/crates/wasmtime/src/compile/code_builder/compile_time_builtins.rs
@@ -223,6 +223,7 @@ impl<'a> CodeBuilder<'a> {
///
/// See the example in [CodeBuilder::expose_unsafe_intrinsics], which uses
/// compile-time builtins.
+ #[allow(unused_variables, reason = "`wasm_path` only used with `wat` feature")]
pub unsafe fn compile_time_builtins_binary_or_text(
&mut self,
name: impl Into<Cow<'a, str>>,