Skip to content

Commit 5b09085

Browse files
committed
Introduce sys_common::rt::rterr!
1 parent be8450e commit 5b09085

File tree

1 file changed

+9
-1
lines changed
  • library/std/src/sys_common

1 file changed

+9
-1
lines changed

library/std/src/sys_common/rt.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(unsafe_op_in_unsafe_fn)]
2+
#![allow(unused_macros)]
23

34
use crate::sync::Once;
45
use crate::sys;
@@ -38,6 +39,14 @@ pub fn cleanup() {
3839
});
3940
}
4041

42+
macro_rules! rterr {
43+
($($t:tt)*) => {
44+
if let Some(mut out) = crate::sys::stdio::panic_output() {
45+
let _ = crate::io::Write::write_fmt(&mut out, format_args!($($t)*));
46+
}
47+
}
48+
}
49+
4150
macro_rules! rtabort {
4251
($($t:tt)*) => (crate::sys_common::util::abort(format_args!($($t)*)))
4352
}
@@ -50,7 +59,6 @@ macro_rules! rtassert {
5059
};
5160
}
5261

53-
#[allow(unused_macros)] // not used on all platforms
5462
macro_rules! rtunwrap {
5563
($ok:ident, $e:expr) => {
5664
match $e {

0 commit comments

Comments
 (0)