diff options
| author | Christiaan Dirkx <christiaan@dirkx.email> | 2021-04-29 16:10:32 +0200 |
|---|---|---|
| committer | Christiaan Dirkx <christiaan@dirkx.email> | 2021-05-19 15:05:35 +0200 |
| commit | 6145051eeebeba030cef3aa01a99683b84ff24fc (patch) | |
| tree | c77a2295b9da5097280dea573b05156909722fad /library/std/src | |
| parent | 236705f3c30905623f97dc8887c83db520eb27c1 (diff) | |
| download | rust-6145051eeebeba030cef3aa01a99683b84ff24fc.tar.gz rust-6145051eeebeba030cef3aa01a99683b84ff24fc.zip | |
Replace `sys_common::util::dumb_print` with `rterr!`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/alloc.rs | 4 | ||||
| -rw-r--r-- | library/std/src/panicking.rs | 10 | ||||
| -rw-r--r-- | library/std/src/sys_common/mod.rs | 1 | ||||
| -rw-r--r-- | library/std/src/sys_common/util.rs | 9 |
4 files changed, 6 insertions, 18 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 843ef09a584..9e9052ff92e 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -63,8 +63,6 @@ use core::ptr::NonNull; use core::sync::atomic::{AtomicPtr, Ordering}; use core::{mem, ptr}; -use crate::sys_common::util::dumb_print; - #[stable(feature = "alloc_module", since = "1.28.0")] #[doc(inline)] pub use alloc_crate::alloc::*; @@ -317,7 +315,7 @@ pub fn take_alloc_error_hook() -> fn(Layout) { } fn default_alloc_error_hook(layout: Layout) { - dumb_print(format_args!("memory allocation of {} bytes failed\n", layout.size())); + rterr!("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 a8410bea734..90911515185 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -20,7 +20,7 @@ use crate::sync::atomic::{AtomicBool, Ordering}; use crate::sys::stdio::panic_output; use crate::sys_common::backtrace::{self, RustBacktrace}; use crate::sys_common::rwlock::RWLock; -use crate::sys_common::{thread_info, util}; +use crate::sys_common::thread_info; use crate::thread; #[cfg(not(test))] @@ -596,15 +596,15 @@ 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. - util::dumb_print(format_args!("thread panicked while processing panic. aborting.\n")); + rterr!("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); - util::dumb_print(format_args!( + rterr!( "{}\npanicked after panic::always_abort(), aborting.\n", panicinfo - )); + ); } intrinsics::abort() } @@ -637,7 +637,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. - util::dumb_print(format_args!("thread panicked while panicking. aborting.\n")); + rterr!("thread panicked while panicking. aborting.\n"); intrinsics::abort() } diff --git a/library/std/src/sys_common/mod.rs b/library/std/src/sys_common/mod.rs index 7fa6977f2af..4ef0e72adf0 100644 --- a/library/std/src/sys_common/mod.rs +++ b/library/std/src/sys_common/mod.rs @@ -40,7 +40,6 @@ pub mod thread_info; pub mod thread_local_dtor; pub mod thread_local_key; pub mod thread_parker; -pub mod util; pub mod wtf8; cfg_if::cfg_if! { diff --git a/library/std/src/sys_common/util.rs b/library/std/src/sys_common/util.rs deleted file mode 100644 index f7072cc5011..00000000000 --- a/library/std/src/sys_common/util.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::fmt; -use crate::io::prelude::*; -use crate::sys::stdio::panic_output; - -pub fn dumb_print(args: fmt::Arguments<'_>) { - if let Some(mut out) = panic_output() { - let _ = out.write_fmt(args); - } -} |
