changing the fields of InterpError

This commit is contained in:
Saleem Jaffer 2019-07-25 16:59:38 +05:30
parent 8b94e9e918
commit 0aa9658f5d

View File

@ -309,8 +309,30 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum InvalidProgramMessage<'tcx> {
/// Resolution can fail if we are in a too generic context
TooGeneric,
/// Cannot compute this constant because it depends on another one
/// which already produced an error
ReferencedConstant,
/// Abort in case type errors are reached
TypeckError,
}
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum InterpError<'tcx> {
/// The program caused undefined behavior.
UndefinedBehaviour(UndefinedBehaviourMessage<'tcx>),
/// The program did something the interpreter does not support (some of these *might* be UB
/// but the interpreter is not sure).
Unsupported(UnsupportedMessage<'tcx>),
/// The program was invalid (ill-typed, not sufficiently monomorphized, ...).
InvalidProgram(InvalidProgramMessage<'tcx>),
/// The program exhausted the interpreter's resources (stack/heap too big,
/// execution takes too long, ..).
ResourceExhaustion(ResourceExhaustionMessage<'tcx>),
/// This variant is used by machines to signal their own errors that do not
/// match an existing variant.
MachineError(String),
@ -374,18 +396,11 @@ pub enum InterpError<'tcx> {
HeapAllocZeroBytes,
HeapAllocNonPowerOfTwoAlignment(u64),
Unreachable,
/// The program panicked.
Panic(PanicMessage<u64>),
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,
/// Cannot compute this constant because it depends on another one
/// which already produced an error
ReferencedConstant,
InfiniteLoop,
}
pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;