From 5e05aa1b03fd8b6c5b064bc145750643ca92e803 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Sat, 22 Feb 2020 11:11:48 -0800 Subject: [PATCH] Update to wasmparser 0.51 wasmparser::BinaryReaderError now encapsulates its fields, so call the accessors rather than destructuring to get the fields. --- cranelift/wasm/Cargo.toml | 2 +- cranelift/wasm/src/environ/spec.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cranelift/wasm/Cargo.toml b/cranelift/wasm/Cargo.toml index 8bee878bb3..4ac0496263 100644 --- a/cranelift/wasm/Cargo.toml +++ b/cranelift/wasm/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["webassembly", "wasm"] edition = "2018" [dependencies] -wasmparser = { version = "0.49.0", default-features = false } +wasmparser = { version = "0.51.0", default-features = false } cranelift-codegen = { path = "../cranelift-codegen", version = "0.58.0", default-features = false } cranelift-entity = { path = "../cranelift-entity", version = "0.58.0" } cranelift-frontend = { path = "../cranelift-frontend", version = "0.58.0", default-features = false } diff --git a/cranelift/wasm/src/environ/spec.rs b/cranelift/wasm/src/environ/spec.rs index 73a02c6709..b0dd4d508d 100644 --- a/cranelift/wasm/src/environ/spec.rs +++ b/cranelift/wasm/src/environ/spec.rs @@ -55,7 +55,7 @@ pub enum WasmError { #[error("Invalid input WebAssembly code at offset {offset}: {message}")] InvalidWebAssembly { /// A string describing the validation error. - message: &'static str, + message: std::string::String, /// The bytecode offset where the error occurred. offset: usize, }, @@ -90,8 +90,10 @@ macro_rules! wasm_unsupported { impl From for WasmError { /// Convert from a `BinaryReaderError` to a `WasmError`. fn from(e: BinaryReaderError) -> Self { - let BinaryReaderError { message, offset } = e; - Self::InvalidWebAssembly { message, offset } + Self::InvalidWebAssembly { + message: e.message().into(), + offset: e.offset(), + } } }