From d4224364879709630aa9b9148fe9223e8ade9ad7 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 17 May 2019 14:54:31 -0700 Subject: [PATCH] Update dependencies and use new walrus custom sections APIs --- crates/anyref-xform/Cargo.toml | 2 +- crates/cli-support/Cargo.toml | 2 +- crates/cli-support/src/lib.rs | 18 ++++++------------ crates/cli/Cargo.toml | 2 +- .../src/bin/wasm-bindgen-test-runner/main.rs | 6 +++--- crates/threads-xform/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/crates/anyref-xform/Cargo.toml b/crates/anyref-xform/Cargo.toml index 9f83e9993..46dee2345 100644 --- a/crates/anyref-xform/Cargo.toml +++ b/crates/anyref-xform/Cargo.toml @@ -13,4 +13,4 @@ edition = '2018' [dependencies] failure = "0.1" -walrus = "0.6" +walrus = "0.7.0" diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index b68596f10..3b605885f 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -18,7 +18,7 @@ log = "0.4" rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" -walrus = "0.6.0" +walrus = "0.7.0" wasm-bindgen-anyref-xform = { path = '../anyref-xform', version = '=0.2.44' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.44' } wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.44' } diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index c1837031a..53f22d25a 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -508,20 +508,14 @@ fn extract_programs<'a>( program_storage: &'a mut Vec>, ) -> Result>, Error> { let my_version = wasm_bindgen_shared::version(); - let mut to_remove = Vec::new(); assert!(program_storage.is_empty()); - for (i, custom) in module.custom.iter_mut().enumerate() { - if custom.name != "__wasm_bindgen_unstable" { - continue; - } - to_remove.push(i); - log::debug!("custom section {} looks like a wasm bindgen section", i); - program_storage.push(mem::replace(&mut custom.value, Vec::new())); - } - - for i in to_remove.into_iter().rev() { - module.custom.remove(i); + while let Some(raw) = module.customs.remove_raw("__wasm_bindgen_unstable") { + log::debug!( + "custom section '{}' looks like a wasm bindgen section", + raw.name + ); + program_storage.push(raw.data); } let mut ret = Vec::new(); diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 37a80a6a8..bd47a1a8b 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -24,7 +24,7 @@ rouille = { version = "3.0.0", default-features = false } serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" -walrus = "0.6" +walrus = "0.7.0" wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.44" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.44" } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index e77a46bc7..545137a65 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -94,11 +94,11 @@ fn rmain() -> Result<(), Error> { // `wasm_bindgen_test_configure` macro, which emits a custom section for us // to read later on. let mut node = true; - for custom in wasm.custom.iter() { - if custom.name != "__wasm_bindgen_test_unstable" { + for (_id, custom) in wasm.customs.iter() { + if custom.name() != "__wasm_bindgen_test_unstable" { continue; } - node = !custom.value.contains(&0x01); + node = !custom.data().contains(&0x01); } let headless = env::var("NO_HEADLESS").is_err(); let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err(); diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 995f0fdbf..bd3791ede 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -13,4 +13,4 @@ edition = "2018" [dependencies] failure = "0.1" -walrus = "0.6" +walrus = "0.7.0" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index ee35e31e0..d11712c99 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -14,7 +14,7 @@ edition = '2018' [dependencies] failure = "0.1" log = "0.4" -walrus = "0.6" +walrus = "0.7.0" [dev-dependencies] tempfile = "3"