From be5169a25fb00b95b82dbc4dd515ead03db3b802 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 5 Feb 2018 20:38:17 +0300 Subject: [PATCH] Fixes --- src/func.rs | 4 ++-- src/lib.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/func.rs b/src/func.rs index 90566f8..f887195 100644 --- a/src/func.rs +++ b/src/func.rs @@ -132,10 +132,10 @@ impl FuncInstance { /// # Errors /// /// Returns `Err` if `args` types is not match function [`signature`] or - /// if [`TrapKind`] at execution time occured. + /// if [`Trap`] at execution time occured. /// /// [`signature`]: #method.signature - /// [`TrapKind`]: #enum.TrapKind.html + /// [`Trap`]: #enum.Trap.html pub fn invoke( func: &FuncRef, args: &[RuntimeValue], diff --git a/src/lib.rs b/src/lib.rs index 239e49a..dc1aed3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,9 +127,10 @@ impl Trap { } /// Error type which can thrown by wasm code or by host environment. -/// -/// Under some conditions, wasm execution may produce a `TrapKind`, which immediately aborts execution. -/// TrapKinds can't be handled by WebAssembly code, but are reported to the embedder. +/// +/// See [`Trap`] for details. +/// +/// [`Trap`]: struct.Trap.html #[derive(Debug)] pub enum TrapKind { /// Wasm code executed `unreachable` opcode. @@ -275,7 +276,7 @@ impl fmt::Display for Error { Error::Memory(ref s) => write!(f, "Memory: {}", s), Error::Global(ref s) => write!(f, "Global: {}", s), Error::Value(ref s) => write!(f, "Value: {}", s), - Error::Trap(ref s) => write!(f, "TrapKind: {:?}", s), + Error::Trap(ref s) => write!(f, "Trap: {:?}", s), Error::Host(ref e) => write!(f, "User: {}", e), } } @@ -291,7 +292,7 @@ impl error::Error for Error { Error::Memory(ref s) => s, Error::Global(ref s) => s, Error::Value(ref s) => s, - Error::Trap(_) => "TrapKind", + Error::Trap(_) => "Trap", Error::Host(_) => "Host error", } }