Skip to content

Commit 4ff5ab5

Browse files
committed
Rename rterr to rtprintpanic
1 parent 6145051 commit 4ff5ab5

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

library/std/src/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub fn take_alloc_error_hook() -> fn(Layout) {
315315
}
316316

317317
fn default_alloc_error_hook(layout: Layout) {
318-
rterr!("memory allocation of {} bytes failed\n", layout.size());
318+
rtprintpanic!("memory allocation of {} bytes failed\n", layout.size());
319319
}
320320

321321
#[cfg(not(test))]

library/std/src/panicking.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,12 @@ fn rust_panic_with_hook(
596596
if panics > 2 {
597597
// Don't try to print the message in this case
598598
// - perhaps that is causing the recursive panics.
599-
rterr!("thread panicked while processing panic. aborting.\n");
599+
rtprintpanic!("thread panicked while processing panic. aborting.\n");
600600
} else {
601601
// Unfortunately, this does not print a backtrace, because creating
602602
// a `Backtrace` will allocate, which we must to avoid here.
603603
let panicinfo = PanicInfo::internal_constructor(message, location);
604-
rterr!(
605-
"{}\npanicked after panic::always_abort(), aborting.\n",
606-
panicinfo
607-
);
604+
rtprintpanic!("{}\npanicked after panic::always_abort(), aborting.\n", panicinfo);
608605
}
609606
intrinsics::abort()
610607
}
@@ -637,7 +634,7 @@ fn rust_panic_with_hook(
637634
// have limited options. Currently our preference is to
638635
// just abort. In the future we may consider resuming
639636
// unwinding or otherwise exiting the thread cleanly.
640-
rterr!("thread panicked while panicking. aborting.\n");
637+
rtprintpanic!("thread panicked while panicking. aborting.\n");
641638
intrinsics::abort()
642639
}
643640

library/std/src/sys/unix/stack_overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ mod imp {
102102
// If the faulting address is within the guard page, then we print a
103103
// message saying so and abort.
104104
if guard.start <= addr && addr < guard.end {
105-
rterr!(
105+
rtprintpanic!(
106106
"\nthread '{}' has overflowed its stack\n",
107107
thread::current().name().unwrap_or("<unknown>")
108108
);

library/std/src/sys/windows/stack_overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -
2424
let code = rec.ExceptionCode;
2525

2626
if code == c::EXCEPTION_STACK_OVERFLOW {
27-
rterr!(
27+
rtprintpanic!(
2828
"\nthread '{}' has overflowed its stack\n",
2929
thread::current().name().unwrap_or("<unknown>")
3030
);

library/std/src/sys_common/rt.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ pub fn cleanup() {
3939
});
4040
}
4141

42-
macro_rules! rterr {
42+
// Prints to the "panic output", depending on the platform this may be:
43+
// - the standard error output
44+
// - some dedicated platform specific output
45+
// - nothing (so this macro is a no-op)
46+
macro_rules! rtprintpanic {
4347
($($t:tt)*) => {
4448
if let Some(mut out) = crate::sys::stdio::panic_output() {
4549
let _ = crate::io::Write::write_fmt(&mut out, format_args!($($t)*));
@@ -50,7 +54,7 @@ macro_rules! rterr {
5054
macro_rules! rtabort {
5155
($($t:tt)*) => {
5256
{
53-
rterr!("fatal runtime error: {}\n", format_args!($($t)*));
57+
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));
5458
crate::sys::abort_internal();
5559
}
5660
}

0 commit comments

Comments
 (0)