Enum ValidationError

Source
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.

Fields

§min: u32
§max: u32
§

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

Fields

§alignment: u32
§minimum_required_alignment: u32
§

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.

Fields

§table_ty: RefType
§elem_ty: RefType
§

MismatchedRefTypesDuringTableCopy

A table.copy instruction referenced two tables that store different reference types.

Fields

§source_table_ty: RefType
§destination_table_ty: RefType
§

MismatchedRefTypesOnValidationStack

An expected reference type did not match the actual reference type on the validation stack.

Fields

§expected: RefType
§actual: RefType
§

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

Source

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

Source§

fn clone(&self) -> ValidationError

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ValidationError> for Error

Source§

fn from(value: ValidationError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ValidationError

Source§

fn eq(&self, other: &ValidationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ValidationError

Source§

impl StructuralPartialEq for ValidationError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.