tries to refactor InterpError in mir

This commit is contained in:
Saleem Jaffer 2019-07-18 14:52:30 +05:30
parent efb7457915
commit 589f6a7dc6

View file

@ -247,6 +247,7 @@ pub enum InterpError<'tcx, O> {
DanglingPointerDeref,
DoubleFree,
InvalidMemoryAccess,
FunctionPointerTyMismatch(FnSig<'tcx>, FnSig<'tcx>),
InvalidFunctionPointer,
InvalidBool,
InvalidDiscriminant(ScalarMaybeUndef),
@ -266,11 +267,13 @@ pub enum InterpError<'tcx, O> {
Unimplemented(String),
DerefFunctionPointer,
ExecuteMemory,
// asd
BoundsCheck { len: O, index: O },
Overflow(mir::BinOp),
OverflowNeg,
DivisionByZero,
RemainderByZero,
// asd
Intrinsic(String),
InvalidChar(u128),
StackFrameLimitReached,
@ -281,6 +284,29 @@ pub enum InterpError<'tcx, O> {
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,
@ -298,12 +324,7 @@ pub enum InterpError<'tcx, O> {
HeapAllocZeroBytes,
HeapAllocNonPowerOfTwoAlignment(u64),
Unreachable,
Panic {
msg: Symbol,
line: u32,
col: u32,
file: Symbol,
},
Panic(EvalErrorPanic<'tcx, O>),
ReadFromReturnPointer,
PathNotFound(Vec<String>),
UnimplementedTraitSelection,
@ -319,6 +340,16 @@ pub enum InterpError<'tcx, O> {
InfiniteLoop,
}
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum EvalErrorPanic<'tcx, O> {
Panic,
BoundsCheck { len: O, index: O },
Overflow(mir::BinOp),
OverflowNeg,
DivisionByZero,
RemainderByZero,
}
pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;
impl<'tcx, O> InterpError<'tcx, O> {