disable std::error in no_std

This commit is contained in:
Julius Rakow 2018-08-25 00:43:42 +02:00
parent f4173ad8ca
commit 33a0e6ec4c
No known key found for this signature in database
GPG Key ID: 9AABD9B859435A93
3 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#[cfg(feature = "std")]
use std::error;
use std::fmt;
@ -11,6 +12,7 @@ impl fmt::Display for Error {
}
}
#[cfg(feature = "std")]
impl error::Error for Error {
fn description(&self) -> &str {
&self.0

View File

@ -110,6 +110,7 @@ extern crate memory_units as memory_units_crate;
pub extern crate nan_preserving_float;
use std::fmt;
#[cfg(feature = "std")]
use std::error;
/// Error type which can be thrown by wasm code or by host environment.
@ -139,6 +140,7 @@ impl fmt::Display for Trap {
}
}
#[cfg(feature = "std")]
impl error::Error for Trap {
fn description(&self) -> &str {
"runtime trap"
@ -309,6 +311,7 @@ impl fmt::Display for Error {
}
}
#[cfg(feature = "std")]
impl error::Error for Error {
fn description(&self) -> &str {
match *self {

View File

@ -1,3 +1,4 @@
#[cfg(feature = "std")]
use std::error;
use std::fmt;
use hashmap_core::HashSet;
@ -27,6 +28,7 @@ impl fmt::Display for Error {
}
}
#[cfg(feature = "std")]
impl error::Error for Error {
fn description(&self) -> &str {
&self.0