Update wat crate.
Update the `wat` crate to latest version and use `Error::set_path` in `Module::from_file` to properly record the path associated with errors.
This commit is contained in:
@@ -22,7 +22,7 @@ wasm-smith = "0.4.4"
|
||||
wasmi = "0.7.0"
|
||||
|
||||
[dev-dependencies]
|
||||
wat = "1.0.36"
|
||||
wat = "1.0.37"
|
||||
|
||||
[features]
|
||||
experimental_x64 = ["wasmtime/experimental_x64"]
|
||||
|
||||
@@ -28,7 +28,7 @@ wasmparser = "0.77"
|
||||
|
||||
[dev-dependencies]
|
||||
lazy_static = "1.2"
|
||||
wat = "1.0.36"
|
||||
wat = "1.0.37"
|
||||
quickcheck = "1.0.0"
|
||||
anyhow = "1.0"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ pretty_env_logger = "0.4.0"
|
||||
tempfile = "3.1.0"
|
||||
os_pipe = "0.9"
|
||||
anyhow = "1.0.19"
|
||||
wat = "1.0.36"
|
||||
wat = "1.0.37"
|
||||
cap-std = "0.13"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -228,10 +228,23 @@ impl Module {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn from_file(engine: &Engine, file: impl AsRef<Path>) -> Result<Module> {
|
||||
Self::new(
|
||||
match Self::new(
|
||||
engine,
|
||||
&fs::read(file).with_context(|| "failed to read input file")?,
|
||||
)
|
||||
&fs::read(&file).with_context(|| "failed to read input file")?,
|
||||
) {
|
||||
Ok(m) => Ok(m),
|
||||
Err(e) => {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "wat")] {
|
||||
let mut e = e.downcast::<wat::Error>()?;
|
||||
e.set_path(file);
|
||||
bail!(e)
|
||||
} else {
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new WebAssembly `Module` from the given in-memory `binary`
|
||||
|
||||
Reference in New Issue
Block a user