2 use crate::io::prelude::*;
3 use crate::sys::stdio::panic_output;
6 pub fn dumb_print(args: fmt::Arguments<'_>) {
7 if let Some(mut out) = panic_output() {
8 let _ = out.write_fmt(args);
12 // Other platforms should use the appropriate platform-specific mechanism for
13 // aborting the process. If no platform-specific mechanism is available,
14 // crate::intrinsics::abort() may be used instead. The above implementations cover
15 // all targets currently supported by libstd.
17 pub fn abort(args: fmt::Arguments<'_>) -> ! {
18 dumb_print(format_args!("fatal runtime error: {}\n", args));
20 crate::sys::abort_internal();
24 #[allow(dead_code)] // stack overflow detection not enabled on all platforms
25 pub unsafe fn report_overflow() {
26 dumb_print(format_args!(
27 "\nthread '{}' has overflowed its stack\n",
28 thread::current().name().unwrap_or("<unknown>")