Last active
August 19, 2018 17:13
-
-
Save TheDarkula/d5993ff5ec66338ad6063db044068f9f to your computer and use it in GitHub Desktop.
Making enums more specific in src/librustc/mir/interpret/error.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone, RustcEncodable, RustcDecodable)] | |
pub enum EvalErrorKind<'tcx, O> { | |
/// This variant is used by machines to signal their own errors that do not | |
/// match an existing variant | |
MachineError(String), | |
FunctionPointerTyMismatch(FnSig<'tcx>, FnSig<'tcx>), | |
NoMirFor(String), | |
UnterminatedCString(Pointer), | |
DanglingPointerDeref, | |
DoubleFree, | |
InvalidMemoryAccess, | |
InvalidFunctionPointer, | |
InvalidBool, | |
InvalidDiscriminant, | |
PointerOutOfBounds { | |
ptr: Pointer, | |
access: bool, | |
allocation_size: Size, | |
}, | |
InvalidNullPointerUsage, | |
ReadPointerAsBytes, | |
ReadBytesAsPointer, | |
ReadForeignStatic, | |
InvalidPointerMath, | |
ReadUndefBytes, | |
DeadLocal, | |
InvalidBoolOp(mir::BinOp), | |
Unimplemented(String), | |
DerefFunctionPointer, | |
ExecuteMemory, | |
Intrinsic(String), | |
InvalidChar(u128), | |
StackFrameLimitReached, | |
OutOfTls, | |
TlsOutOfBounds, | |
AbiViolation(String), | |
AlignmentCheckFailed { | |
required: Align, | |
has: Align, | |
}, | |
MemoryLockViolation { | |
ptr: Pointer, | |
len: u64, | |
frame: usize, | |
access: AccessKind, | |
lock: Lock, | |
}, | |
MemoryAcquireConflict { | |
ptr: Pointer, | |
len: u64, | |
kind: AccessKind, | |
lock: Lock, | |
}, | |
InvalidMemoryLockRelease { | |
ptr: Pointer, | |
len: u64, | |
frame: usize, | |
lock: Lock, | |
}, | |
DeallocatedLockedMemory { | |
ptr: Pointer, | |
lock: Lock, | |
}, | |
ValidationFailure(String), | |
CalledClosureAsFunction, | |
VtableForArgumentlessMethod, | |
ModifiedConstantMemory, | |
AssumptionNotHeld, | |
InlineAsm, | |
TypeNotPrimitive(Ty<'tcx>), | |
ReallocatedWrongMemoryKind(String, String), | |
DeallocatedWrongMemoryKind(String, String), | |
ReallocateNonBasePtr, | |
DeallocateNonBasePtr, | |
IncorrectAllocationInformation(Size, Size, Align, Align), | |
Layout(layout::LayoutError<'tcx>), | |
HeapAllocZeroBytes, | |
HeapAllocNonPowerOfTwoAlignment(u64), | |
Unreachable, | |
Panic(EvalErrorPanic), | |
ReadFromReturnPointer, | |
PathNotFound(Vec<String>), | |
UnimplementedTraitSelection, | |
/// Abort in case type errors are reached | |
TypeckError, | |
/// Resolution can fail if we are in a too generic context | |
TooGeneric, | |
CheckMatchError, | |
/// Cannot compute this constant because it depends on another one | |
/// which already produced an error | |
ReferencedConstant(Lrc<ConstEvalErr<'tcx>>), | |
GeneratorResumedAfterReturn, | |
GeneratorResumedAfterPanic, | |
InfiniteLoop, | |
} | |
#[derive(Clone, RustcEncodable, RustcDecodable)] | |
pub enum EvalErrorPanic<'tcx, O> { | |
Panic, | |
BoundsCheck { len: O, index: O }, | |
Overflow(mir::BinOp), | |
OverflowNeg, | |
DivisionByZero, | |
RemainderByZero, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment