diff --git a/crates/wasm-bindgen-cli-support/src/lib.rs b/crates/wasm-bindgen-cli-support/src/lib.rs index c82f8190..f3c90b56 100644 --- a/crates/wasm-bindgen-cli-support/src/lib.rs +++ b/crates/wasm-bindgen-cli-support/src/lib.rs @@ -163,7 +163,7 @@ fn extract_programs(module: &mut Module) -> Vec { panic!("failed to decode what looked like wasm-bindgen data: {}", e) } }; - if p.version != version { + if p.schema_version != shared::SCHEMA_VERSION { panic!(" it looks like the Rust project used to create this wasm file was linked against diff --git a/crates/wasm-bindgen-macro/src/ast.rs b/crates/wasm-bindgen-macro/src/ast.rs index 112a0729..b6b82be6 100644 --- a/crates/wasm-bindgen-macro/src/ast.rs +++ b/crates/wasm-bindgen-macro/src/ast.rs @@ -351,6 +351,7 @@ impl Program { }) }), ("version", &|a| a.str(&shared::version())), + ("schema_version", &|a| a.str(&shared::SCHEMA_VERSION)), ]); a.cnt }; diff --git a/crates/wasm-bindgen-shared/src/lib.rs b/crates/wasm-bindgen-shared/src/lib.rs index 741e7b86..89d57375 100644 --- a/crates/wasm-bindgen-shared/src/lib.rs +++ b/crates/wasm-bindgen-shared/src/lib.rs @@ -5,6 +5,8 @@ extern crate fnv; use std::char; use std::hash::{Hash, Hasher}; +pub const SCHEMA_VERSION: &str = "0"; + #[derive(Deserialize)] pub struct Program { pub exports: Vec, @@ -12,6 +14,7 @@ pub struct Program { pub imports: Vec, pub custom_type_names: Vec, pub version: String, + pub schema_version: String, } #[derive(Deserialize)]