Skip to content

Commit 0aa9658

Browse files
committed
changing the fields of InterpError
1 parent 8b94e9e commit 0aa9658

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

src/librustc/mir/interpret/error.rs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,30 @@ impl<O: fmt::Debug> fmt::Debug for PanicMessage<O> {
309309
}
310310
}
311311

312+
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
313+
pub enum InvalidProgramMessage<'tcx> {
314+
/// Resolution can fail if we are in a too generic context
315+
TooGeneric,
316+
/// Cannot compute this constant because it depends on another one
317+
/// which already produced an error
318+
ReferencedConstant,
319+
/// Abort in case type errors are reached
320+
TypeckError,
321+
}
322+
312323
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
313324
pub enum InterpError<'tcx> {
325+
/// The program caused undefined behavior.
326+
UndefinedBehaviour(UndefinedBehaviourMessage<'tcx>),
327+
/// The program did something the interpreter does not support (some of these *might* be UB
328+
/// but the interpreter is not sure).
329+
Unsupported(UnsupportedMessage<'tcx>),
330+
/// The program was invalid (ill-typed, not sufficiently monomorphized, ...).
331+
InvalidProgram(InvalidProgramMessage<'tcx>),
332+
/// The program exhausted the interpreter's resources (stack/heap too big,
333+
/// execution takes too long, ..).
334+
ResourceExhaustion(ResourceExhaustionMessage<'tcx>),
335+
314336
/// This variant is used by machines to signal their own errors that do not
315337
/// match an existing variant.
316338
MachineError(String),
@@ -374,18 +396,11 @@ pub enum InterpError<'tcx> {
374396
HeapAllocZeroBytes,
375397
HeapAllocNonPowerOfTwoAlignment(u64),
376398
Unreachable,
399+
/// The program panicked.
377400
Panic(PanicMessage<u64>),
378401
ReadFromReturnPointer,
379402
PathNotFound(Vec<String>),
380403
UnimplementedTraitSelection,
381-
/// Abort in case type errors are reached
382-
TypeckError,
383-
/// Resolution can fail if we are in a too generic context
384-
TooGeneric,
385-
/// Cannot compute this constant because it depends on another one
386-
/// which already produced an error
387-
ReferencedConstant,
388-
InfiniteLoop,
389404
}
390405

391406
pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;

0 commit comments

Comments
 (0)