From 63c97e365e716e3dbe07f8cb5a2c1084b188baed Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 10 Apr 2020 17:11:23 -0500 Subject: [PATCH] Update some dependencies (#1496) Update the `wast` crate to 13 and handle the new `QuoteModule` case as well. --- Cargo.lock | 22 +++++++++++----------- crates/wast/Cargo.toml | 2 +- crates/wast/src/wast.rs | 13 +++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8c92cbc46c0..ff73ecba796b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1295,9 +1295,9 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "0.4.12" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", @@ -1308,9 +1308,9 @@ dependencies = [ [[package]] name = "proc-macro-error-attr" -version = "0.4.12" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", "quote", @@ -1785,9 +1785,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" [[package]] name = "stable_deref_trait" @@ -1812,9 +1812,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8faa2719539bbe9d77869bfb15d4ee769f99525e707931452c97b693b3f159d" +checksum = "ff6da2e8d107dfd7b74df5ef4d205c6aebee0706c647f6bc6a2d5789905c00fb" dependencies = [ "clap", "lazy_static", @@ -1823,9 +1823,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f88b8e18c69496aad6f9ddf4630dd7d585bcaf765786cb415b9aec2fe5a0430" +checksum = "a489c87c08fbaf12e386665109dd13470dcc9c4583ea3e10dd2b4523e5ebd9ac" dependencies = [ "heck", "proc-macro-error", @@ -2361,7 +2361,7 @@ version = "0.15.0" dependencies = [ "anyhow", "wasmtime", - "wast 11.0.0", + "wast 13.0.0", ] [[package]] diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml index ac17de7df0d4..8e8a778648c5 100644 --- a/crates/wast/Cargo.toml +++ b/crates/wast/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [dependencies] anyhow = "1.0.19" wasmtime = { path = "../api", version = "0.15.0", default-features = false } -wast = "11.0.0" +wast = "13.0.0" [badges] maintenance = { status = "actively-developed" } diff --git a/crates/wast/src/wast.rs b/crates/wast/src/wast.rs index f62ec3530bd8..b4866072cd97 100644 --- a/crates/wast/src/wast.rs +++ b/crates/wast/src/wast.rs @@ -3,6 +3,8 @@ use anyhow::{anyhow, bail, Context as _, Result}; use std::path::Path; use std::str; use wasmtime::*; +use wast::parser::{self, ParseBuffer}; +use wast::Wat; /// Translate from a `script::Value` to a `RuntimeValue`. fn runtime_value(v: &wast::Expression<'_>) -> Result { @@ -234,6 +236,17 @@ impl WastContext { let binary = module.encode()?; self.module(module.id.map(|s| s.name()), &binary)?; } + QuoteModule { span: _, source } => { + let mut module = String::new(); + for src in source { + module.push_str(str::from_utf8(src)?); + module.push_str(" "); + } + let buf = ParseBuffer::new(&module)?; + let mut wat = parser::parse::(&buf)?; + let binary = wat.module.encode()?; + self.module(wat.module.id.map(|s| s.name()), &binary)?; + } Register { span: _, name,