[wasm] Have the WasmError::User member be a String;

This commit is contained in:
Benjamin Bouvier
2019-05-03 15:38:28 +02:00
parent 8f95c51730
commit a0ddbf403c
2 changed files with 3 additions and 11 deletions

View File

@@ -27,7 +27,7 @@ target-lexicon = "0.4.0"
[features] [features]
default = ["std"] default = ["std"]
std = ["cranelift-codegen/std", "cranelift-frontend/std", "wasmparser/std", "failure/std"] std = ["cranelift-codegen/std", "cranelift-frontend/std", "wasmparser/std"]
core = ["hashmap_core", "cranelift-codegen/core", "cranelift-frontend/core", "wasmparser/core"] core = ["hashmap_core", "cranelift-codegen/core", "cranelift-frontend/core", "wasmparser/core"]
[badges] [badges]

View File

@@ -68,17 +68,9 @@ pub enum WasmError {
#[fail(display = "Implementation limit exceeded")] #[fail(display = "Implementation limit exceeded")]
ImplLimitExceeded, ImplLimitExceeded,
/// Any user-defined error. Requires an std build, where failure::Error is defined. /// Any user-defined error.
#[cfg(feature = "std")]
#[fail(display = "User error: {}", _0)] #[fail(display = "User error: {}", _0)]
User(failure::Error), User(std::string::String),
}
#[cfg(feature = "std")]
impl From<failure::Error> for WasmError {
fn from(err: failure::Error) -> Self {
WasmError::User(err)
}
} }
impl From<BinaryReaderError> for WasmError { impl From<BinaryReaderError> for WasmError {