From 6e4bbb7490d73682ecf51313ebf235e88a9bef03 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Fri, 9 Feb 2018 11:20:21 +0300 Subject: [PATCH] Opt in for 32bit platforms (#44) --- Cargo.toml | 6 ++++++ src/lib.rs | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5d321f..c668fc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,9 @@ byteorder = "1.0" [dev-dependencies] wabt = "0.1.2" + +[features] +# 32-bit platforms are not supported and not tested. Use this flag if you really want to use +# wasmi on these platforms. +# See https://github.com/pepyakin/wasmi/issues/43 +32bit_opt_in = [] diff --git a/src/lib.rs b/src/lib.rs index 7d69caf..b21745a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -101,6 +101,12 @@ extern crate wabt; extern crate parity_wasm; extern crate byteorder; +#[cfg(all(not(feature = "32bit_opt_in"), target_pointer_width = "32"))] +compile_error! {"32-bit targets are not supported at the moment. +You can use '32bit_opt_in' feature. +See https://github.com/pepyakin/wasmi/issues/43" +} + use std::fmt; use std::error; use std::collections::HashMap; @@ -127,9 +133,9 @@ impl Trap { } /// Error type which can thrown by wasm code or by host environment. -/// +/// /// See [`Trap`] for details. -/// +/// /// [`Trap`]: struct.Trap.html #[derive(Debug)] pub enum TrapKind { @@ -231,9 +237,9 @@ pub enum Error { impl Error { /// Returns [`HostError`] if this `Error` represents some host error. - /// + /// /// I.e. if this error have variant [`Host`] or [`Trap`][`Trap`] with [host][`TrapKind::Host`] error. - /// + /// /// [`HostError`]: trait.HostError.html /// [`Host`]: enum.Error.html#variant.Host /// [`Trap`]: enum.Error.html#variant.Trap