@@ -309,8 +309,30 @@ impl<O: fmt::Debug> fmt::Debug for PanicMessage<O> {
309
309
}
310
310
}
311
311
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
+
312
323
#[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
313
324
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
+
314
336
/// This variant is used by machines to signal their own errors that do not
315
337
/// match an existing variant.
316
338
MachineError ( String ) ,
@@ -374,18 +396,11 @@ pub enum InterpError<'tcx> {
374
396
HeapAllocZeroBytes ,
375
397
HeapAllocNonPowerOfTwoAlignment ( u64 ) ,
376
398
Unreachable ,
399
+ /// The program panicked.
377
400
Panic ( PanicMessage < u64 > ) ,
378
401
ReadFromReturnPointer ,
379
402
PathNotFound ( Vec < String > ) ,
380
403
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 ,
389
404
}
390
405
391
406
pub type InterpResult < ' tcx , T = ( ) > = Result < T , InterpErrorInfo < ' tcx > > ;
0 commit comments