Enum miri::UndefinedBehaviorInfo
source · pub enum UndefinedBehaviorInfo<'tcx> {
Show 32 variants
Ub(String),
Custom(CustomSubdiagnostic<'tcx>),
ValidationError(ValidationErrorInfo<'tcx>),
Unreachable,
BoundsCheckFailed {
len: u64,
index: u64,
},
DivisionByZero,
RemainderByZero,
DivisionOverflow,
RemainderOverflow,
PointerArithOverflow,
InvalidMeta(InvalidMetaKind),
UnterminatedCString(Pointer<AllocId>),
PointerUseAfterFree(AllocId, CheckInAllocMsg),
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),
DerefVTablePointer(AllocId),
InvalidBool(u8),
InvalidChar(u32),
InvalidTag(Scalar<AllocId>),
InvalidFunctionPointer(Pointer<AllocId>),
InvalidVTablePointer(Pointer<AllocId>),
InvalidStr(Utf8Error),
InvalidUninitBytes(Option<(AllocId, BadBytesAccess)>),
DeadLocal,
ScalarSizeMismatch(ScalarSizeMismatch),
UninhabitedEnumVariantWritten(VariantIdx),
UninhabitedEnumVariantRead(VariantIdx),
AbiMismatchArgument {
caller_ty: Ty<'tcx>,
callee_ty: Ty<'tcx>,
},
AbiMismatchReturn {
caller_ty: Ty<'tcx>,
callee_ty: Ty<'tcx>,
},
}
Expand description
Error information for when the program caused Undefined Behavior.
Variants§
Ub(String)
Free-form case. Only for errors that are never caught! Used by miri
Custom(CustomSubdiagnostic<'tcx>)
A custom (free-form) fluent-translated error, created by err_ub_custom!
.
ValidationError(ValidationErrorInfo<'tcx>)
Validation error.
Unreachable
Unreachable code was executed.
BoundsCheckFailed
A slice/array index projection went out-of-bounds.
DivisionByZero
Something was divided by 0 (x / 0).
RemainderByZero
Something was “remainded” by 0 (x % 0).
DivisionOverflow
Signed division overflowed (INT_MIN / -1).
RemainderOverflow
Signed remainder overflowed (INT_MIN % -1).
PointerArithOverflow
Overflowing inbounds pointer arithmetic.
InvalidMeta(InvalidMetaKind)
Invalid metadata in a wide pointer
UnterminatedCString(Pointer<AllocId>)
Reading a C string that does not end within its allocation.
PointerUseAfterFree(AllocId, CheckInAllocMsg)
Using a pointer after it got freed.
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.)
DanglingIntPointer(u64, CheckInAllocMsg)
Using an integer as a pointer in the wrong way.
AlignmentCheckFailed
Used a pointer with bad alignment.
WriteToReadOnly(AllocId)
Writing to read-only memory.
DerefFunctionPointer(AllocId)
Trying to access the data behind a function pointer.
DerefVTablePointer(AllocId)
Trying to access the data behind a vtable pointer.
InvalidBool(u8)
Using a non-boolean u8
as bool.
InvalidChar(u32)
Using a non-character u32
as character.
InvalidTag(Scalar<AllocId>)
The tag of an enum does not encode an actual discriminant.
InvalidFunctionPointer(Pointer<AllocId>)
Using a pointer-not-to-a-function as function pointer.
InvalidVTablePointer(Pointer<AllocId>)
Using a pointer-not-to-a-vtable as vtable pointer.
InvalidStr(Utf8Error)
Using a string that is not valid UTF-8,
InvalidUninitBytes(Option<(AllocId, BadBytesAccess)>)
Using uninitialized data where it is not allowed.
DeadLocal
Working with a local that is not currently live.
ScalarSizeMismatch(ScalarSizeMismatch)
Data size is not equal to target size.
UninhabitedEnumVariantWritten(VariantIdx)
A discriminant of an uninhabited enum variant is written.
UninhabitedEnumVariantRead(VariantIdx)
An uninhabited enum variant is projected.
AbiMismatchArgument
ABI-incompatible argument types.
AbiMismatchReturn
ABI-incompatible return types.
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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: 112 bytes
Size for each variant:
Ub
: 32 bytesCustom
: 32 bytesValidationError
: 112 bytesUnreachable
: 0 bytesBoundsCheckFailed
: 24 bytesDivisionByZero
: 0 bytesRemainderByZero
: 0 bytesDivisionOverflow
: 0 bytesRemainderOverflow
: 0 bytesPointerArithOverflow
: 0 bytesInvalidMeta
: 2 bytesUnterminatedCString
: 24 bytesPointerUseAfterFree
: 24 bytesPointerOutOfBounds
: 48 bytesDanglingIntPointer
: 24 bytesAlignmentCheckFailed
: 3 bytesWriteToReadOnly
: 16 bytesDerefFunctionPointer
: 16 bytesDerefVTablePointer
: 16 bytesInvalidBool
: 2 bytesInvalidChar
: 8 bytesInvalidTag
: 32 bytesInvalidFunctionPointer
: 24 bytesInvalidVTablePointer
: 24 bytesInvalidStr
: 24 bytesInvalidUninitBytes
: 48 bytesDeadLocal
: 0 bytesScalarSizeMismatch
: 24 bytesUninhabitedEnumVariantWritten
: 8 bytesUninhabitedEnumVariantRead
: 8 bytesAbiMismatchArgument
: 24 bytesAbiMismatchReturn
: 24 bytes