From 2fdf0449a448eb3b595c74944969489739bc794a Mon Sep 17 00:00:00 2001 From: Jeffrey Charles Date: Mon, 3 Jun 2024 12:20:36 -0400 Subject: [PATCH] Update wasmparser (#659) --- Cargo.lock | 4 +++- crates/cli/Cargo.toml | 2 +- crates/cli/tests/common/mod.rs | 13 +++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12cc4de5..a61e34ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1198,6 +1198,7 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -1548,7 +1549,7 @@ dependencies = [ "walrus", "wasi-common", "wasm-opt", - "wasmparser 0.206.0", + "wasmparser 0.209.1", "wasmprinter 0.206.0", "wasmtime", "wasmtime-wasi", @@ -3613,6 +3614,7 @@ dependencies = [ "hashbrown 0.14.3", "indexmap 2.2.6", "semver 1.0.22", + "serde", ] [[package]] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 52492919..777a72c5 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -41,7 +41,7 @@ lazy_static = "1.4" serde = { version = "1.0", default-features = false, features = ["derive"] } criterion = "0.5" num-format = "0.4.4" -wasmparser = "0.206.0" +wasmparser = "0.209.1" [build-dependencies] anyhow = "1.0.81" diff --git a/crates/cli/tests/common/mod.rs b/crates/cli/tests/common/mod.rs index 6bdcd036..3da9ffe7 100644 --- a/crates/cli/tests/common/mod.rs +++ b/crates/cli/tests/common/mod.rs @@ -1,6 +1,5 @@ use anyhow::Result; use std::path::{Path, PathBuf}; -use wasmparser::ProducersSectionReader; use wasmtime::{Engine, Module}; // Allows dead code b/c each integration test suite is considered its own @@ -25,13 +24,15 @@ pub fn create_quickjs_provider_module(engine: &Engine) -> Result { pub fn assert_producers_section_is_correct(wasm: &[u8]) -> Result<()> { let producers_section = wasmparser::Parser::new(0) .parse_all(wasm) - .find_map(|payload| match payload { - Ok(wasmparser::Payload::CustomSection(c)) if c.name() == "producers" => { - Some(ProducersSectionReader::new(c.data(), c.data_offset()).unwrap()) + .find_map(|payload| { + if let Ok(wasmparser::Payload::CustomSection(c)) = payload { + if let wasmparser::KnownCustom::Producers(r) = c.as_known() { + return Some(r); + } } - _ => None, + None }) - .unwrap(); + .expect("Should have producers custom section"); let fields = producers_section .into_iter() .collect::, _>>()?;