about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libsyntax/ext/expand.rs40
-rw-r--r--src/test/run-pass/log-poly.rs10
2 files changed, 42 insertions, 8 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index f76f10f3de1..e61e8a1a594 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -409,14 +409,38 @@ pub fn core_macros() -> ~str {
 ~"pub mod macros {
     macro_rules! ignore (($($x:tt)*) => (()))
 
-    macro_rules! error ( ($( $arg:expr ),+) => (
-        log(::core::error, fmt!( $($arg),+ )) ))
-    macro_rules! warn ( ($( $arg:expr ),+) => (
-        log(::core::warn, fmt!( $($arg),+ )) ))
-    macro_rules! info ( ($( $arg:expr ),+) => (
-        log(::core::info, fmt!( $($arg),+ )) ))
-    macro_rules! debug ( ($( $arg:expr ),+) => (
-        log(::core::debug, fmt!( $($arg),+ )) ))
+    macro_rules! error (
+        ($arg:expr) => (
+            log(::core::error, fmt!( \"%?\", $arg ))
+        );
+        ($( $arg:expr ),+) => (
+            log(::core::error, fmt!( $($arg),+ ))
+        )
+    )
+    macro_rules! warn (
+        ($arg:expr) => (
+            log(::core::warn, fmt!( \"%?\", $arg ))
+        );
+        ($( $arg:expr ),+) => (
+            log(::core::warn, fmt!( $($arg),+ ))
+        )
+    )
+    macro_rules! info (
+        ($arg:expr) => (
+            log(::core::info, fmt!( \"%?\", $arg ))
+        );
+        ($( $arg:expr ),+) => (
+            log(::core::info, fmt!( $($arg),+ ))
+        )
+    )
+    macro_rules! debug (
+        ($arg:expr) => (
+            log(::core::debug, fmt!( \"%?\", $arg ))
+        );
+        ($( $arg:expr ),+) => (
+            log(::core::debug, fmt!( $($arg),+ ))
+        )
+    )
 
     macro_rules! fail(
         ($msg: expr) => (
diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs
new file mode 100644
index 00000000000..3588016b8ba
--- /dev/null
+++ b/src/test/run-pass/log-poly.rs
@@ -0,0 +1,10 @@
+enum Numbers {
+    Three
+}
+
+fn main() {
+    debug!(1);
+    info!(2.0);
+    warn!(Three);
+    error!(~[4]);
+}