Skip to content

Commit 871daff

Browse files
committed
---
yaml --- r: 144378 b: refs/heads/try2 c: a3e39b9 h: refs/heads/master v: v3
1 parent ced381e commit 871daff

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: eb836dd61ed2d780ca9639f73876c3d3e05ef079
8+
refs/heads/try2: a3e39b945402475dbe0eae91833981dad4622cb7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ext/expand.rs

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -758,32 +758,32 @@ pub fn std_macros() -> @str {
758758
)
759759
)
760760

761-
// conditionally define debug!, but keep it type checking even
762-
// in non-debug builds.
763-
macro_rules! __debug (
761+
macro_rules! debug (
764762
($arg:expr) => (
765-
__log(4u32, fmt!( \"%?\", $arg ))
763+
if cfg!(debug) { __log(4u32, fmt!( \"%?\", $arg )) }
766764
);
767765
($( $arg:expr ),+) => (
768-
__log(4u32, fmt!( $($arg),+ ))
766+
if cfg!(debug) { __log(4u32, fmt!( $($arg),+ )) }
769767
)
770768
)
771769

772-
#[cfg(debug)]
773-
#[macro_escape]
774-
mod debug_macro {
775-
macro_rules! debug (($($arg:expr),*) => {
776-
__debug!($($arg),*)
777-
})
778-
}
770+
macro_rules! error2 (
771+
($($arg:tt)*) => ( __log(1u32, format!($($arg)*)))
772+
)
779773

780-
#[cfg(not(debug))]
781-
#[macro_escape]
782-
mod debug_macro {
783-
macro_rules! debug (($($arg:expr),*) => {
784-
if false { __debug!($($arg),*) }
785-
})
786-
}
774+
macro_rules! warn2 (
775+
($($arg:tt)*) => ( __log(2u32, format!($($arg)*)))
776+
)
777+
778+
macro_rules! info2 (
779+
($($arg:tt)*) => ( __log(3u32, format!($($arg)*)))
780+
)
781+
782+
macro_rules! debug2 (
783+
($($arg:tt)*) => (
784+
if cfg!(debug) { __log(4u32, format!($($arg)*)) }
785+
)
786+
)
787787

788788
macro_rules! fail(
789789
() => (
@@ -797,6 +797,15 @@ pub fn std_macros() -> @str {
797797
)
798798
)
799799

800+
macro_rules! fail2(
801+
() => (
802+
fail!(\"explicit failure\")
803+
);
804+
($($arg:tt)+) => (
805+
::std::sys::FailWithCause::fail_with(format!($($arg)+), file!(), line!())
806+
)
807+
)
808+
800809
macro_rules! assert(
801810
($cond:expr) => {
802811
if !$cond {
@@ -964,15 +973,13 @@ pub fn std_macros() -> @str {
964973
// allocation but should rather delegate to an invocation of
965974
// write! instead of format!
966975
macro_rules! print (
967-
() => ();
968-
($arg:expr) => ( ::std::io::print(format!(\"{}\", $arg)));
969-
($fmt:expr, $($arg:tt)+) => ( ::std::io::print(format!($fmt, $($arg)+)))
976+
($($arg:tt)+) => ( ::std::io::print(format!($($arg)+)))
970977
)
971978

972979
// FIXME(#6846) once stdio is redesigned, this shouldn't perform an
973980
// allocation but should rather delegate to an io::Writer
974981
macro_rules! println (
975-
($($arg:tt)*) => ({ print!($($arg)*); ::std::io::println(\"\"); })
982+
($($arg:tt)+) => ({ print!($($arg)+); ::std::io::println(\"\"); })
976983
)
977984

978985
// NOTE: use this after a snapshot lands to abstract the details

branches/try2/src/test/run-pass/ifmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fn test_write() {
240240
// Just make sure that the macros are defined, there's not really a lot that we
241241
// can do with them just yet (to test the output)
242242
fn test_print() {
243-
print!(1);
243+
print!("hi");
244244
print!("{:?}", ~[0u8]);
245245
println!("hello");
246246
println!("this is a {}", "test");

0 commit comments

Comments
 (0)