Skip to content

Commit

Permalink
Implement From<WasmError> for CompileError without std
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Dec 22, 2020
1 parent 57c2c46 commit 2f0e37d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/compiler/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"))]
Expand All @@ -42,6 +42,12 @@ pub enum CompileError {
Resource(String),
}

impl From<WasmError> 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
Expand Down

0 comments on commit 2f0e37d

Please sign in to comment.