Skip to content

Commit

Permalink
Deprecate to_wasm_error
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Dec 22, 2020
1 parent 0a4a2c7 commit 917e80f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [#1941](https://github.com/wasmerio/wasmer/pull/1941) Turn `get_remaining_points`/`set_remaining_points` of the `Metering` middleware into free functions to allow using them in an ahead-of-time compilation setup
* [#1955](https://github.com/wasmerio/wasmer/pull/1955) Set `jit` as a default feature of the `wasmer-wasm-c-api` crate
* [#1944](https://github.com/wasmerio/wasmer/pull/1944) Require `WasmerEnv` to be `Send + Sync` even in dynamic functions.
* [#1963](https://github.com/wasmerio/wasmer/pull/1963) Deprecated `to_wasm_error` in favour of `impl From<BinaryReaderError> for WasmError`

### Fixed

Expand Down
10 changes: 7 additions & 3 deletions lib/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ pub use crate::target::{
Architecture, BinaryFormat, CallingConvention, CpuFeature, Endianness, OperatingSystem,
PointerWidth, Target, Triple,
};

#[cfg(feature = "translator")]
#[allow(deprecated)]
pub use crate::translator::to_wasm_error;
#[cfg(feature = "translator")]
pub use crate::translator::{
to_wasm_error, translate_module, wptype_to_type, FunctionBodyData, FunctionMiddleware,
MiddlewareBinaryReader, MiddlewareReaderState, ModuleEnvironment, ModuleInfoTranslation,
ModuleMiddleware, ModuleMiddlewareChain, ModuleTranslationState,
translate_module, wptype_to_type, FunctionBodyData, FunctionMiddleware, MiddlewareBinaryReader,
MiddlewareReaderState, ModuleEnvironment, ModuleInfoTranslation, ModuleMiddleware,
ModuleMiddlewareChain, ModuleTranslationState,
};
pub use crate::trap::TrapInformation;
pub use crate::unwind::CompiledFunctionUnwindInfo;
Expand Down
15 changes: 11 additions & 4 deletions lib/compiler/src/translator/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ macro_rules! wasm_unsupported {
($($arg:tt)*) => { $crate::WasmError::Unsupported(format!($($arg)*)) }
}

impl From<BinaryReaderError> for WasmError {
fn from(original: BinaryReaderError) -> Self {
Self::InvalidWebAssembly {
message: original.message().into(),
offset: original.offset(),
}
}
}

/// Converts a Wasm binary reading error to a runtime Wasm error
#[deprecated(since = "1.0.0-beta3", note = "Use WasmError::from")]
pub fn to_wasm_error(e: BinaryReaderError) -> WasmError {
WasmError::InvalidWebAssembly {
message: e.message().into(),
offset: e.offset(),
}
e.into()
}
1 change: 1 addition & 0 deletions lib/compiler/src/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod error;
mod sections;

pub use self::environ::{FunctionBodyData, ModuleEnvironment, ModuleInfoTranslation};
#[allow(deprecated)]
pub use self::error::to_wasm_error;
pub use self::middleware::{
FunctionMiddleware, MiddlewareBinaryReader, MiddlewareReaderState, ModuleMiddleware,
Expand Down

0 comments on commit 917e80f

Please sign in to comment.