diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:49:15 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:49:15 -0800 |
| commit | 26cd8eae48ea99bda183c5224bc423991ccfaf1f (patch) | |
| tree | 26492380aa79b1b1f70acb2a624e30ca097374df /src/libstd/rt | |
| parent | 34a63d336419e80d3afec16c730d1ad5fa11dc73 (diff) | |
| parent | e9cbdd866d1c9c01e9affaf6875e37e58a073758 (diff) | |
| download | rust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.tar.gz rust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.zip | |
rollup merge of #20563: cmr/macro-input-future-proofing
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/macros.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libstd/rt/macros.rs b/src/libstd/rt/macros.rs index bbc96d0b19f..1e3ab6d34da 100644 --- a/src/libstd/rt/macros.rs +++ b/src/libstd/rt/macros.rs @@ -14,16 +14,24 @@ //! they aren't defined anywhere outside of the `rt` module. macro_rules! rterrln { - ($fmt:expr $($arg:tt)*) => ( { - ::rt::util::dumb_print(format_args!(concat!($fmt, "\n") $($arg)*)) + ($fmt:expr) => ( { + ::rt::util::dumb_print(format_args!(concat!($fmt, "\n"))) + } ); + ($fmt:expr, $($arg:expr),*) => ( { + ::rt::util::dumb_print(format_args!(concat!($fmt, "\n"), $($arg)*)) } ) } // Some basic logging. Enabled by passing `--cfg rtdebug` to the libstd build. macro_rules! rtdebug { - ($($arg:tt)*) => ( { + ($arg:expr) => ( { if cfg!(rtdebug) { - rterrln!($($arg)*) + rterrln!($arg) + } + } ); + ($str:expr, $($arg:expr),*) => ( { + if cfg!(rtdebug) { + rterrln!($str, $($arg)*) } }) } |
