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

pub enum UndefinedBehaviorInfo<'tcx> {
Show 26 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 { alloc_id: AllocId, alloc_size: Size, ptr_offset: i64, ptr_size: Size, msg: CheckInAllocMsg, }, 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

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

Tuple Fields of Ub

0: String
Unreachable

Unreachable code was executed.

BoundsCheckFailed

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

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

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

Tuple Fields of InvalidMeta

0: &'static str
InvalidVtableDropFn

Invalid drop function in vtable.

Tuple Fields of InvalidVtableDropFn

0: FnSig<'tcx>
InvalidVtableSize

Invalid size in a vtable: too large.

InvalidVtableAlignment

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

Tuple Fields of InvalidVtableAlignment

0: String
UnterminatedCString

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

Tuple Fields of UnterminatedCString

0: Pointer
PointerUseAfterFree

Dereferencing a dangling pointer after it got freed.

Tuple Fields of PointerUseAfterFree

0: AllocId
PointerOutOfBounds

Used a pointer outside the bounds it is valid for. (If ptr_size > 0, determines the size of the memory range that was expected to be in-bounds.)

Fields of PointerOutOfBounds

alloc_id: AllocIdalloc_size: Sizeptr_offset: i64ptr_size: Sizemsg: CheckInAllocMsg
DanglingIntPointer

Using an integer as a pointer in the wrong way.

Tuple Fields of DanglingIntPointer

0: u641: CheckInAllocMsg
AlignmentCheckFailed

Used a pointer with bad alignment.

Fields of AlignmentCheckFailed

required: Alignhas: Align
WriteToReadOnly

Writing to read-only memory.

Tuple Fields of WriteToReadOnly

0: AllocId
DerefFunctionPointer

Tuple Fields of DerefFunctionPointer

0: 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.

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

Using a non-boolean u8 as bool.

Tuple Fields of InvalidBool

0: u8
InvalidChar

Using a non-character u32 as character.

Tuple Fields of InvalidChar

0: u32
InvalidTag

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

Tuple Fields of InvalidTag

0: Scalar
InvalidFunctionPointer

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

Tuple Fields of InvalidFunctionPointer

0: Pointer
InvalidStr

Using a string that is not valid UTF-8,

Tuple Fields of InvalidStr

0: Utf8Error
InvalidUninitBytes

Using uninitialized data where it is not allowed.

Tuple Fields of InvalidUninitBytes

0: Option<(AllocId, UninitBytesAccess)>
DeadLocal

Working with a local that is not currently live.

ScalarSizeMismatch

Data size is not equal to target size.

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