Update some dependencies (#1496)

Update the `wast` crate to 13 and handle the new `QuoteModule` case as
well.
This commit is contained in:
Alex Crichton
2020-04-10 17:11:23 -05:00
committed by GitHub
parent 4cca510085
commit 63c97e365e
3 changed files with 25 additions and 12 deletions

22
Cargo.lock generated
View File

@@ -1295,9 +1295,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "0.4.12" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678"
dependencies = [ dependencies = [
"proc-macro-error-attr", "proc-macro-error-attr",
"proc-macro2", "proc-macro2",
@@ -1308,9 +1308,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-error-attr" name = "proc-macro-error-attr"
version = "0.4.12" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1785,9 +1785,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.2.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a"
[[package]] [[package]]
name = "stable_deref_trait" name = "stable_deref_trait"
@@ -1812,9 +1812,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "structopt" name = "structopt"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8faa2719539bbe9d77869bfb15d4ee769f99525e707931452c97b693b3f159d" checksum = "ff6da2e8d107dfd7b74df5ef4d205c6aebee0706c647f6bc6a2d5789905c00fb"
dependencies = [ dependencies = [
"clap", "clap",
"lazy_static", "lazy_static",
@@ -1823,9 +1823,9 @@ dependencies = [
[[package]] [[package]]
name = "structopt-derive" name = "structopt-derive"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f88b8e18c69496aad6f9ddf4630dd7d585bcaf765786cb415b9aec2fe5a0430" checksum = "a489c87c08fbaf12e386665109dd13470dcc9c4583ea3e10dd2b4523e5ebd9ac"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@@ -2361,7 +2361,7 @@ version = "0.15.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wasmtime", "wasmtime",
"wast 11.0.0", "wast 13.0.0",
] ]
[[package]] [[package]]

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1.0.19" anyhow = "1.0.19"
wasmtime = { path = "../api", version = "0.15.0", default-features = false } wasmtime = { path = "../api", version = "0.15.0", default-features = false }
wast = "11.0.0" wast = "13.0.0"
[badges] [badges]
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }

View File

@@ -3,6 +3,8 @@ use anyhow::{anyhow, bail, Context as _, Result};
use std::path::Path; use std::path::Path;
use std::str; use std::str;
use wasmtime::*; use wasmtime::*;
use wast::parser::{self, ParseBuffer};
use wast::Wat;
/// Translate from a `script::Value` to a `RuntimeValue`. /// Translate from a `script::Value` to a `RuntimeValue`.
fn runtime_value(v: &wast::Expression<'_>) -> Result<Val> { fn runtime_value(v: &wast::Expression<'_>) -> Result<Val> {
@@ -234,6 +236,17 @@ impl WastContext {
let binary = module.encode()?; let binary = module.encode()?;
self.module(module.id.map(|s| s.name()), &binary)?; 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::<Wat>(&buf)?;
let binary = wat.module.encode()?;
self.module(wat.module.id.map(|s| s.name()), &binary)?;
}
Register { Register {
span: _, span: _,
name, name,