- if let Some((flags, excluded_cargo_defaults)) = extra_compiler_flags() {
- xs.push(format!("compiler flags: {}", flags.join(" ")).into());
+pub fn report_ice(info: &panic::PanicInfo<'_>) {
+ (*DEFAULT_HOOK)(info);
+
+ // Thread panicked without emitting a fatal diagnostic
+ eprintln!();
+
+ let emitter = Box::new(errors::emitter::EmitterWriter::stderr(
+ errors::ColorConfig::Auto,
+ None,
+ false,
+ false,
+ None,
+ ));
+ let handler = errors::Handler::with_emitter(true, None, emitter);
+
+ // a .span_bug or .bug call has already printed what
+ // it wants to print.
+ if !info.payload().is::<errors::ExplicitBug>() {
+ handler.emit(&MultiSpan::new(),
+ "unexpected panic",
+ errors::Level::Bug);
+ }