about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-06 15:49:15 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-06 15:49:15 -0800
commit26cd8eae48ea99bda183c5224bc423991ccfaf1f (patch)
tree26492380aa79b1b1f70acb2a624e30ca097374df /src/libstd
parent34a63d336419e80d3afec16c730d1ad5fa11dc73 (diff)
parente9cbdd866d1c9c01e9affaf6875e37e58a073758 (diff)
downloadrust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.tar.gz
rust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.zip
rollup merge of #20563: cmr/macro-input-future-proofing
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/macros.rs16
-rw-r--r--src/libstd/sys/common/backtrace.rs28
2 files changed, 26 insertions, 18 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)*)
         }
     })
 }
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs
index d4039fd96ff..be44aa99f49 100644
--- a/src/libstd/sys/common/backtrace.rs
+++ b/src/libstd/sys/common/backtrace.rs
@@ -88,7 +88,7 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
             while rest.len() > 0 {
                 if rest.starts_with("$") {
                     macro_rules! demangle {
-                        ($($pat:expr => $demangled:expr),*) => ({
+                        ($($pat:expr, => $demangled:expr),*) => ({
                             $(if rest.starts_with($pat) {
                                 try!(writer.write_str($demangled));
                                 rest = rest.slice_from($pat.len());
@@ -103,22 +103,22 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> {
 
                     // see src/librustc/back/link.rs for these mappings
                     demangle! (
-                        "$SP$" => "@",
-                        "$UP$" => "Box",
-                        "$RP$" => "*",
-                        "$BP$" => "&",
-                        "$LT$" => "<",
-                        "$GT$" => ">",
-                        "$LP$" => "(",
-                        "$RP$" => ")",
-                        "$C$"  => ",",
+                        "$SP$", => "@",
+                        "$UP$", => "Box",
+                        "$RP$", => "*",
+                        "$BP$", => "&",
+                        "$LT$", => "<",
+                        "$GT$", => ">",
+                        "$LP$", => "(",
+                        "$RP$", => ")",
+                        "$C$", => ",",
 
                         // in theory we can demangle any Unicode code point, but
                         // for simplicity we just catch the common ones.
-                        "$u{20}" => " ",
-                        "$u{27}" => "'",
-                        "$u{5b}" => "[",
-                        "$u{5d}" => "]"
+                        "$u{20}", => " ",
+                        "$u{27}", => "'",
+                        "$u{5b}", => "[",
+                        "$u{5d}", => "]"
                     )
                 } else {
                     let idx = match rest.find('$') {