pub enum ValidationError {
Show 60 variants
InvalidMagic,
InvalidBinaryFormatVersion,
Eof,
MalformedUtf8(Utf8Error),
MalformedSectionTypeDiscriminator(u8),
MalformedNumTypeDiscriminator(u8),
MalformedVecTypeDiscriminator(u8),
MalformedFuncTypeDiscriminator(u8),
MalformedRefTypeDiscriminator(u8),
MalformedValType,
MalformedExportDescDiscriminator(u8),
MalformedImportDescDiscriminator(u8),
MalformedLimitsDiscriminator(u8),
MalformedLimitsMinLargerThanMax {
min: u32,
max: u32,
},
MalformedMutDiscriminator(u8),
MalformedBlockTypeTypeIdx(i64),
MalformedVariableLengthInteger,
MalformedElemKindDiscriminator(u8),
InvalidTypeIdx(usize),
InvalidFuncIdx(usize),
InvalidTableIdx(usize),
InvalidMemIndex(usize),
InvalidGlobalIdx(usize),
InvalidElemIdx(usize),
InvalidDataIdx(usize),
InvalidLocalIdx(usize),
InvalidLabelIdx(usize),
InvalidLaneIdx(u8),
SectionOutOfOrder(SectionTy),
InvalidCustomSectionLength,
ExprMissingEnd,
InvalidInstr(u8),
InvalidMultiByteInstr(u8, u32),
EndInvalidValueStack,
InvalidValidationStackValType(Option<ValType>),
InvalidValidationStackType(ValidationStackEntry),
ExpectedAnOperand,
MemoryTooLarge,
MutationOfConstGlobal,
ErroneousAlignment {
alignment: u32,
minimum_required_alignment: u32,
},
ValidationCtrlStackEmpty,
ElseWithoutMatchingIf,
IfWithoutMatchingElse,
MismatchedRefTypesDuringTableInit {
table_ty: RefType,
elem_ty: RefType,
},
MismatchedRefTypesDuringTableCopy {
source_table_ty: RefType,
destination_table_ty: RefType,
},
MismatchedRefTypesOnValidationStack {
expected: RefType,
actual: RefType,
},
IndirectCallToNonFuncRefTable(RefType),
ExpectedReferenceTypeOnStack(ValType),
ReferencingAnUnreferencedFunction(usize),
InvalidSelectTypeVectorLength(usize),
TooManyLocals(u64),
DuplicateExportName,
UnsupportedMultipleMemoriesProposal,
CodeExprHasTrailingInstructions,
FunctionAndCodeSectionsHaveDifferentLengths,
DataCountAndDataSectionsLengthAreDifferent,
InvalidImportType,
InvalidStartFunctionSignature,
ActiveElementSegmentTypeMismatch,
I33IsNegative,
}Variants§
InvalidMagic
The magic number at the start of the Wasm bytecode is invalid.
InvalidBinaryFormatVersion
The binary format version at the start of the Wasm bytecode is invalid.
Eof
The end of the binary file was reached unexpectedly.
MalformedUtf8(Utf8Error)
A UTF-8 string is malformed.
MalformedSectionTypeDiscriminator(u8)
The type of a section is malformed.
MalformedNumTypeDiscriminator(u8)
The discriminator of a number type is malformed.
MalformedVecTypeDiscriminator(u8)
The discriminator of a vector type is malformed.
MalformedFuncTypeDiscriminator(u8)
The discriminator of a function type is malformed.
MalformedRefTypeDiscriminator(u8)
The discriminator of a reference type is malformed.
MalformedValType
A valtype is malformed because it is neither a number, reference nor vector type.
MalformedExportDescDiscriminator(u8)
The discriminator of an export description is malformed.
MalformedImportDescDiscriminator(u8)
The discriminator of an import description is malformed.
MalformedLimitsDiscriminator(u8)
The discriminator of a limits type is malformed.
MalformedLimitsMinLargerThanMax
The min field of a limits type is larger than the max field.
MalformedMutDiscriminator(u8)
The discriminator of a mut type is malformed.
MalformedBlockTypeTypeIdx(i64)
Block types use a special 33-bit signed integer for encoding type indices.
MalformedVariableLengthInteger
A variable-length integer was read but it overflowed.
MalformedElemKindDiscriminator(u8)
The discriminator of an element kind is malformed.
InvalidTypeIdx(usize)
An index for a type is invalid.
InvalidFuncIdx(usize)
An index for a function is invalid.
InvalidTableIdx(usize)
An index for a table is invalid.
InvalidMemIndex(usize)
An index for a memory is invalid.
InvalidGlobalIdx(usize)
An index for a global is invalid.
InvalidElemIdx(usize)
An index for an element segment is invalid.
InvalidDataIdx(usize)
An index for a data segment is invalid.
InvalidLocalIdx(usize)
An index for a local is invalid.
InvalidLabelIdx(usize)
An index for a label is invalid.
InvalidLaneIdx(u8)
An index for a lane of some vector type is invalid.
SectionOutOfOrder(SectionTy)
A section with given type is out of order. All section types have a fixed order in which they must occur.
InvalidCustomSectionLength
A custom section contains more bytes than its section header specifies.
ExprMissingEnd
InvalidInstr(u8)
InvalidMultiByteInstr(u8, u32)
EndInvalidValueStack
InvalidValidationStackValType(Option<ValType>)
InvalidValidationStackType(ValidationStackEntry)
ExpectedAnOperand
MemoryTooLarge
The memory size specified by a mem type exceeds the maximum size.
MutationOfConstGlobal
An attempt has been made to mutate a const global
ErroneousAlignment
An alignment of some memory instruction is invalid
ValidationCtrlStackEmpty
The validation control stack is empty, even though an entry was expected.
ElseWithoutMatchingIf
An else instruction was found while not inside an if block.
IfWithoutMatchingElse
An end for a matching if instruction was found, but there was no else instruction in between.
MismatchedRefTypesDuringTableInit
A table.init instruction specified a table and an element segment that store different reference types.
MismatchedRefTypesDuringTableCopy
A table.copy instruction referenced two tables that store different reference types.
MismatchedRefTypesOnValidationStack
An expected reference type did not match the actual reference type on the validation stack.
IndirectCallToNonFuncRefTable(RefType)
An indirect call to a table with does not store function references was made.
ExpectedReferenceTypeOnStack(ValType)
A reference type was expected to be on the stack, but a value type was found.
ReferencingAnUnreferencedFunction(usize)
When a is referenced in the code section it must be contained in C.refs, which was not the case
InvalidSelectTypeVectorLength(usize)
The select instructions may work with multiple values in the future. However, as of now its vector may only have one element.
TooManyLocals(u64)
A function specifies too many locals, i.e. more than 2^32 - 1
DuplicateExportName
Multiple exports share the same name
UnsupportedMultipleMemoriesProposal
Multiple memories are not yet allowed without the proposal.
CodeExprHasTrailingInstructions
An expr in the code section has trailing instructions following its end instruction.
FunctionAndCodeSectionsHaveDifferentLengths
The lengths of the function and code sections must match.
DataCountAndDataSectionsLengthAreDifferent
The data count specified in the data count section and the length of the data section must match.
InvalidImportType
InvalidStartFunctionSignature
The function signature of the start function is invalid. It must not specify any parameters or return values.
ActiveElementSegmentTypeMismatch
An active element segment’s type and its table’s type are different.
I33IsNegative
33-bit signed integers are sometimes used to encode unsigned 32-bit integers to prevent collisions between bit patterns of different types. Therefore, 33-bit signed integers may never be negative.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn to_message(&self) -> &'static str
pub fn to_message(&self) -> &'static str
Convert this error to a message that is compatible with the error messages used by the official Wasm testsuite.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more