Merge signature mismatch traps (#57)
This commit is contained in:
parent
863f2247a3
commit
6cf6a31970
20
src/lib.rs
20
src/lib.rs
|
@ -169,15 +169,6 @@ pub enum TrapKind {
|
||||||
/// This typically can happen when `call_indirect` is executed.
|
/// This typically can happen when `call_indirect` is executed.
|
||||||
ElemUninitialized,
|
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.
|
/// Attempt to divide by zero.
|
||||||
///
|
///
|
||||||
/// This trap typically can happen if `div` or `rem` is executed with
|
/// 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.
|
/// Extensive inlining might also be the cause of stack overflow.
|
||||||
StackOverflow,
|
StackOverflow,
|
||||||
|
|
||||||
/// Unexpected signature provided.
|
/// Attempt to invoke a function with mismatching signature.
|
||||||
///
|
///
|
||||||
/// This can happen if [`FuncInstance`] was invoked
|
/// 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,
|
UnexpectedSignature,
|
||||||
|
|
||||||
/// Error specified by the host.
|
/// Error specified by the host.
|
||||||
|
|
|
@ -462,7 +462,7 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
.expect("Due to validation type should exists");
|
.expect("Due to validation type should exists");
|
||||||
|
|
||||||
if &*required_function_type != actual_function_type {
|
if &*required_function_type != actual_function_type {
|
||||||
return Err(TrapKind::ElemSignatureMismatch);
|
return Err(TrapKind::UnexpectedSignature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue