1 //! Panic when interpreting WebAssembly modules; see the rationale for this in
2 //! `lib.rs`.
3 //!
4 //! ```should_panic
5 //! # use wasm_spec_interpreter::instantiate;
6 //! let _ = instantiate(&[]);
7 //! ```
8 
9 use crate::{SpecExport, SpecInstance, SpecValue};
10 
11 pub fn instantiate(_module: &[u8]) -> Result<SpecInstance, String> {
12     fail_at_runtime()
13 }
14 
15 pub fn interpret(
16     _instance: &SpecInstance,
17     _name: &str,
18     _parameters: Option<Vec<SpecValue>>,
19 ) -> Result<Vec<SpecValue>, String> {
20     fail_at_runtime()
21 }
22 
23 pub fn interpret_legacy(
24     _module: &[u8],
25     _parameters: Option<Vec<SpecValue>>,
26 ) -> Result<Vec<SpecValue>, String> {
27     fail_at_runtime()
28 }
29 
30 pub fn export(_instance: &SpecInstance, _name: &str) -> Result<SpecExport, String> {
31     fail_at_runtime()
32 }
33 
34 fn fail_at_runtime() -> ! {
35     panic!(
36         "wasm-spec-interpreter was built without its Rust-to-OCaml shim \
37         library; re-compile with the dependencies listed in its README.md."
38     );
39 }
40 
41 pub fn setup_ocaml_runtime() {}
42