Enum rustc_middle::mir::interpret::error::UndefinedBehaviorInfo[−][src]

pub enum UndefinedBehaviorInfo<'tcx> {
Show variants Ub(String), Unreachable, BoundsCheckFailed { len: u64, index: u64, }, DivisionByZero, RemainderByZero, PointerArithOverflow, InvalidMeta(&'static str), InvalidVtableDropFn(FnSig<'tcx>), InvalidVtableSize, InvalidVtableAlignment(String), UnterminatedCString(Pointer), PointerUseAfterFree(AllocId), PointerOutOfBounds { ptr: Pointer, msg: CheckInAllocMsg, allocation_size: Size, }, DanglingIntPointer(u64, CheckInAllocMsg), AlignmentCheckFailed { required: Align, has: Align, }, WriteToReadOnly(AllocId), DerefFunctionPointer(AllocId), ValidationFailure { path: Option<String>, msg: String, }, InvalidBool(u8), InvalidChar(u32), InvalidTag(Scalar), InvalidFunctionPointer(Pointer), InvalidStr(Utf8Error), InvalidUninitBytes(Option<(AllocId, UninitBytesAccess)>), DeadLocal, ScalarSizeMismatch { target_size: u64, data_size: u64, },
}
Expand description

Error information for when the program caused Undefined Behavior.

Variants

Ub(String)

Free-form case. Only for errors that are never caught!

Unreachable

Unreachable code was executed.

BoundsCheckFailed

A slice/array index projection went out-of-bounds.

Show fields

Fields of BoundsCheckFailed

len: u64index: u64
DivisionByZero

Something was divided by 0 (x / 0).

RemainderByZero

Something was “remainded” by 0 (x % 0).

PointerArithOverflow

Overflowing inbounds pointer arithmetic.

InvalidMeta(&'static str)

Invalid metadata in a wide pointer (using str to avoid allocations).

InvalidVtableDropFn(FnSig<'tcx>)

Invalid drop function in vtable.

InvalidVtableSize

Invalid size in a vtable: too large.

InvalidVtableAlignment(String)

Invalid alignment in a vtable: too large, or not a power of 2.

UnterminatedCString(Pointer)

Reading a C string that does not end within its allocation.

PointerUseAfterFree(AllocId)

Dereferencing a dangling pointer after it got freed.

PointerOutOfBounds

Used a pointer outside the bounds it is valid for.

Show fields

Fields of PointerOutOfBounds

ptr: Pointermsg: CheckInAllocMsgallocation_size: Size
DanglingIntPointer(u64, CheckInAllocMsg)

Using an integer as a pointer in the wrong way.

AlignmentCheckFailed

Used a pointer with bad alignment.

Show fields

Fields of AlignmentCheckFailed

required: Alignhas: Align
WriteToReadOnly(AllocId)

Writing to read-only memory.

DerefFunctionPointer(AllocId)
ValidationFailure

The value validity check found a problem. Should only be thrown by validity.rs and always point out which part of the value is the problem.

Show fields

Fields of ValidationFailure

path: Option<String>

The “path” to the value in question, e.g. .0[5].field for a struct field in the 6th element of an array that is the first element of a tuple.

msg: String
InvalidBool(u8)

Using a non-boolean u8 as bool.

InvalidChar(u32)

Using a non-character u32 as character.

InvalidTag(Scalar)

The tag of an enum does not encode an actual discriminant.

InvalidFunctionPointer(Pointer)

Using a pointer-not-to-a-function as function pointer.

InvalidStr(Utf8Error)

Using a string that is not valid UTF-8,

InvalidUninitBytes(Option<(AllocId, UninitBytesAccess)>)

Using uninitialized data where it is not allowed.

DeadLocal

Working with a local that is not currently live.

ScalarSizeMismatch

Data size is not equal to target size.

Show fields

Fields of ScalarSizeMismatch

target_size: u64data_size: u64

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may be different between compiler versions and platforms. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 56 bytes