Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more specific errors in src/librustc/mir/interpret/error.rs #60951

Merged
merged 4 commits into from
Jul 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ pub enum InterpError<'tcx, O> {
DanglingPointerDeref,
DoubleFree,
InvalidMemoryAccess,
FunctionPointerTyMismatch(FnSig<'tcx>, FnSig<'tcx>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't here before this PR, maybe a rebase gone wrong?

InvalidFunctionPointer,
InvalidBool,
InvalidDiscriminant(ScalarMaybeUndef),
Expand All @@ -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,
Expand All @@ -281,6 +284,29 @@ pub enum InterpError<'tcx, O> {
required: Align,
has: Align,
},
MemoryLockViolation {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these suddenly showed up in this PR

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,
Expand All @@ -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,
Expand All @@ -319,6 +340,16 @@ pub enum InterpError<'tcx, O> {
InfiniteLoop,
}

#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum EvalErrorPanic<'tcx, O> {
Panic,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs the fields of the old Panic variant from above.

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> {
Expand Down