Enum rustc_middle::mir::interpret::error::UndefinedBehaviorInfo [−][src]
pub enum UndefinedBehaviorInfo<'tcx> {
Show 27 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,
},
UninhabitedEnumVariantWritten,
}Expand description
Error information for when the program caused Undefined Behavior.
Variants
Ub(String)Free-form case. Only for errors that are never caught!
Tuple Fields of Ub
0: StringUnreachable code was executed.
A slice/array index projection went out-of-bounds.
Something was divided by 0 (x / 0).
Something was “remainded” by 0 (x % 0).
Overflowing inbounds pointer arithmetic.
InvalidMeta(&'static str)Invalid metadata in a wide pointer (using str to avoid allocations).
Tuple Fields of InvalidMeta
0: &'static strInvalidVtableDropFn(FnSig<'tcx>)Invalid drop function in vtable.
Tuple Fields of InvalidVtableDropFn
0: FnSig<'tcx>Invalid size in a vtable: too large.
InvalidVtableAlignment(String)Invalid alignment in a vtable: too large, or not a power of 2.
Tuple Fields of InvalidVtableAlignment
0: StringUnterminatedCString(Pointer)Reading a C string that does not end within its allocation.
Tuple Fields of UnterminatedCString
0: PointerPointerUseAfterFree(AllocId)Dereferencing a dangling pointer after it got freed.
Tuple Fields of PointerUseAfterFree
0: AllocIdUsed 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
DanglingIntPointer(u64, CheckInAllocMsg)Using an integer as a pointer in the wrong way.
Tuple Fields of DanglingIntPointer
0: u641: CheckInAllocMsgUsed a pointer with bad alignment.
WriteToReadOnly(AllocId)Writing to read-only memory.
Tuple Fields of WriteToReadOnly
0: AllocIdDerefFunctionPointer(AllocId)Tuple Fields of DerefFunctionPointer
0: AllocIdThe 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
InvalidBool(u8)Using a non-boolean u8 as bool.
Tuple Fields of InvalidBool
0: u8InvalidChar(u32)Using a non-character u32 as character.
Tuple Fields of InvalidChar
0: u32InvalidTag(Scalar)The tag of an enum does not encode an actual discriminant.
Tuple Fields of InvalidTag
0: ScalarInvalidFunctionPointer(Pointer)Using a pointer-not-to-a-function as function pointer.
Tuple Fields of InvalidFunctionPointer
0: PointerInvalidStr(Utf8Error)Using a string that is not valid UTF-8,
Tuple Fields of InvalidStr
0: Utf8ErrorInvalidUninitBytes(Option<(AllocId, UninitBytesAccess)>)Using uninitialized data where it is not allowed.
Tuple Fields of InvalidUninitBytes
Working with a local that is not currently live.
Data size is not equal to target size.
A discriminant of an uninhabited enum variant is written.
Trait Implementations
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
Layout
Note: Most layout information is completely unstable and may even differ between compilations. 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
Size for each variant:
Ub: 31 bytesUnreachable: 0 bytesBoundsCheckFailed: 23 bytesDivisionByZero: 0 bytesRemainderByZero: 0 bytesPointerArithOverflow: 0 bytesInvalidMeta: 23 bytesInvalidVtableDropFn: 23 bytesInvalidVtableSize: 0 bytesInvalidVtableAlignment: 31 bytesUnterminatedCString: 23 bytesPointerUseAfterFree: 15 bytesPointerOutOfBounds: 39 bytesDanglingIntPointer: 15 bytesAlignmentCheckFailed: 2 bytesWriteToReadOnly: 15 bytesDerefFunctionPointer: 15 bytesValidationFailure: 55 bytesInvalidBool: 1 byteInvalidChar: 7 bytesInvalidTag: 31 bytesInvalidFunctionPointer: 23 bytesInvalidStr: 23 bytesInvalidUninitBytes: 47 bytesDeadLocal: 0 bytesScalarSizeMismatch: 23 bytesUninhabitedEnumVariantWritten: 0 bytes