Skip to main content

ValidationErrorKind

Enum ValidationErrorKind 

Source
#[non_exhaustive]
pub enum ValidationErrorKind {
Show 46 variants DuplicateName { name: String, }, EmptyName, UnknownSignature { sig: SigId, }, UnknownFunction { func: FuncId, }, UnknownGlobal { global: GlobalId, }, UnknownAggregate { agg: AggId, }, BadAggregate { agg: AggId, }, BadAlignment { align: u64, }, BadGlobal { global: GlobalId, }, MissingBody, ImportWithBody, BadEntry, EntryParams { expected: usize, found: usize, }, MissingTerminator, BadBlockTarget { target: Block, }, EntryBranchTarget, CorruptLayout, ValueOutOfRange { value: Value, }, InconsistentDefinition { value: Value, }, DefinedTwice { value: Value, }, UseOfDetached { value: Value, }, BadAlias { value: Value, }, UseBeforeDef { value: Value, }, BadSlot { slot: StackSlot, }, TypeMismatch { value: Option<Value>, expected: Type, found: Type, }, BadOperandType { op: &'static str, found: Type, }, BadConversion { op: &'static str, from: Type, to: Type, }, PolicyMismatch { op: &'static str, required: PolicyFields, }, ErrorOutsideCheck { op: &'static str, }, NotFallible { op: &'static str, }, BadConst { ty: Type, bits: u64, }, BadField { agg: AggId, field: u32, }, BadOrdering, ResultMismatch, ArgCount { expected: usize, found: usize, }, EdgeArgCount { target: Block, expected: usize, found: usize, }, BadSwitchCase { value: u64, }, BadTailCall, BadGcList, BadEdgeArg, LandingPadPredecessor { block: Block, }, UnwindInNounwind, ReturnInNoreturn, SafepointInNogc, LiveAcrossSafepoint { value: Value, }, DerivedPointerEscapes { value: Value, },
}
Expand description

What is wrong, for a ValidationError (and for a BuildError::Invalid).

The enum is #[non_exhaustive]: new checks may add variants in a minor release.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

DuplicateName

Two symbols share a name.

Fields

§name: String

The name.

§

EmptyName

A symbol name is empty.

§

UnknownSignature

A signature handle is out of range.

Fields

§sig: SigId

The handle.

§

UnknownFunction

A function handle is out of range.

Fields

§func: FuncId

The handle.

§

UnknownGlobal

A global handle is out of range.

Fields

§global: GlobalId

The handle.

§

UnknownAggregate

An aggregate handle is out of range, or names a later aggregate.

Fields

§agg: AggId

The handle.

§

BadAggregate

An aggregate’s recorded layout is inconsistent or too large.

Fields

§agg: AggId

The aggregate.

§

BadAlignment

An alignment is not a supported power of two.

Fields

§align: u64

The alignment.

§

BadGlobal

A global’s initializer or relocations are inconsistent with its size or linkage.

Fields

§global: GlobalId

The global.

§

MissingBody

A defined (local or exported) function has no body.

§

ImportWithBody

An imported function has a body.

§

BadEntry

The entry block handle is out of range or the block was removed.

§

EntryParams

The entry block’s parameters do not match the signature’s parameters.

Fields

§expected: usize

The signature’s parameter types count.

§found: usize

The entry block’s parameter count.

§

MissingTerminator

A block has no terminator.

§

BadBlockTarget

An edge targets a block that does not exist or was removed.

Fields

§target: Block

The target.

§

EntryBranchTarget

An edge targets the entry block, which must have no predecessors.

§

CorruptLayout

The block’s instruction list is corrupt (a link is out of range, points into another block, or loops).

§

ValueOutOfRange

A value handle is out of range.

Fields

§value: Value

The handle.

§

InconsistentDefinition

A value’s recorded definition disagrees with the block parameter list or the instruction result range that lists it.

Fields

§value: Value

The value.

§

DefinedTwice

A value is listed as defined at two sites.

Fields

§value: Value

The value.

§

UseOfDetached

A value whose definition was removed is still used.

Fields

§value: Value

The value.

§

BadAlias

A value’s forwarding (from replace_all_uses) is inconsistent: it loops or changes type.

Fields

§value: Value

The value.

§

UseBeforeDef

A value is used where its definition does not dominate the use.

Fields

§value: Value

The value.

§

BadSlot

A stack slot handle is out of range, or a slot has a bad size or alignment.

Fields

§slot: StackSlot

The slot.

§

TypeMismatch

A value has the wrong type for its position.

Fields

§value: Option<Value>

The value (or None for a terminator-produced edge argument).

§expected: Type

The required type.

§found: Type

The actual type.

§

BadOperandType

An operand’s type is not one the operation accepts.

Fields

§op: &'static str

The operation’s opcode.

§found: Type

The operand’s type.

§

BadConversion

A conversion between these types is not allowed for this conversion op.

Fields

§op: &'static str

The conversion’s opcode.

§from: Type

The source type.

§to: Type

The result type.

§

PolicyMismatch

An operation instance does not carry exactly the policy fields it needs.

Fields

§op: &'static str

The operation’s opcode.

§required: PolicyFields

The fields it must carry.

§

ErrorOutsideCheck

An operation that can raise an error appears as a plain instruction; it must be the operation of a check terminator. Fallible means: a policy field is error; char_from_u32; or, on a signed integer type, pow under any overflow policy (a negative exponent) or shl/shr under shift = saturate (a negative amount). BinaryOp::can_error, UnaryOp::can_error, and ConvOp::can_error are the rule.

Fields

§op: &'static str

The opcode.

§

NotFallible

A check terminator holds an operation that cannot raise an error, or an instruction that is not a unary, binary, or conversion operation.

Fields

§op: &'static str

The opcode.

§

BadConst

A constant’s bits do not fit its type (or a ptr/ref constant is not 0).

Fields

§ty: Type

The type.

§bits: u64

The bits.

§

BadField

A struct field index is out of range, or the aggregate is not a struct.

Fields

§agg: AggId

The aggregate.

§field: u32

The field index.

§

BadOrdering

An atomic operation has an ordering it may not have.

§

ResultMismatch

An instruction’s recorded result values disagree with what it produces (count or types).

§

ArgCount

A call passes the wrong number of arguments, or a return passes the wrong number of values.

Fields

§expected: usize

The required count.

§found: usize

The supplied count.

§

EdgeArgCount

An edge passes the wrong number of arguments for its target’s parameters.

Fields

§target: Block

The target block.

§expected: usize

The target’s parameter count.

§found: usize

The supplied count.

§

BadSwitchCase

A switch has two cases with the same value, or a case value does not fit the scrutinee’s type.

Fields

§value: u64

The case value.

§

BadTailCall

A tail call’s callee returns or convention differ from this function’s, or a tail call carries a GC list.

§

BadGcList

A GC list entry is not a ref, or a nogc call carries a GC list.

§

BadEdgeArg

An edge argument is a Result, Exception, or ErrorCode where that kind is not allowed, or a Result index is out of range.

§

LandingPadPredecessor

A landing pad (the target of an unwind edge) also has a non-unwind predecessor, or an invoke’s normal and unwind edges target one block.

Fields

§block: Block

The landing pad.

§

UnwindInNounwind

A nounwind function contains a resume, or a call that may unwind without an invoke.

§

ReturnInNoreturn

A noreturn function contains a ret.

§

SafepointInNogc

A nogc function contains a safepoint.

§

LiveAcrossSafepoint

A ref value, or a pointer derived from one, is live across a safepoint without being relocated through its GC list.

Fields

§value: Value

The value.

§

DerivedPointerEscapes

A pointer derived from a ref escapes tracking: it is stored to memory or passed to a call that is a safepoint.

Fields

§value: Value

The value.

Trait Implementations§

Source§

impl Clone for ValidationErrorKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationErrorKind

Source§

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

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

impl Display for ValidationErrorKind

Source§

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

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

impl Eq for ValidationErrorKind

Source§

impl From<ValidationErrorKind> for BuildError

Source§

fn from(kind: ValidationErrorKind) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ValidationErrorKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ValidationErrorKind

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.