@@ -139,9 +139,11 @@ impl<'tcx> ConstEvalErr<'tcx> {
139
139
) -> Result < DiagnosticBuilder < ' tcx > , ErrorHandled > {
140
140
match self . error {
141
141
InterpError :: Layout ( LayoutError :: Unknown ( _) ) |
142
- InterpError :: TooGeneric => return Err ( ErrorHandled :: TooGeneric ) ,
142
+ InterpError :: InvalidProgram ( InvalidProgramMessage :: TooGeneric ) =>
143
+ return Err ( ErrorHandled :: TooGeneric ) ,
143
144
InterpError :: Layout ( LayoutError :: SizeOverflow ( _) ) |
144
- InterpError :: TypeckError => return Err ( ErrorHandled :: Reported ) ,
145
+ InterpError :: InvalidProgram ( InvalidProgramMessage :: TypeckError ) =>
146
+ return Err ( ErrorHandled :: Reported ) ,
145
147
_ => { } ,
146
148
}
147
149
trace ! ( "reporting const eval failure at {:?}" , self . span) ;
@@ -310,7 +312,7 @@ impl<O: fmt::Debug> fmt::Debug for PanicMessage<O> {
310
312
}
311
313
312
314
#[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
313
- pub enum InvalidProgramMessage < ' tcx > {
315
+ pub enum InvalidProgramMessage {
314
316
/// Resolution can fail if we are in a too generic context
315
317
TooGeneric ,
316
318
/// Cannot compute this constant because it depends on another one
@@ -320,19 +322,35 @@ pub enum InvalidProgramMessage<'tcx> {
320
322
TypeckError ,
321
323
}
322
324
325
+ #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
326
+ pub enum UndefinedBehaviourMessage {
327
+ }
328
+
329
+ #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
330
+ pub enum UnsupportedMessage {
331
+ }
332
+
333
+ #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
334
+ pub enum ResourceExhaustionMessage {
335
+ }
336
+
323
337
#[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
324
338
pub enum InterpError < ' tcx > {
339
+ /// The program panicked.
340
+ Panic ( PanicMessage < u64 > ) ,
325
341
/// The program caused undefined behavior.
326
- UndefinedBehaviour ( UndefinedBehaviourMessage < ' tcx > ) ,
342
+ UndefinedBehaviour ( UndefinedBehaviourMessage ) ,
327
343
/// The program did something the interpreter does not support (some of these *might* be UB
328
344
/// but the interpreter is not sure).
329
- Unsupported ( UnsupportedMessage < ' tcx > ) ,
345
+ Unsupported ( UnsupportedMessage ) ,
330
346
/// The program was invalid (ill-typed, not sufficiently monomorphized, ...).
331
- InvalidProgram ( InvalidProgramMessage < ' tcx > ) ,
347
+ InvalidProgram ( InvalidProgramMessage ) ,
332
348
/// The program exhausted the interpreter's resources (stack/heap too big,
333
349
/// execution takes too long, ..).
334
- ResourceExhaustion ( ResourceExhaustionMessage < ' tcx > ) ,
335
-
350
+ ResourceExhaustion ( ResourceExhaustionMessage ) ,
351
+
352
+ /// THe above 5 variants are what we want to group all the remaining InterpError variants into
353
+
336
354
/// This variant is used by machines to signal their own errors that do not
337
355
/// match an existing variant.
338
356
MachineError ( String ) ,
@@ -396,8 +414,6 @@ pub enum InterpError<'tcx> {
396
414
HeapAllocZeroBytes ,
397
415
HeapAllocNonPowerOfTwoAlignment ( u64 ) ,
398
416
Unreachable ,
399
- /// The program panicked.
400
- Panic ( PanicMessage < u64 > ) ,
401
417
ReadFromReturnPointer ,
402
418
PathNotFound ( Vec < String > ) ,
403
419
UnimplementedTraitSelection ,
0 commit comments