From 97fb3cc56442c4d831ef2c9e1599cc8105ff2b96 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 12 Dec 2023 10:09:38 +0100 Subject: test(tinywasm): add AssertReturn to spec test harness Signed-off-by: Henry Gressmann --- crates/parser/src/error.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/parser') diff --git a/crates/parser/src/error.rs b/crates/parser/src/error.rs index a5c807a..acacfa0 100644 --- a/crates/parser/src/error.rs +++ b/crates/parser/src/error.rs @@ -1,8 +1,9 @@ -use core::fmt::Debug; +use core::fmt::{Debug, Display}; use alloc::string::{String, ToString}; use wasmparser::Encoding; +#[derive(Debug)] pub enum ParseError { InvalidType, UnsupportedSection(String), @@ -16,7 +17,7 @@ pub enum ParseError { Other(String), } -impl Debug for ParseError { +impl Display for ParseError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidType => write!(f, "invalid type"), @@ -37,6 +38,9 @@ impl Debug for ParseError { } } +#[cfg(any(feature = "std", all(not(feature = "std"), nightly)))] +impl crate::std::error::Error for ParseError {} + impl From for ParseError { fn from(value: wasmparser::BinaryReaderError) -> Self { Self::ParseError { -- cgit v1.3.1