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!()).
This commit is contained in:
bors 2013-07-14 04:13:24 -07:00
commit 51cb98443c
1 changed files with 14 additions and 8 deletions

View File

@ -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),+))
)
)
}";
}