From 2f0e37d5e6e1e84f4711496c634d951e2e3819fd Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 22 Dec 2020 10:01:17 +0100 Subject: [PATCH] Implement From for CompileError without std --- lib/compiler/src/error.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/compiler/src/error.rs b/lib/compiler/src/error.rs index d71af061674..0d554c15e8c 100644 --- a/lib/compiler/src/error.rs +++ b/lib/compiler/src/error.rs @@ -18,7 +18,7 @@ use thiserror::Error; pub enum CompileError { /// A Wasm translation error occured. #[cfg_attr(feature = "std", error("WebAssembly translation error: {0}"))] - Wasm(#[cfg_attr(feature = "std", from)] WasmError), + Wasm(WasmError), /// A compilation error occured. #[cfg_attr(feature = "std", error("Compilation error: {0}"))] @@ -42,6 +42,12 @@ pub enum CompileError { Resource(String), } +impl From for CompileError { + fn from(original: WasmError) -> Self { + Self::Wasm(original) + } +} + /// A WebAssembly translation error. /// /// When a WebAssembly function can't be translated, one of these error codes will be returned