about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-14 04:13:24 -0700
committerbors <bors@rust-lang.org>2013-07-14 04:13:24 -0700
commit51cb98443cfd053f3d2bdb26465fdb0c9d3a0f74 (patch)
tree0fface39379bb33f38a47477420b631cd3090c87 /src/libsyntax
parentc3e3090ac2c8e549512ef3fd933bd27827c44146 (diff)
parent3b0258916d28a1215acf9a0c78f6760cc67f935c (diff)
downloadrust-51cb98443cfd053f3d2bdb26465fdb0c9d3a0f74.tar.gz
rust-51cb98443cfd053f3d2bdb26465fdb0c9d3a0f74.zip
auto merge of #7779 : kballard/rust/print-macro-args, r=alexcrichton
The new names make it obvious that these generate formatted output.

Add a one-argument case that uses %? to format, just like the other
format-using macros (e.g. info!()).
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 73fa659a7aa..2c3f42cca9a 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -644,16 +644,22 @@ pub fn core_macros() -> @str {
         );
     )
 
-    macro_rules! print(
-        ($( $arg:expr),+) => ( {
-            print(fmt!($($arg),+));
-        } )
+    macro_rules! printf (
+        ($arg:expr) => (
+            print(fmt!(\"%?\", $arg))
+        );
+        ($( $arg:expr ),+) => (
+            print(fmt!($($arg),+))
+        )
     )
 
-    macro_rules! println(
-        ($( $arg:expr),+) => ( {
-            println(fmt!($($arg),+));
-        } )
+    macro_rules! printfln (
+        ($arg:expr) => (
+            println(fmt!(\"%?\", $arg))
+        );
+        ($( $arg:expr ),+) => (
+            println(fmt!($($arg),+))
+        )
     )
 }";
 }