mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Require version agreement between CLI and dep
One day may be able to relax this but for now its not tenable! Closes #47
This commit is contained in:
parent
1c8061e675
commit
31853ad0ba
@ -118,6 +118,7 @@ impl Bindgen {
|
||||
}
|
||||
|
||||
fn extract_programs(module: &mut Module) -> Vec<shared::Program> {
|
||||
let version = shared::version();
|
||||
let data = module.sections_mut()
|
||||
.iter_mut()
|
||||
.filter_map(|s| {
|
||||
@ -150,12 +151,37 @@ fn extract_programs(module: &mut Module) -> Vec<shared::Program> {
|
||||
let json = a.iter()
|
||||
.map(|i| char::from_u32(i.0).unwrap())
|
||||
.collect::<String>();
|
||||
let p = match serde_json::from_str(&json) {
|
||||
let p: shared::Program = match serde_json::from_str(&json) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
panic!("failed to decode what looked like wasm-bindgen data: {}", e)
|
||||
}
|
||||
};
|
||||
if p.version != version {
|
||||
panic!("
|
||||
|
||||
it looks like the Rust project used to create this wasm file was linked against
|
||||
a different version of wasm-bindgen than this binary:
|
||||
|
||||
rust wasm file: {}
|
||||
this binary: {}
|
||||
|
||||
Currently the bindgen format is unstable enough that these two version must
|
||||
exactly match, so it's required that these two version are kept in sync by
|
||||
either updating the wasm-bindgen dependency or this binary. You should be able
|
||||
to update the wasm-bindgen dependency with:
|
||||
|
||||
cargo update -p wasm-bindgen
|
||||
|
||||
or you can update the binary with
|
||||
|
||||
cargo install -f --git https://github.com/alexcrichton/wasm-bindgen
|
||||
|
||||
if this warning fails to go away though and you're not sure what to do feel free
|
||||
to open an issue at https://github.com/alexcrichton/wasm-bindgen/issues!
|
||||
",
|
||||
p.version, version);
|
||||
}
|
||||
ret.push(p);
|
||||
}
|
||||
}
|
||||
|
@ -353,6 +353,7 @@ impl Program {
|
||||
]);
|
||||
})
|
||||
}),
|
||||
("version", &|a| a.str(&shared::version())),
|
||||
]);
|
||||
a.cnt
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ pub struct Program {
|
||||
pub enums: Vec<Enum>,
|
||||
pub imports: Vec<Import>,
|
||||
pub custom_type_names: Vec<CustomTypeName>,
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user