+ use TerminationInfo::*;
+ let title = match info {
+ Exit(code) => return Some(*code),
+ Abort(_) =>
+ "abnormal termination",
+ UnsupportedInIsolation(_) =>
+ "unsupported operation",
+ ExperimentalUb { .. } =>
+ "Undefined Behavior",
+ Deadlock => "deadlock",
+ };
+ let helps = match info {
+ UnsupportedInIsolation(_) =>
+ vec![format!("pass the flag `-Zmiri-disable-isolation` to disable isolation")],
+ ExperimentalUb { url, .. } =>
+ vec![
+ format!("this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental"),
+ format!("see {} for further information", url),
+ ],
+ _ => vec![],
+ };
+ (title, helps)
+ }
+ _ => {
+ let title = match e.kind() {
+ Unsupported(_) =>
+ "unsupported operation",
+ UndefinedBehavior(_) =>
+ "Undefined Behavior",
+ ResourceExhaustion(_) =>
+ "resource exhaustion",
+ InvalidProgram(InvalidProgramInfo::ReferencedConstant) =>
+ "post-monomorphization error",
+ _ =>
+ bug!("This error should be impossible in Miri: {}", e),
+ };
+ let helps = match e.kind() {
+ Unsupported(UnsupportedOpInfo::NoMirFor(..)) =>
+ vec![format!("make sure to use a Miri sysroot, which you can prepare with `cargo miri setup`")],
+ Unsupported(UnsupportedOpInfo::ReadBytesAsPointer | UnsupportedOpInfo::ThreadLocalStatic(_) | UnsupportedOpInfo::ReadExternStatic(_)) =>
+ panic!("Error should never be raised by Miri: {:?}", e.kind()),
+ Unsupported(_) =>
+ vec![format!("this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support")],
+ UndefinedBehavior(UndefinedBehaviorInfo::AlignmentCheckFailed { .. })
+ if ecx.memory.extra.check_alignment == AlignmentCheck::Symbolic
+ =>
+ vec![
+ format!("this usually indicates that your program performed an invalid operation and caused Undefined Behavior"),
+ format!("but due to `-Zmiri-symbolic-alignment-check`, alignment errors can also be false positives"),
+ ],
+ UndefinedBehavior(_) =>
+ vec![
+ format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior"),
+ format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information"),
+ ],
+ _ => vec![],
+ };
+ (title, helps)