[−][src]Enum rustc_mir::interpret::UndefinedBehaviorInfo

pub enum UndefinedBehaviorInfo<'tcx> {
    Ub(String),
    Unreachable,
    BoundsCheckFailed {
        len: u64,
        index: u64,
    },
    DivisionByZero,
    RemainderByZero,
    PointerArithOverflow,
    InvalidMeta(&'static str),
    InvalidDropFn(FnSig<'tcx>),
    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(String),
    InvalidBool(u8),
    InvalidChar(u32),
    InvalidTag(Scalar<()>),
    InvalidFunctionPointer(Pointer<()>),
    InvalidStr(Utf8Error),
    InvalidUninitBytes(Option<Box<UninitBytesAccess, Global>>),
    DeadLocal,
    ScalarSizeMismatch {
        target_size: u64,
        data_size: u64,
    },
}

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.

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

InvalidDropFn(FnSig<'tcx>)

Invalid drop function in vtable.

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.

Fields of PointerOutOfBounds

ptr: Pointer<()>msg: CheckInAllocMsgallocation_size: Size
DanglingIntPointer(u64, CheckInAllocMsg)

Using an integer as a pointer in the wrong way.

AlignmentCheckFailed

Used a pointer with bad alignment.

Fields of AlignmentCheckFailed

required: Alignhas: Align
WriteToReadOnly(AllocId)

Writing to read-only memory.

DerefFunctionPointer(AllocId)
ValidationFailure(String)

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.

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<Box<UninitBytesAccess, Global>>)

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.

Fields of ScalarSizeMismatch

target_size: u64data_size: u64

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for UndefinedBehaviorInfo<'tcx>

impl<'tcx> !Send for UndefinedBehaviorInfo<'tcx>

impl<'tcx> !Sync for UndefinedBehaviorInfo<'tcx>

impl<'tcx> Unpin for UndefinedBehaviorInfo<'tcx>

impl<'tcx> !UnwindSafe for UndefinedBehaviorInfo<'tcx>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]