diff options
| author | Christiaan Dirkx <christiaan@dirkx.email> | 2021-04-29 15:57:05 +0200 |
|---|---|---|
| committer | Christiaan Dirkx <christiaan@dirkx.email> | 2021-05-19 15:01:47 +0200 |
| commit | 5b0908587e5e549051bcc6294b034049421de4f8 (patch) | |
| tree | 258212b45658a287baf3d410f43dfadd05e2364f /library/std/src | |
| parent | be8450eec8fa635a9132f799012fed83ba59121e (diff) | |
| download | rust-5b0908587e5e549051bcc6294b034049421de4f8.tar.gz rust-5b0908587e5e549051bcc6294b034049421de4f8.zip | |
Introduce `sys_common::rt::rterr!`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys_common/rt.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/library/std/src/sys_common/rt.rs b/library/std/src/sys_common/rt.rs index c70f2ecc04e..9ce6aa7c369 100644 --- a/library/std/src/sys_common/rt.rs +++ b/library/std/src/sys_common/rt.rs @@ -1,4 +1,5 @@ #![deny(unsafe_op_in_unsafe_fn)] +#![allow(unused_macros)] use crate::sync::Once; use crate::sys; @@ -38,6 +39,14 @@ pub fn cleanup() { }); } +macro_rules! rterr { + ($($t:tt)*) => { + if let Some(mut out) = crate::sys::stdio::panic_output() { + let _ = crate::io::Write::write_fmt(&mut out, format_args!($($t)*)); + } + } +} + macro_rules! rtabort { ($($t:tt)*) => (crate::sys_common::util::abort(format_args!($($t)*))) } @@ -50,7 +59,6 @@ macro_rules! rtassert { }; } -#[allow(unused_macros)] // not used on all platforms macro_rules! rtunwrap { ($ok:ident, $e:expr) => { match $e { |
