Skip to content

Commit 357f087

Browse files
committed
Merge remote-tracking branch 'brson/io' into io-upstream
Conflicts: src/rt/rust_builtin.cpp src/rt/rustrt.def.in
2 parents adeb7e7 + 4d39253 commit 357f087

30 files changed

+3147
-836
lines changed

src/libstd/macros.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@
1010

1111
#[macro_escape];
1212

13+
macro_rules! rterrln (
14+
($( $arg:expr),+) => ( {
15+
::rt::util::dumb_println(fmt!( $($arg),+ ));
16+
} )
17+
)
18+
1319
// Some basic logging
1420
macro_rules! rtdebug_ (
1521
($( $arg:expr),+) => ( {
16-
dumb_println(fmt!( $($arg),+ ));
17-
18-
fn dumb_println(s: &str) {
19-
use io::WriterUtil;
20-
let dbg = ::libc::STDERR_FILENO as ::io::fd_t;
21-
dbg.write_str(s);
22-
dbg.write_str("\n");
23-
}
24-
22+
rterrln!( $($arg),+ )
2523
} )
2624
)
2725

@@ -33,21 +31,15 @@ macro_rules! rtdebug (
3331
macro_rules! rtassert (
3432
( $arg:expr ) => ( {
3533
if !$arg {
36-
abort!("assertion failed: %s", stringify!($arg));
34+
rtabort!("assertion failed: %s", stringify!($arg));
3735
}
3836
} )
3937
)
4038

41-
macro_rules! abort(
42-
($( $msg:expr),+) => ( {
43-
rtdebug!($($msg),+);
44-
45-
do_abort();
4639

47-
// NB: This is in a fn to avoid putting the `unsafe` block in a macro,
48-
// which causes spurious 'unnecessary unsafe block' warnings.
49-
fn do_abort() -> ! {
50-
unsafe { ::libc::abort(); }
51-
}
40+
macro_rules! rtabort(
41+
($( $msg:expr),+) => ( {
42+
::rt::util::abort(fmt!($($msg),+));
5243
} )
5344
)
45+

0 commit comments

Comments
 (0)