@@ -229,6 +229,10 @@ pub enum InterpError<'tcx, O> {
229
229
/// match an existing variant.
230
230
MachineError ( String ) ,
231
231
232
+ /// Not actually an interpreter error -- used to signal that execution has exited
233
+ /// with the given status code. Used by Miri, but not by CTFE.
234
+ Exit ( i32 ) ,
235
+
232
236
FunctionAbiMismatch ( Abi , Abi ) ,
233
237
FunctionArgMismatch ( Ty < ' tcx > , Ty < ' tcx > ) ,
234
238
FunctionRetMismatch ( Ty < ' tcx > , Ty < ' tcx > ) ,
@@ -317,6 +321,8 @@ impl<'tcx, O> InterpError<'tcx, O> {
317
321
use self :: InterpError :: * ;
318
322
match * self {
319
323
MachineError ( ref inner) => inner,
324
+ Exit ( ..) =>
325
+ "exited" ,
320
326
FunctionAbiMismatch ( ..) | FunctionArgMismatch ( ..) | FunctionRetMismatch ( ..)
321
327
| FunctionArgCountMismatch =>
322
328
"tried to call a function through a function pointer of incompatible type" ,
@@ -515,6 +521,8 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for InterpError<'tcx, O> {
515
521
write ! ( f, "the evaluated program panicked at '{}', {}:{}:{}" , msg, file, line, col) ,
516
522
InvalidDiscriminant ( val) =>
517
523
write ! ( f, "encountered invalid enum discriminant {}" , val) ,
524
+ Exit ( code) =>
525
+ write ! ( f, "exited with status code {}" , code) ,
518
526
_ => write ! ( f, "{}" , self . description( ) ) ,
519
527
}
520
528
}
0 commit comments