Skip to content

Commit 79e4324

Browse files
committed
Update parity-wasm dependency
While doing this, make `parity-wasm` a public dependency of all crates instead of using the `Any` trick as that's not really needed any more.
1 parent e3e5c0f commit 79e4324

File tree

7 files changed

+9
-38
lines changed

7 files changed

+9
-38
lines changed

crates/cli-support/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Shared support for the wasm-bindgen-cli package, an internal dependency
1313
[dependencies]
1414
base64 = "0.9"
1515
failure = "0.1.2"
16-
parity-wasm = "0.32"
16+
parity-wasm = "0.34"
1717
serde = "1.0"
1818
serde_json = "1.0"
1919
tempfile = "3.0"

crates/cli-support/src/lib.rs

+3-33
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ extern crate wasm_bindgen_gc;
88
extern crate failure;
99
extern crate wasm_bindgen_wasm_interpreter as wasm_interpreter;
1010

11-
use std::any::Any;
1211
use std::collections::BTreeSet;
1312
use std::env;
1413
use std::fs;
@@ -40,7 +39,6 @@ pub struct Bindgen {
4039

4140
enum Input {
4241
Path(PathBuf),
43-
Bytes(Vec<u8>, String),
4442
Module(Module, String),
4543
None,
4644
}
@@ -68,33 +66,10 @@ impl Bindgen {
6866
}
6967

7068
/// Explicitly specify the already parsed input module.
71-
///
72-
/// Note that this API is a little wonky to avoid tying itself with a public
73-
/// dependency on the `parity-wasm` crate, what we currently use to parse
74-
/// wasm mdoules.
75-
///
76-
/// If the `module` argument is a `parity_wasm::Module` then it will be used
77-
/// directly. Otherwise it will be passed to `into_bytes` to serialize the
78-
/// module to a vector of bytes, and this will deserialize the module later.
79-
///
80-
/// Note that even if the argument passed in is a `parity_wasm::Module` it
81-
/// doesn't mean that this won't invoke `into_bytes`, if the `parity_wasm`
82-
/// crate versions are different we'll have to go through serialization.
83-
pub fn input_module<T: Any>(
84-
&mut self,
85-
name: &str,
86-
mut module: T,
87-
into_bytes: impl FnOnce(T) -> Vec<u8>,
88-
) -> &mut Bindgen {
69+
pub fn input_module(&mut self, name: &str, module: Module) -> &mut Bindgen {
8970
let name = name.to_string();
90-
if let Some(module) = (&mut module as &mut Any).downcast_mut::<Module>() {
91-
let blank = Module::new(Vec::new());
92-
self.input = Input::Module(mem::replace(module, blank), name);
93-
return self;
94-
}
95-
96-
self.input = Input::Bytes(into_bytes(module), name);
97-
self
71+
self.input = Input::Module(module, name);
72+
return self;
9873
}
9974

10075
pub fn nodejs(&mut self, node: bool) -> &mut Bindgen {
@@ -153,11 +128,6 @@ impl Bindgen {
153128
let blank_module = Module::new(Vec::new());
154129
(mem::replace(m, blank_module), &name[..])
155130
}
156-
Input::Bytes(ref b, ref name) => {
157-
let module = parity_wasm::deserialize_buffer::<Module>(&b)
158-
.context("failed to parse input file as wasm")?;
159-
(module, &name[..])
160-
}
161131
Input::Path(ref path) => {
162132
let contents = fs::read(&path)
163133
.with_context(|_| format!("failed to read `{}`", path.display()))?;

crates/cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docopt = "1.0"
1818
env_logger = "0.5"
1919
failure = "0.1.2"
2020
log = "0.4"
21-
parity-wasm = "0.32"
21+
parity-wasm = "0.34"
2222
rouille = { version = "2.1.0", default-features = false }
2323
serde = "1.0"
2424
serde_derive = "1.0"

crates/cli/src/bin/wasm-bindgen-test-runner/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn rmain() -> Result<(), Error> {
126126
let mut b = Bindgen::new();
127127
b.debug(debug)
128128
.nodejs(node)
129-
.input_module(module, wasm, |w| parity_wasm::serialize(w).unwrap())
129+
.input_module(module, wasm)
130130
.keep_debug(false)
131131
.generate(&tmpdir)
132132
.context("executing `wasm-bindgen` over the wasm file")?;

crates/gc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ Support for removing unused items from a wasm executable
1111
"""
1212

1313
[dependencies]
14-
parity-wasm = "0.32"
14+
parity-wasm = "0.34"
1515
log = "0.4"
1616
rustc-demangle = "0.1.9"

crates/gc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ impl<'a> LiveContext<'a> {
354354
ValueType::I64 => {}
355355
ValueType::F32 => {}
356356
ValueType::F64 => {}
357+
ValueType::V128 => {}
357358
}
358359
}
359360

crates/wasm-interpreter/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Micro-interpreter optimized for wasm-bindgen's use case
1111
"""
1212

1313
[dependencies]
14-
parity-wasm = "0.32"
14+
parity-wasm = "0.34"
1515

1616
[dev-dependencies]
1717
tempfile = "3"

0 commit comments

Comments
 (0)