diff options
| author | Christiaan Dirkx <christiaan@dirkx.email> | 2021-05-06 14:03:50 +0200 | 
|---|---|---|
| committer | Christiaan Dirkx <christiaan@dirkx.email> | 2021-05-19 15:52:09 +0200 | 
| commit | 4ff5ab52966203b8ad8da96f897566e4a218308a (patch) | |
| tree | 345645ca61e919b7a9b74c543a497efeedcaab54 /library/std/src | |
| parent | 6145051eeebeba030cef3aa01a99683b84ff24fc (diff) | |
| download | rust-4ff5ab52966203b8ad8da96f897566e4a218308a.tar.gz rust-4ff5ab52966203b8ad8da96f897566e4a218308a.zip | |
Rename `rterr` to `rtprintpanic`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/alloc.rs | 2 | ||||
| -rw-r--r-- | library/std/src/panicking.rs | 9 | ||||
| -rw-r--r-- | library/std/src/sys/unix/stack_overflow.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/windows/stack_overflow.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys_common/rt.rs | 8 | 
5 files changed, 12 insertions, 11 deletions
| diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 9e9052ff92e..8ee55234cea 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -315,7 +315,7 @@ pub fn take_alloc_error_hook() -> fn(Layout) { } fn default_alloc_error_hook(layout: Layout) { - rterr!("memory allocation of {} bytes failed\n", layout.size()); + rtprintpanic!("memory allocation of {} bytes failed\n", layout.size()); } #[cfg(not(test))] diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index 90911515185..02957e75a74 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -596,15 +596,12 @@ fn rust_panic_with_hook( if panics > 2 { // Don't try to print the message in this case // - perhaps that is causing the recursive panics. - rterr!("thread panicked while processing panic. aborting.\n"); + rtprintpanic!("thread panicked while processing panic. aborting.\n"); } else { // Unfortunately, this does not print a backtrace, because creating // a `Backtrace` will allocate, which we must to avoid here. let panicinfo = PanicInfo::internal_constructor(message, location); - rterr!( - "{}\npanicked after panic::always_abort(), aborting.\n", - panicinfo - ); + rtprintpanic!("{}\npanicked after panic::always_abort(), aborting.\n", panicinfo); } intrinsics::abort() } @@ -637,7 +634,7 @@ fn rust_panic_with_hook( // have limited options. Currently our preference is to // just abort. In the future we may consider resuming // unwinding or otherwise exiting the thread cleanly. - rterr!("thread panicked while panicking. aborting.\n"); + rtprintpanic!("thread panicked while panicking. aborting.\n"); intrinsics::abort() } diff --git a/library/std/src/sys/unix/stack_overflow.rs b/library/std/src/sys/unix/stack_overflow.rs index 72fd48278bc..81f47a779d3 100644 --- a/library/std/src/sys/unix/stack_overflow.rs +++ b/library/std/src/sys/unix/stack_overflow.rs @@ -102,7 +102,7 @@ mod imp { // If the faulting address is within the guard page, then we print a // message saying so and abort. if guard.start <= addr && addr < guard.end { - rterr!( + rtprintpanic!( "\nthread '{}' has overflowed its stack\n", thread::current().name().unwrap_or("<unknown>") ); diff --git a/library/std/src/sys/windows/stack_overflow.rs b/library/std/src/sys/windows/stack_overflow.rs index 24ba35ad17e..755dc0a6c8b 100644 --- a/library/std/src/sys/windows/stack_overflow.rs +++ b/library/std/src/sys/windows/stack_overflow.rs @@ -24,7 +24,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) - let code = rec.ExceptionCode; if code == c::EXCEPTION_STACK_OVERFLOW { - rterr!( + rtprintpanic!( "\nthread '{}' has overflowed its stack\n", thread::current().name().unwrap_or("<unknown>") ); diff --git a/library/std/src/sys_common/rt.rs b/library/std/src/sys_common/rt.rs index e4c9b60594e..02013ecc4ce 100644 --- a/library/std/src/sys_common/rt.rs +++ b/library/std/src/sys_common/rt.rs @@ -39,7 +39,11 @@ pub fn cleanup() { }); } -macro_rules! rterr { +// Prints to the "panic output", depending on the platform this may be: +// - the standard error output +// - some dedicated platform specific output +// - nothing (so this macro is a no-op) +macro_rules! rtprintpanic { ($($t:tt)*) => { if let Some(mut out) = crate::sys::stdio::panic_output() { let _ = crate::io::Write::write_fmt(&mut out, format_args!($($t)*)); @@ -50,7 +54,7 @@ macro_rules! rterr { macro_rules! rtabort { ($($t:tt)*) => { { - rterr!("fatal runtime error: {}\n", format_args!($($t)*)); + rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*)); crate::sys::abort_internal(); } } | 
