diff --git a/src/lib.rs b/src/lib.rs index 467b59e..cb83ec9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -169,15 +169,6 @@ pub enum TrapKind { /// This typically can happen when `call_indirect` is executed. ElemUninitialized, - /// Attempt to `call_indirect` function with mismatched [signature][`Signature`]. - /// - /// `call_indirect` always specifies the expected signature of function. - /// If `call_indirect` is executed with index that points on function with - /// signature different that is expected by this `call_indirect`, this trap is raised. - /// - /// [`Signature`]: struct.Signature.html - ElemSignatureMismatch, - /// Attempt to divide by zero. /// /// This trap typically can happen if `div` or `rem` is executed with @@ -199,10 +190,17 @@ pub enum TrapKind { /// Extensive inlining might also be the cause of stack overflow. StackOverflow, - /// Unexpected signature provided. + /// Attempt to invoke a function with mismatching signature. /// /// This can happen if [`FuncInstance`] was invoked - /// with mismatching signature. + /// with mismatching [signature][`Signature`]. + /// + /// This can always happen with indirect calls. `call_indirect` instruction always + /// specifies the expected signature of function. If `call_indirect` is executed + /// with index that points on function with signature different that is + /// expected by this `call_indirect`, this trap is raised. + /// + /// [`Signature`]: struct.Signature.html UnexpectedSignature, /// Error specified by the host. diff --git a/src/runner.rs b/src/runner.rs index 4f194c2..3e069a5 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -462,7 +462,7 @@ impl<'a, E: Externals> Interpreter<'a, E> { .expect("Due to validation type should exists"); if &*required_function_type != actual_function_type { - return Err(TrapKind::ElemSignatureMismatch); + return Err(TrapKind::UnexpectedSignature); } }