From aaf6cc3a841095a95a9c74a6a2a3709dffd7a4e9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 17:04:57 -0700 Subject: [PATCH 01/16] Prevent leakage of fmt! into the compiler We're not outright removing fmt! just yet, but this prevents it from leaking into the compiler further (it's still turned on by default for all other code). --- Makefile.in | 2 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/expand.rs | 109 ++++++++++++++++++++---------------- 3 files changed, 63 insertions(+), 50 deletions(-) diff --git a/Makefile.in b/Makefile.in index b573ab9d4bbe0..06adc311f7860 100644 --- a/Makefile.in +++ b/Makefile.in @@ -88,7 +88,7 @@ ifneq ($(wildcard $(NON_BUILD_TARGET_TRIPLES)),) CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET_TRIPLES)) endif -CFG_RUSTC_FLAGS := $(RUSTFLAGS) +CFG_RUSTC_FLAGS := $(RUSTFLAGS) --cfg nofmt CFG_GCCISH_CFLAGS := CFG_GCCISH_LINK_FLAGS := diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 48eb9a350f135..4824924bc0fad 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -222,7 +222,7 @@ pub fn syntax_expander_table() -> SyntaxEnv { span: None, } as @SyntaxExpanderTTItemTrait, None))); - syntax_expanders.insert(intern(&"fmt"), + syntax_expanders.insert(intern(&"oldfmt"), builtin_normal_tt_no_ctxt( ext::fmt::expand_syntax_ext)); syntax_expanders.insert(intern(&"format_args"), diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 0ca4f4fa1cda2..697df52513d8f 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -809,30 +809,49 @@ pub fn std_macros() -> @str { macro_rules! ignore (($($x:tt)*) => (())) - macro_rules! log( - ($lvl:expr, $arg:expr) => ({ - let lvl = $lvl; - if lvl <= __log_level() { - format_args!(|args| { - ::std::logging::log(lvl, args) - }, \"{}\", fmt!(\"%?\", $arg)) - } - }); - ($lvl:expr, $($arg:expr),+) => ({ - let lvl = $lvl; - if lvl <= __log_level() { - format_args!(|args| { - ::std::logging::log(lvl, args) - }, \"{}\", fmt!($($arg),+)) - } - }) - ) - macro_rules! error( ($($arg:tt)*) => (log!(1u32, $($arg)*)) ) - macro_rules! warn ( ($($arg:tt)*) => (log!(2u32, $($arg)*)) ) - macro_rules! info ( ($($arg:tt)*) => (log!(3u32, $($arg)*)) ) - macro_rules! debug( ($($arg:tt)*) => ( - if cfg!(not(ndebug)) { log!(4u32, $($arg)*) } - )) + #[cfg(not(nofmt))] + mod fmt_extension { + #[macro_escape]; + + macro_rules! fmt(($($arg:tt)*) => (oldfmt!($($arg)*))) + + macro_rules! log( + ($lvl:expr, $arg:expr) => ({ + let lvl = $lvl; + if lvl <= __log_level() { + format_args!(|args| { + ::std::logging::log(lvl, args) + }, \"{}\", fmt!(\"%?\", $arg)) + } + }); + ($lvl:expr, $($arg:expr),+) => ({ + let lvl = $lvl; + if lvl <= __log_level() { + format_args!(|args| { + ::std::logging::log(lvl, args) + }, \"{}\", fmt!($($arg),+)) + } + }) + ) + macro_rules! error( ($($arg:tt)*) => (log!(1u32, $($arg)*)) ) + macro_rules! warn ( ($($arg:tt)*) => (log!(2u32, $($arg)*)) ) + macro_rules! info ( ($($arg:tt)*) => (log!(3u32, $($arg)*)) ) + macro_rules! debug( ($($arg:tt)*) => ( + if cfg!(not(ndebug)) { log!(4u32, $($arg)*) } + )) + + macro_rules! fail( + () => ( + fail!(\"explicit failure\") + ); + ($msg:expr) => ( + ::std::sys::FailWithCause::fail_with($msg, file!(), line!()) + ); + ($( $arg:expr ),+) => ( + ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!()) + ) + ) + } macro_rules! log2( ($lvl:expr, $($arg:tt)+) => ({ @@ -851,24 +870,15 @@ pub fn std_macros() -> @str { if cfg!(not(ndebug)) { log2!(4u32, $($arg)*) } )) - macro_rules! fail( - () => ( - fail!(\"explicit failure\") - ); - ($msg:expr) => ( - ::std::sys::FailWithCause::fail_with($msg, file!(), line!()) - ); - ($( $arg:expr ),+) => ( - ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!()) - ) - ) - macro_rules! fail2( () => ( - fail!(\"explicit failure\") + fail2!(\"explicit failure\") + ); + ($fmt:expr) => ( + ::std::sys::FailWithCause::fail_with($fmt, file!(), line!()) ); - ($($arg:tt)*) => ( - ::std::sys::FailWithCause::fail_with(format!($($arg)*), file!(), line!()) + ($fmt:expr, $($arg:tt)*) => ( + ::std::sys::FailWithCause::fail_with(format!($fmt, $($arg)*), file!(), line!()) ) ) @@ -894,12 +904,14 @@ pub fn std_macros() -> @str { macro_rules! assert_eq ( ($given:expr , $expected:expr) => ( { - let given_val = $given; - let expected_val = $expected; + let given_val = &($given); + let expected_val = &($expected); // check both directions of equality.... - if !((given_val == expected_val) && (expected_val == given_val)) { - fail!(\"assertion failed: `(left == right) && (right == \ - left)` (left: `%?`, right: `%?`)\", given_val, expected_val); + if !((*given_val == *expected_val) && + (*expected_val == *given_val)) { + fail2!(\"assertion failed: `(left == right) && (right == \ + left)` (left: `{:?}`, right: `{:?}`)\", + *given_val, *expected_val); } } ) @@ -917,8 +929,8 @@ pub fn std_macros() -> @str { given_val.approx_eq(&expected_val) && expected_val.approx_eq(&given_val) ) { - fail!(\"left: %? does not approximately equal right: %?\", - given_val, expected_val); + fail2!(\"left: {:?} does not approximately equal right: {:?}\", + given_val, expected_val); } } ); @@ -934,7 +946,8 @@ pub fn std_macros() -> @str { given_val.approx_eq_eps(&expected_val, &epsilon_val) && expected_val.approx_eq_eps(&given_val, &epsilon_val) ) { - fail!(\"left: %? does not approximately equal right: %? with epsilon: %?\", + fail2!(\"left: {:?} does not approximately equal right: \ + {:?} with epsilon: {:?}\", given_val, expected_val, epsilon_val); } } @@ -968,7 +981,7 @@ pub fn std_macros() -> @str { */ macro_rules! unreachable (() => ( - fail!(\"internal error: entered unreachable code\"); + fail2!(\"internal error: entered unreachable code\"); )) macro_rules! condition ( From a8ba31dbf3e7d80a069bc486a35eff8357282b68 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 17:02:31 -0700 Subject: [PATCH 02/16] std: Remove usage of fmt! --- src/libstd/at_vec.rs | 2 +- src/libstd/c_str.rs | 8 +-- src/libstd/cell.rs | 4 +- src/libstd/char.rs | 6 +-- src/libstd/condition.rs | 40 +++++++-------- src/libstd/either.rs | 4 +- src/libstd/fmt/parse.rs | 11 ++-- src/libstd/hash.rs | 6 +-- src/libstd/hashmap.rs | 16 +++--- src/libstd/io.rs | 41 +++++++-------- src/libstd/iter.rs | 12 ++--- src/libstd/local_data.rs | 22 ++++---- src/libstd/macros.rs | 19 +++---- src/libstd/num/f32.rs | 4 +- src/libstd/num/f64.rs | 4 +- src/libstd/num/float.rs | 14 +++--- src/libstd/num/strconv.rs | 10 ++-- src/libstd/option.rs | 34 +++++++------ src/libstd/os.rs | 80 +++++++++++++++--------------- src/libstd/path.rs | 22 ++++---- src/libstd/ptr.rs | 19 ++++--- src/libstd/rand/mod.rs | 10 ++-- src/libstd/repr.rs | 8 +-- src/libstd/result.rs | 14 +++--- src/libstd/rt/args.rs | 6 +-- src/libstd/rt/borrowck.rs | 4 +- src/libstd/rt/comm.rs | 8 +-- src/libstd/rt/context.rs | 6 +-- src/libstd/rt/crate_map.rs | 4 +- src/libstd/rt/io/comm_adapters.rs | 22 ++++---- src/libstd/rt/io/extensions.rs | 2 +- src/libstd/rt/io/file.rs | 30 +++++------ src/libstd/rt/io/flate.rs | 8 +-- src/libstd/rt/io/mem.rs | 14 +++--- src/libstd/rt/io/mod.rs | 2 +- src/libstd/rt/io/native/file.rs | 28 +++++------ src/libstd/rt/io/net/ip.rs | 32 +++--------- src/libstd/rt/io/net/tcp.rs | 10 ++-- src/libstd/rt/io/net/udp.rs | 30 +++++------ src/libstd/rt/io/net/unix.rs | 16 +++--- src/libstd/rt/io/pipe.rs | 4 +- src/libstd/rt/io/stdio.rs | 22 ++++---- src/libstd/rt/io/timer.rs | 2 +- src/libstd/rt/kill.rs | 10 ++-- src/libstd/rt/logging.rs | 18 ++++--- src/libstd/rt/sched.rs | 16 +++--- src/libstd/rt/task.rs | 12 ++--- src/libstd/rt/test.rs | 6 +-- src/libstd/rt/util.rs | 10 ++-- src/libstd/rt/uv/file.rs | 4 +- src/libstd/rt/uv/mod.rs | 4 +- src/libstd/rt/uv/net.rs | 30 +++++------ src/libstd/rt/uv/process.rs | 2 +- src/libstd/rt/uv/uvio.rs | 8 +-- src/libstd/run.rs | 52 +++++++++---------- src/libstd/select.rs | 6 +-- src/libstd/str.rs | 28 +++++------ src/libstd/sys.rs | 4 +- src/libstd/task/mod.rs | 54 ++++++++++---------- src/libstd/task/spawn.rs | 4 +- src/libstd/to_str.rs | 8 +-- src/libstd/trie.rs | 4 +- src/libstd/unstable/dynamic_lib.rs | 12 ++--- src/libstd/unstable/extfmt.rs | 6 +-- src/libstd/unstable/finally.rs | 2 +- src/libstd/unstable/lang.rs | 4 +- src/libstd/unstable/sync.rs | 6 +-- src/libstd/vec.rs | 36 +++++++------- 68 files changed, 497 insertions(+), 509 deletions(-) diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index 42f511f722dab..93a66f6d91770 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -236,7 +236,7 @@ pub mod raw { let alloc = n * (*ty).size; let total_size = alloc + sys::size_of::>(); if alloc / (*ty).size != n || total_size < alloc { - fail!("vector size is too large: %u", n); + fail2!("vector size is too large: {}", n); } (*ptr) = local_realloc(*ptr as *(), total_size) as *mut Box>; (**ptr).data.alloc = alloc; diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index acfa02a4defd5..8118907322bf7 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -116,7 +116,7 @@ impl CString { /// /// Fails if the CString is null. pub fn with_ref(&self, f: &fn(*libc::c_char) -> T) -> T { - if self.buf.is_null() { fail!("CString is null!"); } + if self.buf.is_null() { fail2!("CString is null!"); } f(self.buf) } @@ -126,7 +126,7 @@ impl CString { /// /// Fails if the CString is null. pub fn with_mut_ref(&mut self, f: &fn(*mut libc::c_char) -> T) -> T { - if self.buf.is_null() { fail!("CString is null!"); } + if self.buf.is_null() { fail2!("CString is null!"); } f(unsafe { cast::transmute_mut_unsafe(self.buf) }) } @@ -152,7 +152,7 @@ impl CString { /// Fails if the CString is null. #[inline] pub fn as_bytes<'a>(&'a self) -> &'a [u8] { - if self.buf.is_null() { fail!("CString is null!"); } + if self.buf.is_null() { fail2!("CString is null!"); } unsafe { cast::transmute((self.buf, self.len() + 1)) } @@ -273,7 +273,7 @@ impl<'self> ToCStr for &'self [u8] { do self.as_imm_buf |self_buf, self_len| { let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8; if buf.is_null() { - fail!("failed to allocate memory!"); + fail2!("failed to allocate memory!"); } ptr::copy_memory(buf, self_buf, self_len); diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index a1459b780dfb3..4bbb0a5935aee 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -44,7 +44,7 @@ impl Cell { pub fn take(&self) -> T { let this = unsafe { transmute_mut(self) }; if this.is_empty() { - fail!("attempt to take an empty cell"); + fail2!("attempt to take an empty cell"); } this.value.take_unwrap() @@ -60,7 +60,7 @@ impl Cell { pub fn put_back(&self, value: T) { let this = unsafe { transmute_mut(self) }; if !this.is_empty() { - fail!("attempt to put a value back into a full cell"); + fail2!("attempt to put a value back into a full cell"); } this.value = Some(value); } diff --git a/src/libstd/char.rs b/src/libstd/char.rs index abb1ac5ace85b..54613adf3fec1 100644 --- a/src/libstd/char.rs +++ b/src/libstd/char.rs @@ -187,7 +187,7 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool { #[inline] pub fn to_digit(c: char, radix: uint) -> Option { if radix > 36 { - fail!("to_digit: radix %? is to high (maximum 36)", radix); + fail2!("to_digit: radix {} is to high (maximum 36)", radix); } let val = match c { '0' .. '9' => c as uint - ('0' as uint), @@ -214,7 +214,7 @@ pub fn to_digit(c: char, radix: uint) -> Option { #[inline] pub fn from_digit(num: uint, radix: uint) -> Option { if radix > 36 { - fail!("from_digit: radix %? is to high (maximum 36)", num); + fail2!("from_digit: radix {} is to high (maximum 36)", num); } if num < radix { unsafe { @@ -342,7 +342,7 @@ pub fn len_utf8_bytes(c: char) -> uint { _ if code < MAX_TWO_B => 2u, _ if code < MAX_THREE_B => 3u, _ if code < MAX_FOUR_B => 4u, - _ => fail!("invalid character!"), + _ => fail2!("invalid character!"), } } diff --git a/src/libstd/condition.rs b/src/libstd/condition.rs index 39db1df3df1c8..77f8cb937fac0 100644 --- a/src/libstd/condition.rs +++ b/src/libstd/condition.rs @@ -56,7 +56,7 @@ do my_error::cond.trap(|raised_int| { Condition handling is useful in cases where propagating errors is either to cumbersome or just not necessary in the first place. It should also be noted, though, that if there is not handler installed when a condition is raised, then -the task invokes `fail!()` and will terminate. +the task invokes `fail2!()` and will terminate. ## More Info @@ -127,8 +127,8 @@ impl Condition { /// If a handler is found, its return value is returned, otherwise this /// function will not return. pub fn raise(&self, t: T) -> U { - let msg = fmt!("Unhandled condition: %s: %?", self.name, t); - self.raise_default(t, || fail!(msg.clone())) + let msg = format!("Unhandled condition: {}: {:?}", self.name, t); + self.raise_default(t, || fail2!("{}", msg.clone())) } /// Performs the same functionality as `raise`, except that when no handler @@ -136,11 +136,11 @@ impl Condition { pub fn raise_default(&self, t: T, default: &fn() -> U) -> U { match local_data::pop(self.key) { None => { - debug!("Condition.raise: found no handler"); + debug2!("Condition.raise: found no handler"); default() } Some(handler) => { - debug!("Condition.raise: found handler"); + debug2!("Condition.raise: found handler"); match handler.prev { None => {} Some(hp) => local_data::set(self.key, hp) @@ -183,7 +183,7 @@ impl<'self, T, U> Trap<'self, T, U> { /// ``` pub fn inside(&self, inner: &'self fn() -> V) -> V { let _g = Guard { cond: self.cond }; - debug!("Trap: pushing handler to TLS"); + debug2!("Trap: pushing handler to TLS"); local_data::set(self.cond.key, self.handler); inner() } @@ -197,7 +197,7 @@ struct Guard<'self, T, U> { #[unsafe_destructor] impl<'self, T, U> Drop for Guard<'self, T, U> { fn drop(&mut self) { - debug!("Guard: popping handler from TLS"); + debug2!("Guard: popping handler from TLS"); let curr = local_data::pop(self.cond.key); match curr { None => {} @@ -216,20 +216,20 @@ mod test { } fn trouble(i: int) { - debug!("trouble: raising condition"); + debug2!("trouble: raising condition"); let j = sadness::cond.raise(i); - debug!("trouble: handler recovered with %d", j); + debug2!("trouble: handler recovered with {}", j); } fn nested_trap_test_inner() { let mut inner_trapped = false; do sadness::cond.trap(|_j| { - debug!("nested_trap_test_inner: in handler"); + debug2!("nested_trap_test_inner: in handler"); inner_trapped = true; 0 }).inside { - debug!("nested_trap_test_inner: in protected block"); + debug2!("nested_trap_test_inner: in protected block"); trouble(1); } @@ -241,10 +241,10 @@ mod test { let mut outer_trapped = false; do sadness::cond.trap(|_j| { - debug!("nested_trap_test_outer: in handler"); + debug2!("nested_trap_test_outer: in handler"); outer_trapped = true; 0 }).inside { - debug!("nested_guard_test_outer: in protected block"); + debug2!("nested_guard_test_outer: in protected block"); nested_trap_test_inner(); trouble(1); } @@ -256,13 +256,13 @@ mod test { let mut inner_trapped = false; do sadness::cond.trap(|_j| { - debug!("nested_reraise_trap_test_inner: in handler"); + debug2!("nested_reraise_trap_test_inner: in handler"); inner_trapped = true; let i = 10; - debug!("nested_reraise_trap_test_inner: handler re-raising"); + debug2!("nested_reraise_trap_test_inner: handler re-raising"); sadness::cond.raise(i) }).inside { - debug!("nested_reraise_trap_test_inner: in protected block"); + debug2!("nested_reraise_trap_test_inner: in protected block"); trouble(1); } @@ -274,10 +274,10 @@ mod test { let mut outer_trapped = false; do sadness::cond.trap(|_j| { - debug!("nested_reraise_trap_test_outer: in handler"); + debug2!("nested_reraise_trap_test_outer: in handler"); outer_trapped = true; 0 }).inside { - debug!("nested_reraise_trap_test_outer: in protected block"); + debug2!("nested_reraise_trap_test_outer: in protected block"); nested_reraise_trap_test_inner(); } @@ -289,10 +289,10 @@ mod test { let mut trapped = false; do sadness::cond.trap(|j| { - debug!("test_default: in handler"); + debug2!("test_default: in handler"); sadness::cond.raise_default(j, || { trapped=true; 5 }) }).inside { - debug!("test_default: in protected block"); + debug2!("test_default: in protected block"); trouble(1); } diff --git a/src/libstd/either.rs b/src/libstd/either.rs index 27381f64ad4a6..657212fc69227 100644 --- a/src/libstd/either.rs +++ b/src/libstd/either.rs @@ -78,7 +78,7 @@ impl Either { pub fn expect_left(self, reason: &str) -> L { match self { Left(x) => x, - Right(_) => fail!(reason.to_owned()) + Right(_) => fail2!("{}", reason.to_owned()) } } @@ -94,7 +94,7 @@ impl Either { pub fn expect_right(self, reason: &str) -> R { match self { Right(x) => x, - Left(_) => fail!(reason.to_owned()) + Left(_) => fail2!("{}", reason.to_owned()) } } diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs index 9888af9313b9d..b185b67d09cbf 100644 --- a/src/libstd/fmt/parse.rs +++ b/src/libstd/fmt/parse.rs @@ -234,7 +234,7 @@ impl<'self> Parser<'self> { Some((_, c @ '#')) | Some((_, c @ '{')) | Some((_, c @ '\\')) | Some((_, c @ '}')) => { c } Some((_, c)) => { - self.err(fmt!("invalid escape character `%c`", c)); + self.err(format!("invalid escape character `{}`", c)); c } None => { @@ -378,7 +378,7 @@ impl<'self> Parser<'self> { return None; } method => { - self.err(fmt!("unknown method: `%s`", method)); + self.err(format!("unknown method: `{}`", method)); return None; } } @@ -448,8 +448,8 @@ impl<'self> Parser<'self> { Some((_, 'f')) => { let word = self.word(); if word != "offset" { - self.err(fmt!("expected `offset`, found `%s`", - word)); + self.err(format!("expected `offset`, found `{}`", + word)); } else { if !self.consume(':') { self.err(~"`offset` must be followed by `:`"); @@ -490,7 +490,8 @@ impl<'self> Parser<'self> { "few" => Left(Few), "many" => Left(Many), word => { - self.err(fmt!("unexpected plural selector `%s`", word)); + self.err(format!("unexpected plural selector `{}`", + word)); if word == "" { break } else { diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index 4cce999532887..d63acb74acdb1 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -493,10 +493,10 @@ mod tests { } while t < 64 { - debug!("siphash test %?", t); + debug2!("siphash test {}", t); let vec = u8to64_le!(vecs[t], 0); let out = Bytes(buf.as_slice()).hash_keyed(k0, k1); - debug!("got %?, expected %?", out, vec); + debug2!("got {:?}, expected {:?}", out, vec); assert_eq!(vec, out); stream_full.reset(); @@ -504,7 +504,7 @@ mod tests { let f = stream_full.result_str(); let i = stream_inc.result_str(); let v = to_hex_str(&vecs[t]); - debug!("%d: (%s) => inc=%s full=%s", t, v, i, f); + debug2!("{}: ({}) => inc={} full={}", t, v, i, f); assert!(f == i && f == v); diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index f496e89acf75d..7b18bed009892 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -179,7 +179,7 @@ impl HashMap { fn value_for_bucket<'a>(&'a self, idx: uint) -> &'a V { match self.buckets[idx] { Some(ref bkt) => &bkt.value, - None => fail!("HashMap::find: internal logic error"), + None => fail2!("HashMap::find: internal logic error"), } } @@ -196,7 +196,7 @@ impl HashMap { /// True if there was no previous entry with that key fn insert_internal(&mut self, hash: uint, k: K, v: V) -> Option { match self.bucket_for_key_with_hash(hash, &k) { - TableFull => { fail!("Internal logic error"); } + TableFull => { fail2!("Internal logic error"); } FoundHole(idx) => { self.buckets[idx] = Some(Bucket{hash: hash, key: k, value: v}); @@ -205,7 +205,7 @@ impl HashMap { } FoundEntry(idx) => { match self.buckets[idx] { - None => { fail!("insert_internal: Internal logic error") } + None => { fail2!("insert_internal: Internal logic error") } Some(ref mut b) => { b.hash = hash; b.key = k; @@ -374,7 +374,7 @@ impl HashMap { let hash = k.hash_keyed(self.k0, self.k1) as uint; let idx = match self.bucket_for_key_with_hash(hash, &k) { - TableFull => fail!("Internal logic error"), + TableFull => fail2!("Internal logic error"), FoundEntry(idx) => { found(&k, self.mut_value_for_bucket(idx), a); idx } FoundHole(idx) => { let v = not_found(&k, a); @@ -413,7 +413,7 @@ impl HashMap { pub fn get<'a>(&'a self, k: &K) -> &'a V { match self.find(k) { Some(v) => v, - None => fail!("No entry found for key: %?", k), + None => fail2!("No entry found for key: {:?}", k), } } @@ -422,7 +422,7 @@ impl HashMap { pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V { match self.find_mut(k) { Some(v) => v, - None => fail!("No entry found for key: %?", k), + None => fail2!("No entry found for key: {:?}", k), } } @@ -826,7 +826,7 @@ mod test_map { assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { - None => fail!(), Some(x) => *x = new + None => fail2!(), Some(x) => *x = new } assert_eq!(m.find(&5), Some(&new)); } @@ -943,7 +943,7 @@ mod test_map { assert!(m.find(&1).is_none()); m.insert(1, 2); match m.find(&1) { - None => fail!(), + None => fail2!(), Some(v) => assert!(*v == 2) } } diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 859cf20fa4184..dfe517932fcf6 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -947,9 +947,8 @@ impl Reader for *libc::FILE { match libc::ferror(*self) { 0 => (), _ => { - error!("error reading buffer"); - error!("%s", os::last_os_error()); - fail!(); + error2!("error reading buffer: {}", os::last_os_error()); + fail2!(); } } } @@ -1194,9 +1193,8 @@ impl Writer for *libc::FILE { len as size_t, *self); if nout != len as size_t { - error!("error writing buffer"); - error!("%s", os::last_os_error()); - fail!(); + error2!("error writing buffer: {}", os::last_os_error()); + fail2!(); } } } @@ -1264,9 +1262,8 @@ impl Writer for fd_t { let vb = ptr::offset(vbuf, count as int) as *c_void; let nout = libc::write(*self, vb, len as IoSize); if nout < 0 as IoRet { - error!("error writing buffer"); - error!("%s", os::last_os_error()); - fail!(); + error2!("error writing buffer: {}", os::last_os_error()); + fail2!(); } count += nout as uint; } @@ -1274,12 +1271,12 @@ impl Writer for fd_t { } } fn seek(&self, _offset: int, _whence: SeekStyle) { - error!("need 64-bit foreign calls for seek, sorry"); - fail!(); + error2!("need 64-bit foreign calls for seek, sorry"); + fail2!(); } fn tell(&self) -> uint { - error!("need 64-bit foreign calls for tell, sorry"); - fail!(); + error2!("need 64-bit foreign calls for tell, sorry"); + fail2!(); } fn flush(&self) -> int { 0 } fn get_type(&self) -> WriterType { @@ -1347,7 +1344,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag]) } }; if fd < (0 as c_int) { - Err(fmt!("error opening %s: %s", path.to_str(), os::last_os_error())) + Err(format!("error opening {}: {}", path.to_str(), os::last_os_error())) } else { Ok(fd_writer(fd, true)) } @@ -1924,17 +1921,17 @@ mod tests { #[test] fn test_simple() { let tmpfile = &Path("tmp/lib-io-test-simple.tmp"); - debug!(tmpfile); + debug2!("{:?}", tmpfile); let frood: ~str = ~"A hoopy frood who really knows where his towel is."; - debug!(frood.clone()); + debug2!("{}", frood.clone()); { let out = io::file_writer(tmpfile, [io::Create, io::Truncate]).unwrap(); out.write_str(frood); } let inp = io::file_reader(tmpfile).unwrap(); let frood2: ~str = inp.read_c_str(); - debug!(frood2.clone()); + debug2!("{}", frood2.clone()); assert_eq!(frood, frood2); } @@ -1951,14 +1948,14 @@ mod tests { { let file = io::file_reader(&path).unwrap(); do file.each_byte() |_| { - fail!("must be empty") + fail2!("must be empty") }; } { let file = io::file_reader(&path).unwrap(); do file.each_char() |_| { - fail!("must be empty") + fail2!("must be empty") }; } } @@ -2045,7 +2042,7 @@ mod tests { Err(e) => { assert_eq!(e, ~"error opening not a file"); } - Ok(_) => fail!() + Ok(_) => fail2!() } } @@ -2085,7 +2082,7 @@ mod tests { Err(e) => { assert!(e.starts_with("error opening")); } - Ok(_) => fail!() + Ok(_) => fail2!() } } @@ -2095,7 +2092,7 @@ mod tests { Err(e) => { assert!(e.starts_with("error opening")); } - Ok(_) => fail!() + Ok(_) => fail2!() } } diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 4695123548bd9..f1e0eff5616c9 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -723,7 +723,7 @@ pub trait ExactSize : DoubleEndedIterator { Some(x) => { i = match i.checked_sub(&1) { Some(x) => x, - None => fail!("rposition: incorrect ExactSize") + None => fail2!("rposition: incorrect ExactSize") }; if predicate(x) { return Some(i) @@ -2452,7 +2452,7 @@ mod tests { assert!(v.iter().all(|&x| x < 10)); assert!(!v.iter().all(|&x| x.is_even())); assert!(!v.iter().all(|&x| x > 100)); - assert!(v.slice(0, 0).iter().all(|_| fail!())); + assert!(v.slice(0, 0).iter().all(|_| fail2!())); } #[test] @@ -2461,7 +2461,7 @@ mod tests { assert!(v.iter().any(|&x| x < 10)); assert!(v.iter().any(|&x| x.is_even())); assert!(!v.iter().any(|&x| x > 100)); - assert!(!v.slice(0, 0).iter().any(|_| fail!())); + assert!(!v.slice(0, 0).iter().any(|_| fail2!())); } #[test] @@ -2602,7 +2602,7 @@ mod tests { let mut i = 0; do v.iter().rposition |_elt| { if i == 2 { - fail!() + fail2!() } i += 1; false @@ -2746,12 +2746,12 @@ mod tests { fn test_double_ended_range() { assert_eq!(range(11i, 14).invert().collect::<~[int]>(), ~[13i, 12, 11]); for _ in range(10i, 0).invert() { - fail!("unreachable"); + fail2!("unreachable"); } assert_eq!(range(11u, 14).invert().collect::<~[uint]>(), ~[13u, 12, 11]); for _ in range(10u, 0).invert() { - fail!("unreachable"); + fail2!("unreachable"); } } diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 5058821d4568c..54c77e2d9f64d 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -143,8 +143,8 @@ pub fn pop(key: Key) -> Option { match *entry { Some((k, _, loan)) if k == key_value => { if loan != NoLoan { - fail!("TLS value cannot be removed because it is currently \ - borrowed as %s", loan.describe()); + fail2!("TLS value cannot be removed because it is currently \ + borrowed as {}", loan.describe()); } // Move the data out of the `entry` slot via util::replace. // This is guaranteed to succeed because we already matched @@ -240,8 +240,8 @@ fn get_with(key: Key, } (ImmLoan, ImmLoan) => {} (want, cur) => { - fail!("TLS slot cannot be borrowed as %s because \ - it is already borrowed as %s", + fail2!("TLS slot cannot be borrowed as {} because \ + it is already borrowed as {}", want.describe(), cur.describe()); } } @@ -304,8 +304,8 @@ pub fn set(key: Key, data: T) { match *entry { Some((ekey, _, loan)) if key == ekey => { if loan != NoLoan { - fail!("TLS value cannot be overwritten because it is - already borrowed as %s", loan.describe()) + fail2!("TLS value cannot be overwritten because it is + already borrowed as {}", loan.describe()) } true } @@ -388,15 +388,15 @@ mod tests { static my_key: Key<@~str> = &Key; modify(my_key, |data| { match data { - Some(@ref val) => fail!("unwelcome value: %s", *val), + Some(@ref val) => fail2!("unwelcome value: {}", *val), None => Some(@~"first data") } }); modify(my_key, |data| { match data { Some(@~"first data") => Some(@~"next data"), - Some(@ref val) => fail!("wrong value: %s", *val), - None => fail!("missing value") + Some(@ref val) => fail2!("wrong value: {}", *val), + None => fail2!("missing value") } }); assert!(*(pop(my_key).unwrap()) == ~"next data"); @@ -456,11 +456,11 @@ mod tests { set(str_key, @~"string data"); set(box_key, @@()); set(int_key, @42); - fail!(); + fail2!(); } // Not quite nondeterministic. set(int_key, @31337); - fail!(); + fail2!(); } #[test] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index d72494b625535..0b1475ff38014 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -12,16 +12,16 @@ #[doc(hidden)]; macro_rules! rterrln ( - ($( $arg:expr),+) => ( { - ::rt::util::dumb_println(fmt!( $($arg),+ )); + ($($arg:tt)*) => ( { + ::rt::util::dumb_println(format!($($arg)*)); } ) ) // Some basic logging. Enabled by passing `--cfg rtdebug` to the libstd build. macro_rules! rtdebug ( - ($( $arg:expr),+) => ( { + ($($arg:tt)*) => ( { if cfg!(rtdebug) { - rterrln!( $($arg),+ ) + rterrln!($($arg)*) } }) ) @@ -30,7 +30,7 @@ macro_rules! rtassert ( ( $arg:expr ) => ( { if ::rt::util::ENFORCE_SANITY { if !$arg { - rtabort!("assertion failed: %s", stringify!($arg)); + rtabort!("assertion failed: {}", stringify!($arg)); } } } ) @@ -38,13 +38,13 @@ macro_rules! rtassert ( macro_rules! rtabort( - ($( $msg:expr),+) => ( { - ::rt::util::abort(fmt!($($msg),+)); + ($($msg:tt)*) => ( { + ::rt::util::abort(format!($($msg)*)); } ) ) macro_rules! assert_once_ever( - ($( $msg:expr),+) => ( { + ($($msg:tt)+) => ( { // FIXME(#8472) extra function should not be needed to hide unsafe fn assert_once_ever() { unsafe { @@ -52,7 +52,8 @@ macro_rules! assert_once_ever( // Double-check lock to avoid a swap in the common case. if already_happened != 0 || ::unstable::intrinsics::atomic_xchg_relaxed(&mut already_happened, 1) != 0 { - fail!(fmt!("assert_once_ever happened twice: %s", fmt!($($msg),+))); + fail2!("assert_once_ever happened twice: {}", + format!($($msg)+)); } } } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index afa1acd08970a..8d76786c6d1ec 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -816,8 +816,8 @@ impl num::ToStrRadix for f32 { fn to_str_radix(&self, rdx: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ - try to_str_radix_special() if those are expected") } + if special { fail2!("number has a special value, \ + try to_str_radix_special() if those are expected") } r } } diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 5dbeb6c298f8f..6cd0ba6382812 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -864,8 +864,8 @@ impl num::ToStrRadix for f64 { fn to_str_radix(&self, rdx: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ - try to_str_radix_special() if those are expected") } + if special { fail2!("number has a special value, \ + try to_str_radix_special() if those are expected") } r } } diff --git a/src/libstd/num/float.rs b/src/libstd/num/float.rs index 7af47355c8c44..4f676545d4f06 100644 --- a/src/libstd/num/float.rs +++ b/src/libstd/num/float.rs @@ -181,7 +181,7 @@ impl num::ToStrRadix for float { fn to_str_radix(&self, radix: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, radix, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ + if special { fail2!("number has a special value, \ try to_str_radix_special() if those are expected") } r } @@ -1329,16 +1329,16 @@ mod tests { // note: NaN != NaN, hence this slightly complex test match from_str::("NaN") { Some(f) => assert!(f.is_nan()), - None => fail!() + None => fail2!() } // note: -0 == 0, hence these slightly more complex tests match from_str::("-0") { Some(v) if v.is_zero() => assert!(v.is_negative()), - _ => fail!() + _ => fail2!() } match from_str::("0") { Some(v) if v.is_zero() => assert!(v.is_positive()), - _ => fail!() + _ => fail2!() } assert!(from_str::("").is_none()); @@ -1376,16 +1376,16 @@ mod tests { // note: NaN != NaN, hence this slightly complex test match from_str_hex("NaN") { Some(f) => assert!(f.is_nan()), - None => fail!() + None => fail2!() } // note: -0 == 0, hence these slightly more complex tests match from_str_hex("-0") { Some(v) if v.is_zero() => assert!(v.is_negative()), - _ => fail!() + _ => fail2!() } match from_str_hex("0") { Some(v) if v.is_zero() => assert!(v.is_positive()), - _ => fail!() + _ => fail2!() } assert_eq!(from_str_hex("e"), Some(14.)); assert_eq!(from_str_hex("E"), Some(14.)); diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index ca524a255ae86..19e6a2dd0ef6b 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -474,19 +474,19 @@ pub fn from_str_bytes_common+ ) -> Option { match exponent { ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ use of 'e' as decimal exponent", radix), ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ use of 'p' as binary exponent", radix), _ if special && radix >= DIGIT_I_RADIX // first digit of 'inf' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ special values 'inf' and 'NaN'", radix), _ if (radix as int) < 2 - => fail!("from_str_bytes_common: radix %? to low, \ + => fail2!("from_str_bytes_common: radix {:?} to low, \ must lie in the range [2, 36]", radix), _ if (radix as int) > 36 - => fail!("from_str_bytes_common: radix %? to high, \ + => fail2!("from_str_bytes_common: radix {:?} to high, \ must lie in the range [2, 36]", radix), _ => () } diff --git a/src/libstd/option.rs b/src/libstd/option.rs index a8d4cf541ceeb..033515875ddc6 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -278,7 +278,7 @@ impl Option { pub fn get_ref<'a>(&'a self) -> &'a T { match *self { Some(ref x) => x, - None => fail!("called `Option::get_ref()` on a `None` value"), + None => fail2!("called `Option::get_ref()` on a `None` value"), } } @@ -298,7 +298,7 @@ impl Option { pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T { match *self { Some(ref mut x) => x, - None => fail!("called `Option::get_mut_ref()` on a `None` value"), + None => fail2!("called `Option::get_mut_ref()` on a `None` value"), } } @@ -320,7 +320,7 @@ impl Option { pub fn unwrap(self) -> T { match self { Some(x) => x, - None => fail!("called `Option::unwrap()` on a `None` value"), + None => fail2!("called `Option::unwrap()` on a `None` value"), } } @@ -333,7 +333,7 @@ impl Option { #[inline] pub fn take_unwrap(&mut self) -> T { if self.is_none() { - fail!("called `Option::take_unwrap()` on a `None` value") + fail2!("called `Option::take_unwrap()` on a `None` value") } self.take().unwrap() } @@ -348,7 +348,7 @@ impl Option { pub fn expect(self, reason: &str) -> T { match self { Some(val) => val, - None => fail!(reason.to_owned()), + None => fail2!("{}", reason.to_owned()), } } @@ -722,21 +722,23 @@ mod tests { let new_val = 11; let mut x = Some(val); - let mut it = x.mut_iter(); + { + let mut it = x.mut_iter(); - assert_eq!(it.size_hint(), (1, Some(1))); + assert_eq!(it.size_hint(), (1, Some(1))); - match it.next() { - Some(interior) => { - assert_eq!(*interior, val); - *interior = new_val; - assert_eq!(x, Some(new_val)); + match it.next() { + Some(interior) => { + assert_eq!(*interior, val); + *interior = new_val; + } + None => assert!(false), } - None => assert!(false), - } - assert_eq!(it.size_hint(), (0, Some(0))); - assert!(it.next().is_none()); + assert_eq!(it.size_hint(), (0, Some(0))); + assert!(it.next().is_none()); + } + assert_eq!(x, Some(new_val)); } #[test] diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 7df98c1d1e8b0..6d56aab3ec9d4 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -75,7 +75,7 @@ pub fn getcwd() -> Path { do buf.as_mut_buf |buf, len| { unsafe { if libc::getcwd(buf, len as size_t).is_null() { - fail!() + fail2!() } Path(str::raw::from_c_str(buf as *c_char)) @@ -182,7 +182,8 @@ pub fn env() -> ~[(~str,~str)] { }; let ch = GetEnvironmentStringsA(); if (ch as uint == 0) { - fail!("os::env() failure getting env string from OS: %s", os::last_os_error()); + fail2!("os::env() failure getting env string from OS: {}", + os::last_os_error()); } let result = str::raw::from_c_multistring(ch as *libc::c_char, None); FreeEnvironmentStringsA(ch); @@ -197,13 +198,13 @@ pub fn env() -> ~[(~str,~str)] { } let environ = rust_env_pairs(); if (environ as uint == 0) { - fail!("os::env() failure getting env string from OS: %s", os::last_os_error()); + fail2!("os::env() failure getting env string from OS: {}", + os::last_os_error()); } let mut result = ~[]; ptr::array_each(environ, |e| { let env_pair = str::raw::from_c_str(e); - debug!("get_env_pairs: %s", - env_pair); + debug2!("get_env_pairs: {}", env_pair); result.push(env_pair); }); result @@ -213,8 +214,7 @@ pub fn env() -> ~[(~str,~str)] { let mut pairs = ~[]; for p in input.iter() { let vs: ~[&str] = p.splitn_iter('=', 1).collect(); - debug!("splitting: len: %u", - vs.len()); + debug2!("splitting: len: {}", vs.len()); assert_eq!(vs.len(), 2); pairs.push((vs[0].to_owned(), vs[1].to_owned())); } @@ -443,7 +443,7 @@ fn dup2(src: c_int, dst: c_int) -> c_int { /// Returns the proper dll filename for the given basename of a file. pub fn dll_filename(base: &str) -> ~str { - fmt!("%s%s%s", DLL_PREFIX, base, DLL_SUFFIX) + format!("{}{}{}", DLL_PREFIX, base, DLL_SUFFIX) } /// Optionally returns the filesystem path to the current executable which is @@ -722,14 +722,14 @@ pub fn list_dir(p: &Path) -> ~[~str] { fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char; } let mut strings = ~[]; - debug!("os::list_dir -- BEFORE OPENDIR"); + debug2!("os::list_dir -- BEFORE OPENDIR"); let dir_ptr = do p.with_c_str |buf| { opendir(buf) }; if (dir_ptr as uint != 0) { - debug!("os::list_dir -- opendir() SUCCESS"); + debug2!("os::list_dir -- opendir() SUCCESS"); let mut entry_ptr = readdir(dir_ptr); while (entry_ptr as uint != 0) { strings.push(str::raw::from_c_str(rust_list_dir_val( @@ -739,11 +739,9 @@ pub fn list_dir(p: &Path) -> ~[~str] { closedir(dir_ptr); } else { - debug!("os::list_dir -- opendir() FAILURE"); + debug2!("os::list_dir -- opendir() FAILURE"); } - debug!( - "os::list_dir -- AFTER -- #: %?", - strings.len()); + debug2!("os::list_dir -- AFTER -- \\#: {}", strings.len()); strings } #[cfg(windows)] @@ -777,7 +775,7 @@ pub fn list_dir(p: &Path) -> ~[~str] { while more_files != 0 { let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr); if fp_buf as uint == 0 { - fail!("os::list_dir() failure: got null ptr from wfd"); + fail2!("os::list_dir() failure: got null ptr from wfd"); } else { let fp_vec = vec::from_buf( @@ -1101,7 +1099,7 @@ pub fn last_os_error() -> ~str { do buf.as_mut_buf |buf, len| { unsafe { if strerror_r(errno() as c_int, buf, len as size_t) < 0 { - fail!("strerror_r failure"); + fail2!("strerror_r failure"); } str::raw::from_c_str(buf as *c_char) @@ -1166,7 +1164,7 @@ pub fn last_os_error() -> ~str { len as DWORD, ptr::null()); if res == 0 { - fail!("[%?] FormatMessage failure", errno()); + fail2!("[%?] FormatMessage failure", errno()); } } @@ -1222,7 +1220,7 @@ fn real_args() -> ~[~str] { match rt::args::clone() { Some(args) => args, - None => fail!("process arguments not initialized") + None => fail2!("process arguments not initialized") } } @@ -1385,13 +1383,13 @@ impl to_str::ToStr for MapError { negative length or unaligned offset", ErrNoMapSupport=> ~"File doesn't support mapping", ErrNoMem => ~"Invalid address, or not enough available memory", - ErrUnknown(code) => fmt!("Unknown error=%?", code), + ErrUnknown(code) => format!("Unknown error={}", code), ErrUnsupProt => ~"Protection mode unsupported", ErrUnsupOffset => ~"Offset in virtual memory mode is unsupported", ErrAlreadyExists => ~"File mapping for specified file already exists", - ErrVirtualAlloc(code) => fmt!("VirtualAlloc failure=%?", code), - ErrCreateFileMappingW(code) => fmt!("CreateFileMappingW failure=%?", code), - ErrMapViewOfFile(code) => fmt!("MapViewOfFile failure=%?", code) + ErrVirtualAlloc(code) => format!("VirtualAlloc failure={}", code), + ErrCreateFileMappingW(code) => format!("CreateFileMappingW failure={}", code), + ErrMapViewOfFile(code) => format!("MapViewOfFile failure={}", code) } } } @@ -1466,11 +1464,11 @@ impl Drop for MemoryMap { unsafe { match libc::munmap(self.data as *c_void, self.len) { 0 => (), - -1 => error!(match errno() as c_int { - libc::EINVAL => ~"invalid addr or len", - e => fmt!("unknown errno=%?", e) - }), - r => error!(fmt!("Unexpected result %?", r)) + -1 => match errno() as c_int { + libc::EINVAL => error2!("invalid addr or len"), + e => error2!("unknown errno={}", e) + }, + r => error2!("Unexpected result {}", r) } } } @@ -1598,15 +1596,15 @@ impl Drop for MemoryMap { if libc::VirtualFree(self.data as *mut c_void, self.len, libc::MEM_RELEASE) == FALSE { - error!(fmt!("VirtualFree failed: %?", errno())); + error!(format!("VirtualFree failed: {}", errno())); } }, MapFile(mapping) => { if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE { - error!(fmt!("UnmapViewOfFile failed: %?", errno())); + error!(format!("UnmapViewOfFile failed: {}", errno())); } if libc::CloseHandle(mapping as HANDLE) == FALSE { - error!(fmt!("CloseHandle failed: %?", errno())); + error!(format!("CloseHandle failed: {}", errno())); } } } @@ -1727,7 +1725,7 @@ mod tests { #[test] pub fn last_os_error() { - debug!(os::last_os_error()); + debug2!("{}", os::last_os_error()); } #[test] @@ -1782,7 +1780,7 @@ mod tests { } let n = make_rand_name(); setenv(n, s); - debug!(s.clone()); + debug2!("{}", s.clone()); assert_eq!(getenv(n), option::Some(s)); } @@ -1791,7 +1789,7 @@ mod tests { let path = os::self_exe_path(); assert!(path.is_some()); let path = path.unwrap(); - debug!(path.clone()); + debug2!("{:?}", path.clone()); // Hard to test this function assert!(path.is_absolute); @@ -1804,7 +1802,7 @@ mod tests { assert!(e.len() > 0u); for p in e.iter() { let (n, v) = (*p).clone(); - debug!(n.clone()); + debug2!("{:?}", n.clone()); let v2 = getenv(n); // MingW seems to set some funky environment variables like // "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned @@ -1829,10 +1827,10 @@ mod tests { fn test() { assert!((!Path("test-path").is_absolute)); - debug!("Current working directory: %s", getcwd().to_str()); + debug2!("Current working directory: {}", getcwd().to_str()); - debug!(make_absolute(&Path("test-path"))); - debug!(make_absolute(&Path("/usr/bin"))); + debug2!("{:?}", make_absolute(&Path("test-path"))); + debug2!("{:?}", make_absolute(&Path("/usr/bin"))); } #[test] @@ -1895,7 +1893,7 @@ mod tests { assert!(dirs.len() > 0u); for dir in dirs.iter() { - debug!((*dir).clone()); + debug2!("{:?}", (*dir).clone()); } } @@ -1969,7 +1967,7 @@ mod tests { let in_mode = input.get_mode(); let rs = os::copy_file(&input, &out); if (!os::path_exists(&input)) { - fail!("%s doesn't exist", input.to_str()); + fail2!("{} doesn't exist", input.to_str()); } assert!((rs)); let rslt = run::process_status("diff", [input.to_str(), out.to_str()]); @@ -2001,7 +1999,7 @@ mod tests { os::MapWritable ]) { Ok(chunk) => chunk, - Err(msg) => fail!(msg.to_str()) + Err(msg) => fail2!(msg.to_str()) }; assert!(chunk.len >= 16); @@ -2057,7 +2055,7 @@ mod tests { MapOffset(size / 2) ]) { Ok(chunk) => chunk, - Err(msg) => fail!(msg.to_str()) + Err(msg) => fail2!(msg.to_str()) }; assert!(chunk.len > 0); diff --git a/src/libstd/path.rs b/src/libstd/path.rs index af2565ec67a36..0d4bcb4ec47f9 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -134,8 +134,8 @@ pub trait GenericPath : Clone + Eq + ToStr { match (t.len(), self.filestem()) { (0, None) => (*self).clone(), (0, Some(ref s)) => self.with_filename(*s), - (_, None) => self.with_filename(fmt!(".%s", t)), - (_, Some(ref s)) => self.with_filename(fmt!("%s.%s", *s, t)), + (_, None) => self.with_filename(format!(".{}", t)), + (_, Some(ref s)) => self.with_filename(format!("{}.{}", *s, t)), } } @@ -190,7 +190,7 @@ pub trait GenericPath : Clone + Eq + ToStr { /// True if `self` is an ancestor of `other`. // See `test_is_ancestor_of` for examples. fn is_ancestor_of(&self, other: &Self) -> bool { - debug!("%s / %s %? %?", self.to_str(), other.to_str(), self.is_absolute(), + debug2!("{} / {} {} {}", self.to_str(), other.to_str(), self.is_absolute(), self.components().len()); self == other || (!other.components().is_empty() && @@ -1101,8 +1101,8 @@ mod tests { let ss = wp.to_str(); let sss = s.to_owned(); if (ss != sss) { - debug!("got %s", ss); - debug!("expected %s", sss); + debug2!("got {}", ss); + debug2!("expected {}", sss); assert_eq!(ss, sss); } } @@ -1167,8 +1167,8 @@ mod tests { let ss = wp.to_str(); let sss = s.to_owned(); if (ss != sss) { - debug!("got %s", ss); - debug!("expected %s", sss); + debug2!("got {}", ss); + debug2!("expected {}", sss); assert_eq!(ss, sss); } } @@ -1230,8 +1230,8 @@ mod tests { let ss = wp.to_str(); let sss = s.to_owned(); if (ss != sss) { - debug!("got %s", ss); - debug!("expected %s", sss); + debug2!("got {}", ss); + debug2!("expected {}", sss); assert_eq!(ss, sss); } } @@ -1448,7 +1448,7 @@ mod tests { let p2 = PosixPath("/home/brian/Dev/rust/build/stage2/bin/..").push_rel( &PosixPath("lib/rustc/i686-unknown-linux-gnu/lib/libstd.so")); let res = p1.get_relative_to(&p2); - debug!("test_relative_to8: %s vs. %s", + debug2!("test_relative_to8: {} vs. {}", res.to_str(), PosixPath(".").to_str()); assert_eq!(res, PosixPath(".")); @@ -1458,7 +1458,7 @@ mod tests { let p2 = WindowsPath("\\home\\brian\\Dev\\rust\\build\\stage2\\bin\\..").push_rel( &WindowsPath("lib\\rustc\\i686-unknown-linux-gnu\\lib\\libstd.so")); let res = p1.get_relative_to(&p2); - debug!("test_relative_to8: %s vs. %s", + debug2!("test_relative_to8: {} vs. {}", res.to_str(), WindowsPath(".").to_str()); assert_eq!(res, WindowsPath(".")); diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 135acb106a178..c27665d76985a 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -236,16 +236,16 @@ pub fn to_mut_unsafe_ptr(thing: &mut T) -> *mut T { SAFETY NOTE: Pointer-arithmetic. Dragons be here. */ pub unsafe fn array_each_with_len(arr: **T, len: uint, cb: &fn(*T)) { - debug!("array_each_with_len: before iterate"); + debug2!("array_each_with_len: before iterate"); if (arr as uint == 0) { - fail!("ptr::array_each_with_len failure: arr input is null pointer"); + fail2!("ptr::array_each_with_len failure: arr input is null pointer"); } //let start_ptr = *arr; for e in range(0, len) { let n = offset(arr, e as int); cb(*n); } - debug!("array_each_with_len: after iterate"); + debug2!("array_each_with_len: after iterate"); } /** @@ -259,11 +259,10 @@ pub unsafe fn array_each_with_len(arr: **T, len: uint, cb: &fn(*T)) { */ pub unsafe fn array_each(arr: **T, cb: &fn(*T)) { if (arr as uint == 0) { - fail!("ptr::array_each_with_len failure: arr input is null pointer"); + fail2!("ptr::array_each_with_len failure: arr input is null pointer"); } let len = buf_len(arr); - debug!("array_each inferred len: %u", - len); + debug2!("array_each inferred len: {}", len); array_each_with_len(arr, len, cb); } @@ -670,8 +669,8 @@ pub mod ptr_tests { let expected = do expected_arr[ctr].with_ref |buf| { str::raw::from_c_str(buf) }; - debug!( - "test_ptr_array_each_with_len e: %s, a: %s", + debug2!( + "test_ptr_array_each_with_len e: {}, a: {}", expected, actual); assert_eq!(actual, expected); ctr += 1; @@ -707,8 +706,8 @@ pub mod ptr_tests { let expected = do expected_arr[ctr].with_ref |buf| { str::raw::from_c_str(buf) }; - debug!( - "test_ptr_array_each e: %s, a: %s", + debug2!( + "test_ptr_array_each e: {}, a: {}", expected, actual); assert_eq!(actual, expected); ctr += 1; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 2b9727f6eb0e4..cc0e843b89650 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -897,7 +897,7 @@ mod test { let mut ra = IsaacRng::new_seeded(seed); // Regression test that isaac is actually using the above vector let r = ra.next(); - error!("%?", r); + debug2!("{:?}", r); assert!(r == 890007737u32 // on x86_64 || r == 2935188040u32); // on x86 } @@ -940,7 +940,7 @@ mod test { let mut r = rng(); let a = r.gen::(); let b = r.gen::(); - debug!((a, b)); + debug2!("{:?}", (a, b)); } #[test] @@ -953,9 +953,9 @@ mod test { #[test] fn test_gen_ascii_str() { let mut r = rng(); - debug!(r.gen_ascii_str(10u)); - debug!(r.gen_ascii_str(10u)); - debug!(r.gen_ascii_str(10u)); + debug2!("{}", r.gen_ascii_str(10u)); + debug2!("{}", r.gen_ascii_str(10u)); + debug2!("{}", r.gen_ascii_str(10u)); assert_eq!(r.gen_ascii_str(0u).len(), 0u); assert_eq!(r.gen_ascii_str(10u).len(), 10u); assert_eq!(r.gen_ascii_str(16u).len(), 16u); diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index e3a6e4b5f85ac..e9d1accbd4795 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -189,7 +189,7 @@ impl<'self> ReprVisitor<'self> { } else if mtbl == 1 { // skip, this is ast::m_imm } else { - fail!("invalid mutability value"); + fail2!("invalid mutability value"); } } @@ -312,7 +312,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { // Type no longer exists, vestigial function. fn visit_estr_fixed(&mut self, _n: uint, _sz: uint, - _align: uint) -> bool { fail!(); } + _align: uint) -> bool { fail2!(); } fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool { self.writer.write(['@' as u8]); @@ -355,7 +355,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { } // Type no longer exists, vestigial function. - fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail!(); } + fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail2!(); } fn visit_unboxed_vec(&mut self, mtbl: uint, inner: *TyDesc) -> bool { do self.get::> |this, b| { @@ -567,7 +567,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { _align: uint) -> bool { match self.var_stk.pop() { - SearchingFor(*) => fail!("enum value matched no variant"), + SearchingFor(*) => fail2!("enum value matched no variant"), _ => true } } diff --git a/src/libstd/result.rs b/src/libstd/result.rs index a1980aa70e344..34efe1cfbf14b 100644 --- a/src/libstd/result.rs +++ b/src/libstd/result.rs @@ -46,7 +46,8 @@ impl Result { pub fn get_ref<'a>(&'a self) -> &'a T { match *self { Ok(ref t) => t, - Err(ref e) => fail!("called `Result::get_ref()` on `Err` value: %s", e.to_str()), + Err(ref e) => fail2!("called `Result::get_ref()` on `Err` value: {}", + e.to_str()), } } @@ -106,7 +107,8 @@ impl Result { pub fn unwrap(self) -> T { match self { Ok(t) => t, - Err(e) => fail!("called `Result::unwrap()` on `Err` value: %s", e.to_str()), + Err(e) => fail2!("called `Result::unwrap()` on `Err` value: {}", + e.to_str()), } } @@ -123,7 +125,7 @@ impl Result { pub fn expect(self, reason: &str) -> T { match self { Ok(t) => t, - Err(_) => fail!(reason.to_owned()), + Err(_) => fail2!("{}", reason.to_owned()), } } @@ -133,7 +135,7 @@ impl Result { pub fn expect_err(self, reason: &str) -> E { match self { Err(e) => e, - Ok(_) => fail!(reason.to_owned()), + Ok(_) => fail2!("{}", reason.to_owned()), } } @@ -547,7 +549,7 @@ mod tests { Err(2)); // test that it does not take more elements than it needs - let functions = [|| Ok(()), || Err(1), || fail!()]; + let functions = [|| Ok(()), || Err(1), || fail2!()]; assert_eq!(collect(functions.iter().map(|f| (*f)())), Err(1)); @@ -567,7 +569,7 @@ mod tests { Err(2)); // test that it does not take more elements than it needs - let functions = [|| Ok(()), || Err(1), || fail!()]; + let functions = [|| Ok(()), || Err(1), || fail2!()]; assert_eq!(fold_(functions.iter() .map(|f| (*f)())), diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index d8317c34f506b..100ea3e05461f 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -163,14 +163,14 @@ mod imp { } pub fn take() -> Option<~[~str]> { - fail!() + fail2!() } pub fn put(_args: ~[~str]) { - fail!() + fail2!() } pub fn clone() -> Option<~[~str]> { - fail!() + fail2!() } } diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index 9dc0abdfbd88a..d703272420cbb 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -78,7 +78,7 @@ unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) { msg.push_str(sep); let filename = str::raw::from_c_str(entry.file); msg.push_str(filename); - msg.push_str(fmt!(":%u", entry.line as uint)); + msg.push_str(format!(":{}", entry.line)); sep = " and at "; } } @@ -221,7 +221,7 @@ pub unsafe fn unrecord_borrow(a: *u8, old_ref_count: uint, assert!(!borrow_list.is_empty()); let br = borrow_list.pop(); if br.box != a || br.file != file || br.line != line { - let err = fmt!("wrong borrow found, br=%?", br); + let err = format!("wrong borrow found, br={:?}", br); do err.with_c_str |msg_p| { sys::begin_unwind_(msg_p, file, line) } diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index d7b4446917768..7d61b556bb595 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -196,7 +196,7 @@ impl PortOne { match self.try_recv() { Some(val) => val, None => { - fail!("receiving on closed channel"); + fail2!("receiving on closed channel"); } } } @@ -495,7 +495,7 @@ impl GenericPort for Port { match self.try_recv() { Some(val) => val, None => { - fail!("receiving on closed channel"); + fail2!("receiving on closed channel"); } } } @@ -650,7 +650,7 @@ impl GenericPort for SharedPort { match self.try_recv() { Some(val) => val, None => { - fail!("receiving on a closed channel"); + fail2!("receiving on a closed channel"); } } } @@ -770,7 +770,7 @@ mod test { port.recv(); }; // What is our res? - rtdebug!("res is: %?", res.is_err()); + rtdebug!("res is: {:?}", res.is_err()); assert!(res.is_err()); } } diff --git a/src/libstd/rt/context.rs b/src/libstd/rt/context.rs index 476554bf7f7be..853cc08a0ba77 100644 --- a/src/libstd/rt/context.rs +++ b/src/libstd/rt/context.rs @@ -167,9 +167,9 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, unsafe { *sp = 0; } rtdebug!("creating call frame"); - rtdebug!("fptr %x", fptr as uint); - rtdebug!("arg %x", arg as uint); - rtdebug!("sp %x", sp as uint); + rtdebug!("fptr {}", fptr as uint); + rtdebug!("arg {}", arg as uint); + rtdebug!("sp {}", sp as uint); regs[RUSTRT_ARG0] = arg as uint; regs[RUSTRT_RSP] = sp as uint; diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index e7876cf65716f..2844cc81892dd 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -85,7 +85,7 @@ unsafe fn entries(crate_map: *CrateMap) -> *ModEntry { return (*v0).entries; } 1 => return (*crate_map).entries, - _ => fail!("Unknown crate map version!") + _ => fail2!("Unknown crate map version!") } } @@ -96,7 +96,7 @@ unsafe fn iterator(crate_map: *CrateMap) -> **CrateMap { return vec::raw::to_ptr((*v0).children); } 1 => return vec::raw::to_ptr((*crate_map).children), - _ => fail!("Unknown crate map version!") + _ => fail2!("Unknown crate map version!") } } diff --git a/src/libstd/rt/io/comm_adapters.rs b/src/libstd/rt/io/comm_adapters.rs index 06424fee8bc12..495d1f97cd2ba 100644 --- a/src/libstd/rt/io/comm_adapters.rs +++ b/src/libstd/rt/io/comm_adapters.rs @@ -15,45 +15,45 @@ use super::{Reader, Writer}; struct PortReader

; impl> PortReader

{ - pub fn new(_port: P) -> PortReader

{ fail!() } + pub fn new(_port: P) -> PortReader

{ fail2!() } } impl> Reader for PortReader

{ - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } struct ChanWriter; impl> ChanWriter { - pub fn new(_chan: C) -> ChanWriter { fail!() } + pub fn new(_chan: C) -> ChanWriter { fail2!() } } impl> Writer for ChanWriter { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } struct ReaderPort; impl ReaderPort { - pub fn new(_reader: R) -> ReaderPort { fail!() } + pub fn new(_reader: R) -> ReaderPort { fail2!() } } impl GenericPort<~[u8]> for ReaderPort { - fn recv(&self) -> ~[u8] { fail!() } + fn recv(&self) -> ~[u8] { fail2!() } - fn try_recv(&self) -> Option<~[u8]> { fail!() } + fn try_recv(&self) -> Option<~[u8]> { fail2!() } } struct WriterChan; impl WriterChan { - pub fn new(_writer: W) -> WriterChan { fail!() } + pub fn new(_writer: W) -> WriterChan { fail2!() } } impl GenericChan<~[u8]> for WriterChan { - fn send(&self, _x: ~[u8]) { fail!() } + fn send(&self, _x: ~[u8]) { fail2!() } } diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/rt/io/extensions.rs index 99634b532b082..69f0423bf5d37 100644 --- a/src/libstd/rt/io/extensions.rs +++ b/src/libstd/rt/io/extensions.rs @@ -288,7 +288,7 @@ impl ReaderUtil for T { let mut buf = [0]; match self.read(buf) { Some(0) => { - debug!("read 0 bytes. trying again"); + debug2!("read 0 bytes. trying again"); self.read_byte() } Some(1) => Some(buf[0]), diff --git a/src/libstd/rt/io/file.rs b/src/libstd/rt/io/file.rs index b11ee014af9fc..a18eec8773ebd 100644 --- a/src/libstd/rt/io/file.rs +++ b/src/libstd/rt/io/file.rs @@ -59,7 +59,7 @@ use path::Path; /// }).inside { /// let stream = match open(p, Create, ReadWrite) { /// Some(s) => s, -/// None => fail!("whoops! I'm sure this raised, anyways.."); +/// None => fail2!("whoops! I'm sure this raised, anyways.."); /// } /// // do some stuff with that stream /// @@ -223,7 +223,7 @@ pub fn rmdir(path: &P) { /// }).inside { /// let info = match stat(p) { /// Some(s) => s, -/// None => fail!("whoops! I'm sure this raised, anyways.."); +/// None => fail2!("whoops! I'm sure this raised, anyways.."); /// } /// if stat.is_file { /// // just imagine the possibilities ... @@ -271,7 +271,7 @@ pub fn stat(path: &P) -> Option { /// else { cb(entry); } /// } /// } -/// else { fail!("nope"); } +/// else { fail2!("nope"); } /// } /// /// # Errors @@ -596,7 +596,7 @@ impl FileInfo for Path { } /// else { cb(entry); } /// } /// } -/// else { fail!("nope"); } +/// else { fail2!("nope"); } /// } /// ``` trait DirectoryInfo : FileSystemInfo { @@ -631,7 +631,8 @@ trait DirectoryInfo : FileSystemInfo { kind: PathAlreadyExists, desc: "Path already exists", detail: - Some(fmt!("%s already exists; can't mkdir it", self.get_path().to_str())) + Some(format!("{} already exists; can't mkdir it", + self.get_path().to_str())) }) }, None => mkdir(self.get_path()) @@ -657,8 +658,8 @@ trait DirectoryInfo : FileSystemInfo { let ioerr = IoError { kind: MismatchedFileTypeForOperation, desc: "Cannot do rmdir() on a non-directory", - detail: Some(fmt!( - "%s is a non-directory; can't rmdir it", + detail: Some(format!( + "{} is a non-directory; can't rmdir it", self.get_path().to_str())) }; io_error::cond.raise(ioerr); @@ -669,7 +670,8 @@ trait DirectoryInfo : FileSystemInfo { io_error::cond.raise(IoError { kind: PathDoesntExist, desc: "Path doesn't exist", - detail: Some(fmt!("%s doesn't exist; can't rmdir it", self.get_path().to_str())) + detail: Some(format!("{} doesn't exist; can't rmdir it", + self.get_path().to_str())) }) } } @@ -707,7 +709,7 @@ mod test { let mut read_stream = open(filename, Open, Read).unwrap(); let mut read_buf = [0, .. 1028]; let read_str = match read_stream.read(read_buf).unwrap() { - -1|0 => fail!("shouldn't happen"), + -1|0 => fail2!("shouldn't happen"), n => str::from_utf8(read_buf.slice_to(n)) }; assert!(read_str == message.to_owned()); @@ -875,7 +877,7 @@ mod test { } let stat_res = match stat(filename) { Some(s) => s, - None => fail!("shouldn't happen") + None => fail2!("shouldn't happen") }; assert!(stat_res.is_file); unlink(filename); @@ -889,7 +891,7 @@ mod test { mkdir(filename); let stat_res = match stat(filename) { Some(s) => s, - None => fail!("shouldn't happen") + None => fail2!("shouldn't happen") }; assert!(stat_res.is_dir); rmdir(filename); @@ -942,7 +944,7 @@ mod test { dir.mkdir(); let prefix = "foo"; for n in range(0,3) { - let f = dir.push(fmt!("%d.txt", n)); + let f = dir.push(format!("{}.txt", n)); let mut w = f.open_writer(Create); let msg_str = (prefix + n.to_str().to_owned()).to_owned(); let msg = msg_str.as_bytes(); @@ -959,14 +961,14 @@ mod test { let read_str = str::from_utf8(mem); let expected = match n { Some(n) => prefix+n, - None => fail!("really shouldn't happen..") + None => fail2!("really shouldn't happen..") }; assert!(expected == read_str); } f.unlink(); } }, - None => fail!("shouldn't happen") + None => fail2!("shouldn't happen") } dir.rmdir(); } diff --git a/src/libstd/rt/io/flate.rs b/src/libstd/rt/io/flate.rs index 7c72ce6ba891e..72029d07263e3 100644 --- a/src/libstd/rt/io/flate.rs +++ b/src/libstd/rt/io/flate.rs @@ -29,9 +29,9 @@ impl DeflateWriter { } impl Writer for DeflateWriter { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } impl Decorator for DeflateWriter { @@ -68,9 +68,9 @@ impl InflateReader { } impl Reader for InflateReader { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Decorator for InflateReader { diff --git a/src/libstd/rt/io/mem.rs b/src/libstd/rt/io/mem.rs index 5f6b4398c22f7..1f396a4476e1e 100644 --- a/src/libstd/rt/io/mem.rs +++ b/src/libstd/rt/io/mem.rs @@ -40,7 +40,7 @@ impl Writer for MemWriter { impl Seek for MemWriter { fn tell(&self) -> u64 { self.buf.len() as u64 } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } impl Decorator<~[u8]> for MemWriter { @@ -102,7 +102,7 @@ impl Reader for MemReader { impl Seek for MemReader { fn tell(&self) -> u64 { self.pos as u64 } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } impl Decorator<~[u8]> for MemReader { @@ -143,15 +143,15 @@ impl<'self> BufWriter<'self> { } impl<'self> Writer for BufWriter<'self> { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } impl<'self> Seek for BufWriter<'self> { - fn tell(&self) -> u64 { fail!() } + fn tell(&self) -> u64 { fail2!() } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } @@ -193,7 +193,7 @@ impl<'self> Reader for BufReader<'self> { impl<'self> Seek for BufReader<'self> { fn tell(&self) -> u64 { self.pos as u64 } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } ///Calls a function with a MemWriter and returns diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index 70fcf442f3fd5..c2f137ba119ab 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -585,7 +585,7 @@ pub fn standard_error(kind: IoErrorKind) -> IoError { detail: None } } - _ => fail!() + _ => fail2!() } } diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs index 31c90336a24c2..f5f77f4e853f9 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/rt/io/native/file.rs @@ -25,25 +25,25 @@ impl FileDesc { /// /// The `FileDesc` takes ownership of the file descriptor /// and will close it upon destruction. - pub fn new(_fd: fd_t) -> FileDesc { fail!() } + pub fn new(_fd: fd_t) -> FileDesc { fail2!() } } impl Reader for FileDesc { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for FileDesc { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } impl Seek for FileDesc { - fn tell(&self) -> u64 { fail!() } + fn tell(&self) -> u64 { fail2!() } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } pub struct CFile(*FILE); @@ -53,22 +53,22 @@ impl CFile { /// /// The `CFile` takes ownership of the file descriptor /// and will close it upon destruction. - pub fn new(_file: *FILE) -> CFile { fail!() } + pub fn new(_file: *FILE) -> CFile { fail2!() } } impl Reader for CFile { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for CFile { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } impl Seek for CFile { - fn tell(&self) -> u64 { fail!() } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } + fn tell(&self) -> u64 { fail2!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } } diff --git a/src/libstd/rt/io/net/ip.rs b/src/libstd/rt/io/net/ip.rs index 78d5163864f29..6a6619cc54820 100644 --- a/src/libstd/rt/io/net/ip.rs +++ b/src/libstd/rt/io/net/ip.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use num::FromStrRadix; use vec::MutableCloneableVector; use to_str::ToStr; use from_str::FromStr; @@ -27,37 +26,22 @@ impl ToStr for IpAddr { fn to_str(&self) -> ~str { match *self { Ipv4Addr(a, b, c, d) => - fmt!("%u.%u.%u.%u", - a as uint, b as uint, c as uint, d as uint), + format!("{}.{}.{}.{}", a, b, c, d), // Ipv4 Compatible address Ipv6Addr(0, 0, 0, 0, 0, 0, g, h) => { - let a = fmt!("%04x", g as uint); - let b = FromStrRadix::from_str_radix(a.slice(2, 4), 16).unwrap(); - let a = FromStrRadix::from_str_radix(a.slice(0, 2), 16).unwrap(); - let c = fmt!("%04x", h as uint); - let d = FromStrRadix::from_str_radix(c.slice(2, 4), 16).unwrap(); - let c = FromStrRadix::from_str_radix(c.slice(0, 2), 16).unwrap(); - - fmt!("::%u.%u.%u.%u", a, b, c, d) + format!("::{}.{}.{}.{}", (g >> 8) as u8, g as u8, + (h >> 8) as u8, h as u8) } // Ipv4-Mapped address Ipv6Addr(0, 0, 0, 0, 0, 0xFFFF, g, h) => { - let a = fmt!("%04x", g as uint); - let b = FromStrRadix::from_str_radix(a.slice(2, 4), 16).unwrap(); - let a = FromStrRadix::from_str_radix(a.slice(0, 2), 16).unwrap(); - let c = fmt!("%04x", h as uint); - let d = FromStrRadix::from_str_radix(c.slice(2, 4), 16).unwrap(); - let c = FromStrRadix::from_str_radix(c.slice(0, 2), 16).unwrap(); - - fmt!("::FFFF:%u.%u.%u.%u", a, b, c, d) + format!("::FFFF:{}.{}.{}.{}", (g >> 8) as u8, g as u8, + (h >> 8) as u8, h as u8) } Ipv6Addr(a, b, c, d, e, f, g, h) => - fmt!("%x:%x:%x:%x:%x:%x:%x:%x", - a as uint, b as uint, c as uint, d as uint, - e as uint, f as uint, g as uint, h as uint) + format!("{}:{}:{}:{}:{}:{}:{}:{}", a, b, c, d, e, f, g, h) } } } @@ -72,8 +56,8 @@ pub struct SocketAddr { impl ToStr for SocketAddr { fn to_str(&self) -> ~str { match self.ip { - Ipv4Addr(*) => fmt!("%s:%u", self.ip.to_str(), self.port as uint), - Ipv6Addr(*) => fmt!("[%s]:%u", self.ip.to_str(), self.port as uint), + Ipv4Addr(*) => format!("{}:{}", self.ip.to_str(), self.port), + Ipv6Addr(*) => format!("[{}]:{}", self.ip.to_str(), self.port), } } } diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs index 55abc4ab13586..c1cda5ad68116 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/rt/io/net/tcp.rs @@ -38,7 +38,7 @@ impl TcpStream { match stream { Ok(s) => Some(TcpStream::new(s)), Err(ioerr) => { - rtdebug!("failed to connect: %?", ioerr); + rtdebug!("failed to connect: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -49,7 +49,7 @@ impl TcpStream { match (**self).peer_name() { Ok(pn) => Some(pn), Err(ioerr) => { - rtdebug!("failed to get peer name: %?", ioerr); + rtdebug!("failed to get peer name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -60,7 +60,7 @@ impl TcpStream { match (**self).socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: %?", ioerr); + rtdebug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -82,7 +82,7 @@ impl Reader for TcpStream { } } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for TcpStream { @@ -117,7 +117,7 @@ impl TcpListener { match (**self).socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: %?", ioerr); + rtdebug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/rt/io/net/udp.rs index a65c918351ad9..e47b9b9e925cb 100644 --- a/src/libstd/rt/io/net/udp.rs +++ b/src/libstd/rt/io/net/udp.rs @@ -61,7 +61,7 @@ impl UdpSocket { match (***self).socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: %?", ioerr); + rtdebug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -92,7 +92,7 @@ impl Reader for UdpStream { } } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for UdpStream { @@ -102,7 +102,7 @@ impl Writer for UdpStream { } } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } #[cfg(test)] @@ -151,10 +151,10 @@ mod test { assert_eq!(buf[0], 99); assert_eq!(src, client_ip); } - None => fail!() + None => fail2!() } } - None => fail!() + None => fail2!() } } @@ -164,7 +164,7 @@ mod test { port.take().recv(); client.sendto([99], server_ip) } - None => fail!() + None => fail2!() } } } @@ -190,10 +190,10 @@ mod test { assert_eq!(buf[0], 99); assert_eq!(src, client_ip); } - None => fail!() + None => fail2!() } } - None => fail!() + None => fail2!() } } @@ -203,7 +203,7 @@ mod test { port.take().recv(); client.sendto([99], server_ip) } - None => fail!() + None => fail2!() } } } @@ -230,10 +230,10 @@ mod test { assert_eq!(nread, 1); assert_eq!(buf[0], 99); } - None => fail!() + None => fail2!() } } - None => fail!() + None => fail2!() } } @@ -245,7 +245,7 @@ mod test { port.take().recv(); stream.write([99]); } - None => fail!() + None => fail2!() } } } @@ -272,10 +272,10 @@ mod test { assert_eq!(nread, 1); assert_eq!(buf[0], 99); } - None => fail!() + None => fail2!() } } - None => fail!() + None => fail2!() } } @@ -287,7 +287,7 @@ mod test { port.take().recv(); stream.write([99]); } - None => fail!() + None => fail2!() } } } diff --git a/src/libstd/rt/io/net/unix.rs b/src/libstd/rt/io/net/unix.rs index 1771a963ba78c..07de33935ee2a 100644 --- a/src/libstd/rt/io/net/unix.rs +++ b/src/libstd/rt/io/net/unix.rs @@ -16,36 +16,36 @@ pub struct UnixStream; impl UnixStream { pub fn connect(_path: &P) -> Option { - fail!() + fail2!() } } impl Reader for UnixStream { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for UnixStream { - fn write(&mut self, _v: &[u8]) { fail!() } + fn write(&mut self, _v: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } pub struct UnixListener; impl UnixListener { pub fn bind(_path: &P) -> Option { - fail!() + fail2!() } } impl Listener for UnixListener { - fn listen(self) -> Option { fail!() } + fn listen(self) -> Option { fail2!() } } pub struct UnixAcceptor; impl Acceptor for UnixAcceptor { - fn accept(&mut self) -> Option { fail!() } + fn accept(&mut self) -> Option { fail2!() } } diff --git a/src/libstd/rt/io/pipe.rs b/src/libstd/rt/io/pipe.rs index 7e6c59ffd0b7a..4186cce8c8d00 100644 --- a/src/libstd/rt/io/pipe.rs +++ b/src/libstd/rt/io/pipe.rs @@ -59,7 +59,7 @@ impl Reader for PipeStream { } } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } impl Writer for PipeStream { @@ -72,5 +72,5 @@ impl Writer for PipeStream { } } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/rt/io/stdio.rs index 57bec79563f2e..734a40429a62f 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/rt/io/stdio.rs @@ -11,15 +11,15 @@ use prelude::*; use super::{Reader, Writer}; -pub fn stdin() -> StdReader { fail!() } +pub fn stdin() -> StdReader { fail2!() } -pub fn stdout() -> StdWriter { fail!() } +pub fn stdout() -> StdWriter { fail2!() } -pub fn stderr() -> StdReader { fail!() } +pub fn stderr() -> StdReader { fail2!() } -pub fn print(_s: &str) { fail!() } +pub fn print(_s: &str) { fail2!() } -pub fn println(_s: &str) { fail!() } +pub fn println(_s: &str) { fail2!() } pub enum StdStream { StdIn, @@ -30,23 +30,23 @@ pub enum StdStream { pub struct StdReader; impl StdReader { - pub fn new(_stream: StdStream) -> StdReader { fail!() } + pub fn new(_stream: StdStream) -> StdReader { fail2!() } } impl Reader for StdReader { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } - fn eof(&mut self) -> bool { fail!() } + fn eof(&mut self) -> bool { fail2!() } } pub struct StdWriter; impl StdWriter { - pub fn new(_stream: StdStream) -> StdWriter { fail!() } + pub fn new(_stream: StdStream) -> StdWriter { fail2!() } } impl Writer for StdWriter { - fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail2!() } - fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail2!() } } diff --git a/src/libstd/rt/io/timer.rs b/src/libstd/rt/io/timer.rs index 53e4c4051e1c3..19b33feacbd86 100644 --- a/src/libstd/rt/io/timer.rs +++ b/src/libstd/rt/io/timer.rs @@ -36,7 +36,7 @@ impl Timer { match timer { Ok(t) => Some(Timer(t)), Err(ioerr) => { - rtdebug!("Timer::init: failed to init: %?", ioerr); + rtdebug!("Timer::init: failed to init: {:?}", ioerr); io_error::cond.raise(ioerr); None } diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs index 6563ac2e96f9e..09f99b9302eeb 100644 --- a/src/libstd/rt/kill.rs +++ b/src/libstd/rt/kill.rs @@ -306,7 +306,7 @@ impl BlockedTask { match flag.compare_and_swap(KILL_RUNNING, task_ptr, Relaxed) { KILL_RUNNING => Right(Killable(flag_arc)), KILL_KILLED => Left(revive_task_ptr(task_ptr, Some(flag_arc))), - x => rtabort!("can't block task! kill flag = %?", x), + x => rtabort!("can't block task! kill flag = {}", x), } } } @@ -403,7 +403,7 @@ impl KillHandle { // FIXME(#7544)(bblum): is it really necessary to prohibit double kill? match inner.unkillable.compare_and_swap(KILL_RUNNING, KILL_UNKILLABLE, Relaxed) { KILL_RUNNING => { }, // normal case - KILL_KILLED => if !already_failing { fail!(KILLED_MSG) }, + KILL_KILLED => if !already_failing { fail2!("{}", KILLED_MSG) }, _ => rtabort!("inhibit_kill: task already unkillable"), } } @@ -416,7 +416,7 @@ impl KillHandle { // FIXME(#7544)(bblum): is it really necessary to prohibit double kill? match inner.unkillable.compare_and_swap(KILL_UNKILLABLE, KILL_RUNNING, Relaxed) { KILL_UNKILLABLE => { }, // normal case - KILL_KILLED => if !already_failing { fail!(KILLED_MSG) }, + KILL_KILLED => if !already_failing { fail2!("{}", KILLED_MSG) }, _ => rtabort!("allow_kill: task already killable"), } } @@ -624,7 +624,7 @@ impl Death { // synchronization during unwinding or cleanup (for example, // sending on a notify port). In that case failing won't help. if self.unkillable == 0 && (!already_failing) && kill_handle.killed() { - fail!(KILLED_MSG); + fail2!("{}", KILLED_MSG); }, // This may happen during task death (see comments in collect_failure). None => rtassert!(self.unkillable > 0), @@ -650,7 +650,7 @@ impl Death { if self.unkillable == 0 { // we need to decrement the counter before failing. self.unkillable -= 1; - fail!("Cannot enter a rekillable() block without a surrounding unkillable()"); + fail2!("Cannot enter a rekillable() block without a surrounding unkillable()"); } self.unkillable -= 1; if self.unkillable == 0 { diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index 910c1c70c3437..51eb2505f550c 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -90,15 +90,15 @@ fn parse_logging_spec(spec: ~str) -> ~[LogDirective]{ log_level = num; }, _ => { - dumb_println(fmt!("warning: invalid logging spec \ - '%s', ignoring it", parts[1])); + dumb_println(format!("warning: invalid logging spec \ + '{}', ignoring it", parts[1])); loop; } } }, _ => { - dumb_println(fmt!("warning: invalid logging spec '%s',\ - ignoring it", s)); + dumb_println(format!("warning: invalid logging spec '{}',\ + ignoring it", s)); loop; } } @@ -165,10 +165,12 @@ fn update_log_settings(crate_map: *u8, settings: ~str) { } if n_matches < (dirs.len() as u32) { - dumb_println(fmt!("warning: got %u RUST_LOG specs but only matched %u of them.\n\ - You may have mistyped a RUST_LOG spec.\n\ - Use RUST_LOG=::help to see the list of crates and modules.\n", - dirs.len() as uint, n_matches as uint)); + dumb_println(format!("warning: got {} RUST_LOG specs but only matched\n\ + {} of them. You may have mistyped a RUST_LOG \ + spec. \n\ + Use RUST_LOG=::help to see the list of crates \ + and modules.\n", + dirs.len(), n_matches)); } } diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index ae3837af95556..bddcb700433c7 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -191,7 +191,7 @@ impl Scheduler { // action will have given it away. let sched: ~Scheduler = Local::take(); - rtdebug!("starting scheduler %u", sched.sched_id()); + rtdebug!("starting scheduler {}", sched.sched_id()); sched.run(); // Close the idle callback. @@ -207,7 +207,7 @@ impl Scheduler { // the cleanup code it runs. let mut stask: ~Task = Local::take(); - rtdebug!("stopping scheduler %u", stask.sched.get_ref().sched_id()); + rtdebug!("stopping scheduler {}", stask.sched.get_ref().sched_id()); // Should not have any messages let message = stask.sched.get_mut_ref().message_queue.pop(); @@ -999,7 +999,7 @@ mod test { Sched(t1_handle)) || { rtassert!(Task::on_appropriate_sched()); }; - rtdebug!("task1 id: **%u**", borrow::to_uint(task1)); + rtdebug!("task1 id: **{}**", borrow::to_uint(task1)); let task2 = ~do Task::new_root(&mut normal_sched.stack_pool, None) { rtassert!(Task::on_appropriate_sched()); @@ -1013,7 +1013,7 @@ mod test { Sched(t4_handle)) { rtassert!(Task::on_appropriate_sched()); }; - rtdebug!("task4 id: **%u**", borrow::to_uint(task4)); + rtdebug!("task4 id: **{}**", borrow::to_uint(task4)); let task1 = Cell::new(task1); let task2 = Cell::new(task2); @@ -1038,7 +1038,7 @@ mod test { sh.send(Shutdown); }; - rtdebug!("normal task: %u", borrow::to_uint(normal_task)); + rtdebug!("normal task: {}", borrow::to_uint(normal_task)); let special_task = ~do Task::new_root(&mut special_sched.stack_pool, None) { rtdebug!("*about to submit task1*"); @@ -1049,7 +1049,7 @@ mod test { chan.take().send(()); }; - rtdebug!("special task: %u", borrow::to_uint(special_task)); + rtdebug!("special task: {}", borrow::to_uint(special_task)); let special_sched = Cell::new(special_sched); let normal_sched = Cell::new(normal_sched); @@ -1238,12 +1238,12 @@ mod test { while (true) { match p.recv() { (1, end_chan) => { - debug!("%d\n", id); + debug2!("{}\n", id); end_chan.send(()); return; } (token, end_chan) => { - debug!("thread: %d got token: %d", id, token); + debug2!("thread: {} got token: {}", id, token); ch.send((token - 1, end_chan)); if token <= n_tasks { return; diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 09bd89ec94a18..0068d1030738e 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -225,7 +225,7 @@ impl Task { } pub fn run(&mut self, f: &fn()) { - rtdebug!("run called on task: %u", borrow::to_uint(self)); + rtdebug!("run called on task: {}", borrow::to_uint(self)); // The only try/catch block in the world. Attempt to run the task's // client-specified code and catch any failures. @@ -329,7 +329,7 @@ impl Task { impl Drop for Task { fn drop(&mut self) { - rtdebug!("called drop for a task: %u", borrow::to_uint(self)); + rtdebug!("called drop for a task: {}", borrow::to_uint(self)); rtassert!(self.destroyed) } } @@ -498,7 +498,7 @@ mod test { let result = spawntask_try(||()); rtdebug!("trying first assert"); assert!(result.is_ok()); - let result = spawntask_try(|| fail!()); + let result = spawntask_try(|| fail2!()); rtdebug!("trying second assert"); assert!(result.is_err()); } @@ -516,7 +516,7 @@ mod test { #[test] fn logging() { do run_in_newsched_task() { - info!("here i am. logging in a newsched task"); + info2!("here i am. logging in a newsched task"); } } @@ -558,7 +558,7 @@ mod test { fn linked_failure() { do run_in_newsched_task() { let res = do spawntask_try { - spawntask_random(|| fail!()); + spawntask_random(|| fail2!()); }; assert!(res.is_err()); } @@ -599,7 +599,7 @@ mod test { builder.future_result(|r| result = Some(r)); builder.unlinked(); do builder.spawn { - fail!(); + fail2!(); } assert_eq!(result.unwrap().recv(), Failure); } diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index e92accd283b7e..b6611eee9e62d 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -114,7 +114,7 @@ mod darwin_fd_limit { to_mut_unsafe_ptr(&mut size), mut_null(), 0) != 0 { let err = last_os_error(); - error!("raise_fd_limit: error calling sysctl: %s", err); + error2!("raise_fd_limit: error calling sysctl: {}", err); return; } @@ -122,7 +122,7 @@ mod darwin_fd_limit { let mut rlim = rlimit{rlim_cur: 0, rlim_max: 0}; if getrlimit(RLIMIT_NOFILE, to_mut_unsafe_ptr(&mut rlim)) != 0 { let err = last_os_error(); - error!("raise_fd_limit: error calling getrlimit: %s", err); + error2!("raise_fd_limit: error calling getrlimit: {}", err); return; } @@ -132,7 +132,7 @@ mod darwin_fd_limit { // Set our newly-increased resource limit if setrlimit(RLIMIT_NOFILE, to_unsafe_ptr(&rlim)) != 0 { let err = last_os_error(); - error!("raise_fd_limit: error calling setrlimit: %s", err); + error2!("raise_fd_limit: error calling setrlimit: {}", err); return; } } diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 6f39cbbade3d4..68996a3a2a50d 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -61,7 +61,7 @@ pub fn default_sched_threads() -> uint { let opt_n: Option = FromStr::from_str(nstr); match opt_n { Some(n) if n > 0 => n, - _ => rtabort!("`RUST_THREADS` is `%s`, should be a positive integer", nstr) + _ => rtabort!("`RUST_THREADS` is `{}`, should be a positive integer", nstr) } } None => { @@ -127,10 +127,10 @@ which at the time convulsed us with joy, yet which are now partly lost to my memory and partly incapable of presentation to others.", _ => "You've met with a terrible fate, haven't you?" }; - rterrln!("%s", ""); - rterrln!("%s", quote); - rterrln!("%s", ""); - rterrln!("fatal runtime error: %s", msg); + rterrln!("{}", ""); + rterrln!("{}", quote); + rterrln!("{}", ""); + rterrln!("fatal runtime error: {}", msg); abort(); diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs index f37402d944e83..dc5b512e56ea6 100644 --- a/src/libstd/rt/uv/file.rs +++ b/src/libstd/rt/uv/file.rs @@ -505,7 +505,7 @@ mod test { let unlink_req = FsRequest::new(); let result = unlink_req.unlink_sync(&loop_, &Path(path_str)); assert!(result.is_ok()); - } else { fail!("nread was 0.. wudn't expectin' that."); } + } else { fail2!("nread was 0.. wudn't expectin' that."); } loop_.close(); } } @@ -595,7 +595,7 @@ mod test { assert!(uverr.is_none()); let loop_ = req.get_loop(); let stat = req.get_stat(); - naive_print(&loop_, fmt!("%?", stat)); + naive_print(&loop_, format!("{:?}", stat)); assert!(stat.is_dir()); let rmdir_req = FsRequest::new(); do rmdir_req.rmdir(&loop_, &path) |req,uverr| { diff --git a/src/libstd/rt/uv/mod.rs b/src/libstd/rt/uv/mod.rs index 95b2059d5381d..0c5351ea9e46d 100644 --- a/src/libstd/rt/uv/mod.rs +++ b/src/libstd/rt/uv/mod.rs @@ -240,7 +240,7 @@ impl UvError { impl ToStr for UvError { fn to_str(&self) -> ~str { - fmt!("%s: %s", self.name(), self.desc()) + format!("{}: {}", self.name(), self.desc()) } } @@ -269,7 +269,7 @@ pub fn uv_error_to_io_error(uverr: UvError) -> IoError { ECONNRESET => ConnectionReset, EPIPE => BrokenPipe, err => { - rtdebug!("uverr.code %d", err as int); + rtdebug!("uverr.code {}", err as int); // XXX: Need to map remaining uv error types OtherIoError } diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index 57a1a50e6af9f..ca42fd32f096b 100644 --- a/src/libstd/rt/uv/net.rs +++ b/src/libstd/rt/uv/net.rs @@ -34,7 +34,7 @@ fn sockaddr_to_UvSocketAddr(addr: *uvll::sockaddr) -> UvSocketAddr { match addr { _ if is_ip4_addr(addr) => UvIpv4SocketAddr(addr as *uvll::sockaddr_in), _ if is_ip6_addr(addr) => UvIpv6SocketAddr(addr as *uvll::sockaddr_in6), - _ => fail!(), + _ => fail2!(), } } } @@ -156,8 +156,8 @@ impl StreamWatcher { } extern fn read_cb(stream: *uvll::uv_stream_t, nread: ssize_t, buf: Buf) { - rtdebug!("buf addr: %x", buf.base as uint); - rtdebug!("buf len: %d", buf.len as int); + rtdebug!("buf addr: {}", buf.base); + rtdebug!("buf len: {}", buf.len); let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(stream); let cb = stream_watcher.get_watcher_data().read_cb.get_ref(); let status = status_to_maybe_uv_error(nread as c_int); @@ -266,7 +266,7 @@ impl TcpWatcher { self.get_watcher_data().connect_cb = Some(cb); let connect_handle = ConnectRequest::new().native_handle(); - rtdebug!("connect_t: %x", connect_handle as uint); + rtdebug!("connect_t: {}", connect_handle); do socket_addr_as_uv_socket_addr(address) |addr| { let result = match addr { UvIpv4SocketAddr(addr) => uvll::tcp_connect(connect_handle, @@ -278,7 +278,7 @@ impl TcpWatcher { } extern fn connect_cb(req: *uvll::uv_connect_t, status: c_int) { - rtdebug!("connect_t: %x", req as uint); + rtdebug!("connect_t: {}", req); let connect_request: ConnectRequest = NativeHandle::from_native_handle(req); let mut stream_watcher = connect_request.stream(); connect_request.delete(); @@ -379,8 +379,8 @@ impl UdpWatcher { return; } - rtdebug!("buf addr: %x", buf.base as uint); - rtdebug!("buf len: %d", buf.len as int); + rtdebug!("buf addr: {}", buf.base); + rtdebug!("buf len: {}", buf.len); let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle); let cb = udp_watcher.get_watcher_data().udp_recv_cb.get_ref(); let status = status_to_maybe_uv_error(nread as c_int); @@ -652,11 +652,11 @@ mod test { let buf = vec_from_uv_buf(buf); let mut count = count_cell.take(); if status.is_none() { - rtdebug!("got %d bytes", nread); + rtdebug!("got {} bytes", nread); let buf = buf.unwrap(); for byte in buf.slice(0, nread as uint).iter() { assert!(*byte == count as u8); - rtdebug!("%u", *byte as uint); + rtdebug!("{}", *byte as uint); count += 1; } } else { @@ -727,12 +727,12 @@ mod test { let buf = vec_from_uv_buf(buf); let mut count = count_cell.take(); if status.is_none() { - rtdebug!("got %d bytes", nread); + rtdebug!("got {} bytes", nread); let buf = buf.unwrap(); let r = buf.slice(0, nread as uint); for byte in r.iter() { assert!(*byte == count as u8); - rtdebug!("%u", *byte as uint); + rtdebug!("{}", *byte as uint); count += 1; } } else { @@ -798,12 +798,12 @@ mod test { let buf = vec_from_uv_buf(buf); let mut count = 0; - rtdebug!("got %d bytes", nread); + rtdebug!("got {} bytes", nread); let buf = buf.unwrap(); for &byte in buf.slice(0, nread as uint).iter() { assert!(byte == count as u8); - rtdebug!("%u", byte as uint); + rtdebug!("{}", byte as uint); count += 1; } assert_eq!(count, MAX); @@ -858,12 +858,12 @@ mod test { let buf = vec_from_uv_buf(buf); let mut count = 0; - rtdebug!("got %d bytes", nread); + rtdebug!("got {} bytes", nread); let buf = buf.unwrap(); for &byte in buf.slice(0, nread as uint).iter() { assert!(byte == count as u8); - rtdebug!("%u", byte as uint); + rtdebug!("{}", byte as uint); count += 1; } assert_eq!(count, MAX); diff --git a/src/libstd/rt/uv/process.rs b/src/libstd/rt/uv/process.rs index ccfa1ff87dbd0..ddaf0c2872519 100644 --- a/src/libstd/rt/uv/process.rs +++ b/src/libstd/rt/uv/process.rs @@ -199,7 +199,7 @@ fn with_env(env: Option<&[(~str, ~str)]>, f: &fn(**libc::c_char) -> T) -> T { // As with argv, create some temporary storage and then the actual array let mut envp = vec::with_capacity(env.len()); for &(ref key, ref value) in env.iter() { - envp.push(fmt!("%s=%s", *key, *value).to_c_str()); + envp.push(format!("{}={}", *key, *value).to_c_str()); } let mut c_envp = vec::with_capacity(envp.len() + 1); for s in envp.iter() { diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs index ed6e16c8fdb09..f9b71db704347 100644 --- a/src/libstd/rt/uv/uvio.rs +++ b/src/libstd/rt/uv/uvio.rs @@ -1802,7 +1802,7 @@ fn test_simple_tcp_server_and_client() { let nread = stream.read(buf).unwrap(); assert_eq!(nread, 8); for i in range(0u, nread) { - rtdebug!("%u", buf[i] as uint); + rtdebug!("{}", buf[i]); assert_eq!(buf[i], i as u8); } } @@ -1919,7 +1919,7 @@ fn test_simple_udp_server_and_client() { let (nread,src) = server_socket.recvfrom(buf).unwrap(); assert_eq!(nread, 8); for i in range(0u, nread) { - rtdebug!("%u", buf[i] as uint); + rtdebug!("{}", buf[i]); assert_eq!(buf[i], i as u8); } assert_eq!(src, client_addr); @@ -2031,13 +2031,13 @@ fn test_read_read_read() { let mut total_bytes_read = 0; while total_bytes_read < MAX { let nread = stream.read(buf).unwrap(); - rtdebug!("read %u bytes", nread as uint); + rtdebug!("read {} bytes", nread); total_bytes_read += nread; for i in range(0u, nread) { assert_eq!(buf[i], 1); } } - rtdebug!("read %u bytes total", total_bytes_read as uint); + rtdebug!("read {} bytes total", total_bytes_read); } } } diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 362eab17fe70a..074c232e14915 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -199,7 +199,7 @@ impl Process { fn input_fd(&mut self) -> c_int { match self.input { Some(fd) => fd, - None => fail!("This Process's stdin was redirected to an \ + None => fail2!("This Process's stdin was redirected to an \ existing file descriptor.") } } @@ -207,7 +207,7 @@ impl Process { fn output_file(&mut self) -> *libc::FILE { match self.output { Some(file) => file, - None => fail!("This Process's stdout was redirected to an \ + None => fail2!("This Process's stdout was redirected to an \ existing file descriptor.") } } @@ -215,7 +215,7 @@ impl Process { fn error_file(&mut self) -> *libc::FILE { match self.error { Some(file) => file, - None => fail!("This Process's stderr was redirected to an \ + None => fail2!("This Process's stderr was redirected to an \ existing file descriptor.") } } @@ -373,7 +373,7 @@ impl Process { ((1, o), (2, e)) => (e, o), ((2, e), (1, o)) => (e, o), ((x, _), (y, _)) => { - fail!("unexpected file numbers: %u, %u", x, y); + fail2!("unexpected file numbers: {}, {}", x, y); } }; @@ -482,29 +482,29 @@ fn spawn_process_os(prog: &str, args: &[~str], let orig_std_in = get_osfhandle(in_fd) as HANDLE; if orig_std_in == INVALID_HANDLE_VALUE as HANDLE { - fail!("failure in get_osfhandle: %s", os::last_os_error()); + fail2!("failure in get_osfhandle: {}", os::last_os_error()); } if DuplicateHandle(cur_proc, orig_std_in, cur_proc, &mut si.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE { - fail!("failure in DuplicateHandle: %s", os::last_os_error()); + fail2!("failure in DuplicateHandle: {}", os::last_os_error()); } let orig_std_out = get_osfhandle(out_fd) as HANDLE; if orig_std_out == INVALID_HANDLE_VALUE as HANDLE { - fail!("failure in get_osfhandle: %s", os::last_os_error()); + fail2!("failure in get_osfhandle: {}", os::last_os_error()); } if DuplicateHandle(cur_proc, orig_std_out, cur_proc, &mut si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE { - fail!("failure in DuplicateHandle: %s", os::last_os_error()); + fail2!("failure in DuplicateHandle: {}", os::last_os_error()); } let orig_std_err = get_osfhandle(err_fd) as HANDLE; if orig_std_err == INVALID_HANDLE_VALUE as HANDLE { - fail!("failure in get_osfhandle: %s", os::last_os_error()); + fail2!("failure in get_osfhandle: {}", os::last_os_error()); } if DuplicateHandle(cur_proc, orig_std_err, cur_proc, &mut si.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE { - fail!("failure in DuplicateHandle: %s", os::last_os_error()); + fail2!("failure in DuplicateHandle: {}", os::last_os_error()); } let cmd = make_command_line(prog, args); @@ -529,7 +529,7 @@ fn spawn_process_os(prog: &str, args: &[~str], CloseHandle(si.hStdError); for msg in create_err.iter() { - fail!("failure in CreateProcess: %s", *msg); + fail2!("failure in CreateProcess: {}", *msg); } // We close the thread handle because we don't care about keeping the thread id valid, @@ -669,7 +669,7 @@ fn spawn_process_os(prog: &str, args: &[~str], let pid = fork(); if pid < 0 { - fail!("failure in fork: %s", os::last_os_error()); + fail2!("failure in fork: {}", os::last_os_error()); } else if pid > 0 { return SpawnProcessResult {pid: pid, handle: ptr::null()}; } @@ -677,13 +677,13 @@ fn spawn_process_os(prog: &str, args: &[~str], rustrt::rust_unset_sigprocmask(); if dup2(in_fd, 0) == -1 { - fail!("failure in dup2(in_fd, 0): %s", os::last_os_error()); + fail2!("failure in dup2(in_fd, 0): {}", os::last_os_error()); } if dup2(out_fd, 1) == -1 { - fail!("failure in dup2(out_fd, 1): %s", os::last_os_error()); + fail2!("failure in dup2(out_fd, 1): {}", os::last_os_error()); } if dup2(err_fd, 2) == -1 { - fail!("failure in dup3(err_fd, 2): %s", os::last_os_error()); + fail2!("failure in dup3(err_fd, 2): {}", os::last_os_error()); } // close all other fds for fd in range(3, getdtablesize()).invert() { @@ -692,7 +692,7 @@ fn spawn_process_os(prog: &str, args: &[~str], do with_dirp(dir) |dirp| { if !dirp.is_null() && chdir(dirp) == -1 { - fail!("failure in chdir: %s", os::last_os_error()); + fail2!("failure in chdir: {}", os::last_os_error()); } } @@ -703,7 +703,7 @@ fn spawn_process_os(prog: &str, args: &[~str], do with_argv(prog, args) |argv| { execvp(*argv, argv); // execvp only returns if an error occurred - fail!("failure in execvp: %s", os::last_os_error()); + fail2!("failure in execvp: {}", os::last_os_error()); } } } @@ -749,7 +749,7 @@ fn with_envp(env: Option<~[(~str, ~str)]>, cb: &fn(*c_void) -> T) -> T { let mut tmps = vec::with_capacity(env.len()); for pair in env.iter() { - let kv = fmt!("%s=%s", pair.first(), pair.second()); + let kv = format!("{}={}", pair.first(), pair.second()); tmps.push(kv.to_c_str()); } @@ -777,7 +777,7 @@ fn with_envp(env: Option<~[(~str, ~str)]>, cb: &fn(*mut c_void) -> T) -> T { let mut blk = ~[]; for pair in env.iter() { - let kv = fmt!("%s=%s", pair.first(), pair.second()); + let kv = format!("{}={}", pair.first(), pair.second()); blk.push_all(kv.as_bytes()); blk.push(0); } @@ -890,14 +890,14 @@ fn waitpid(pid: pid_t) -> int { let proc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, pid as DWORD); if proc.is_null() { - fail!("failure in OpenProcess: %s", os::last_os_error()); + fail2!("failure in OpenProcess: {}", os::last_os_error()); } loop { let mut status = 0; if GetExitCodeProcess(proc, &mut status) == FALSE { CloseHandle(proc); - fail!("failure in GetExitCodeProcess: %s", os::last_os_error()); + fail2!("failure in GetExitCodeProcess: {}", os::last_os_error()); } if status != STILL_ACTIVE { CloseHandle(proc); @@ -905,7 +905,7 @@ fn waitpid(pid: pid_t) -> int { } if WaitForSingleObject(proc, INFINITE) == WAIT_FAILED { CloseHandle(proc); - fail!("failure in WaitForSingleObject: %s", os::last_os_error()); + fail2!("failure in WaitForSingleObject: {}", os::last_os_error()); } } } @@ -943,7 +943,7 @@ fn waitpid(pid: pid_t) -> int { let mut status = 0 as c_int; if unsafe { waitpid(pid, &mut status, 0) } == -1 { - fail!("failure in waitpid: %s", os::last_os_error()); + fail2!("failure in waitpid: {}", os::last_os_error()); } return if WIFEXITED(status) { @@ -1342,7 +1342,7 @@ mod tests { let r = os::env(); for &(ref k, ref v) in r.iter() { // don't check windows magical empty-named variables - assert!(k.is_empty() || output.contains(fmt!("%s=%s", *k, *v))); + assert!(k.is_empty() || output.contains(format!("{}={}", *k, *v))); } } #[test] @@ -1357,8 +1357,8 @@ mod tests { for &(ref k, ref v) in r.iter() { // don't check android RANDOM variables if *k != ~"RANDOM" { - assert!(output.contains(fmt!("%s=%s", *k, *v)) || - output.contains(fmt!("%s=\'%s\'", *k, *v))); + assert!(output.contains(format!("{}={}", *k, *v)) || + output.contains(format!("{}=\'{}\'", *k, *v))); } } } diff --git a/src/libstd/select.rs b/src/libstd/select.rs index 8c55e13ae5819..2554a0ad58823 100644 --- a/src/libstd/select.rs +++ b/src/libstd/select.rs @@ -35,7 +35,7 @@ pub trait SelectPort : SelectPortInner { } /// port whose data is ready. (If multiple are ready, returns the lowest index.) pub fn select(ports: &mut [A]) -> uint { if ports.is_empty() { - fail!("can't select on an empty list"); + fail2!("can't select on an empty list"); } for (index, port) in ports.mut_iter().enumerate() { @@ -116,7 +116,7 @@ pub fn select2, TB, B: SelectPort>(mut a: A, mut b: B) match result { 0 => Left ((a.recv_ready(), b)), 1 => Right((a, b.recv_ready())), - x => fail!("impossible case in select2: %?", x) + x => fail2!("impossible case in select2: {:?}", x) } } @@ -335,7 +335,7 @@ mod test { let _ = dead_cs; } do task::spawn { - fail!(); // should kill sibling awake + fail2!(); // should kill sibling awake } // wait for killed selector to close (NOT send on) its c. diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 931bddbdf9306..6c9992b81391a 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -134,8 +134,8 @@ pub fn from_utf8(vv: &[u8]) -> ~str { match from_utf8_opt(vv) { None => { let first_bad_byte = *vv.iter().find(|&b| !is_utf8([*b])).unwrap(); - cond.raise(fmt!("from_utf8: input is not UTF-8; first bad byte is %u", - first_bad_byte as uint)) + cond.raise(format!("from_utf8: input is not UTF-8; first bad \ + byte is {}", first_bad_byte)) } Some(s) => s } @@ -161,8 +161,8 @@ pub fn from_utf8_owned(vv: ~[u8]) -> ~str { if !is_utf8(vv) { let first_bad_byte = *vv.iter().find(|&b| !is_utf8([*b])).unwrap(); - cond.raise(fmt!("from_utf8: input is not UTF-8; first bad byte is %u", - first_bad_byte as uint)) + cond.raise(format!("from_utf8: input is not UTF-8; first bad byte is {}", + first_bad_byte)) } else { unsafe { raw::from_utf8_owned(vv) } } @@ -1229,7 +1229,7 @@ pub mod raw { match ctr { 0 => assert_eq!(x, &~"zero"), 1 => assert_eq!(x, &~"one"), - _ => fail!("shouldn't happen!") + _ => fail2!("shouldn't happen!") } ctr += 1; } @@ -2000,8 +2000,8 @@ impl<'self> StrSlice<'self> for &'self str { if end_byte.is_none() && count == end { end_byte = Some(self.len()) } match (begin_byte, end_byte) { - (None, _) => fail!("slice_chars: `begin` is beyond end of string"), - (_, None) => fail!("slice_chars: `end` is beyond end of string"), + (None, _) => fail2!("slice_chars: `begin` is beyond end of string"), + (_, None) => fail2!("slice_chars: `end` is beyond end of string"), (Some(a), Some(b)) => unsafe { raw::slice_bytes(*self, a, b) } } } @@ -2723,12 +2723,12 @@ mod tests { #[test] fn test_collect() { - let empty = ""; + let empty = ~""; let s: ~str = empty.iter().collect(); - assert_eq!(empty, s.as_slice()); - let data = "ประเทศไทย中"; + assert_eq!(empty, s); + let data = ~"ประเทศไทย中"; let s: ~str = data.iter().collect(); - assert_eq!(data, s.as_slice()); + assert_eq!(data, s); } #[test] @@ -3242,7 +3242,7 @@ mod tests { // original problem code path anymore.) let s = ~""; let _bytes = s.as_bytes(); - fail!(); + fail2!(); } #[test] @@ -3300,8 +3300,8 @@ mod tests { while i < n1 { let a: u8 = s1[i]; let b: u8 = s2[i]; - debug!(a); - debug!(b); + debug2!("{}", a); + debug2!("{}", b); assert_eq!(a, b); i += 1u; } diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs index 66ec0ae3417b2..25425e07577d0 100644 --- a/src/libstd/sys.rs +++ b/src/libstd/sys.rs @@ -134,7 +134,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { use str::Str; unsafe { - // XXX: Bad re-allocations. fail! needs some refactoring + // XXX: Bad re-allocations. fail2! needs some refactoring let msg = str::raw::from_c_str(msg); let file = str::raw::from_c_str(file); @@ -148,7 +148,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { n, msg.as_slice(), file.as_slice(), line); } } else { - rterrln!("failed in non-task context at '%s', %s:%i", + rterrln!("failed in non-task context at '{}', {}:{}", msg, file, line as int); } diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index e6f6536956c9f..200e2de0271cd 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -181,7 +181,7 @@ pub fn task() -> TaskBuilder { impl TaskBuilder { fn consume(&mut self) -> TaskBuilder { if self.consumed { - fail!("Cannot copy a task_builder"); // Fake move mode on self + fail2!("Cannot copy a task_builder"); // Fake move mode on self } self.consumed = true; let gen_body = self.gen_body.take(); @@ -271,7 +271,7 @@ impl TaskBuilder { // sending out messages. if self.opts.notify_chan.is_some() { - fail!("Can't set multiple future_results for one task!"); + fail2!("Can't set multiple future_results for one task!"); } // Construct the future and give it to the caller. @@ -532,7 +532,7 @@ pub fn with_task_name(blk: &fn(Option<&str>) -> U) -> U { } } } else { - fail!("no task name exists in non-green task context") + fail2!("no task name exists in non-green task context") } } @@ -640,7 +640,7 @@ fn test_kill_unkillable_task() { do run_in_newsched_task { do task::try { do task::spawn { - fail!(); + fail2!(); } do task::unkillable { } }; @@ -659,7 +659,7 @@ fn test_kill_rekillable_task() { do task::unkillable { do task::rekillable { do task::spawn { - fail!(); + fail2!(); } } } @@ -689,7 +689,7 @@ fn test_rekillable_nested_failure() { do unkillable { do rekillable { let (port,chan) = comm::stream(); - do task::spawn { chan.send(()); fail!(); } + do task::spawn { chan.send(()); fail2!(); } port.recv(); // wait for child to exist port.recv(); // block forever, expect to get killed. } @@ -733,7 +733,7 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port do 16.times { task::deschedule(); } ch.send(()); // If killed first, grandparent hangs. } - fail!(); // Shouldn't kill either (grand)parent or (grand)child. + fail2!(); // Shouldn't kill either (grand)parent or (grand)child. } po.recv(); } @@ -743,7 +743,7 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails use rt::test::run_in_newsched_task; do run_in_newsched_task { - do spawn_unlinked { fail!(); } + do spawn_unlinked { fail2!(); } } } #[ignore(reason = "linked failure")] @@ -751,7 +751,7 @@ fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails use rt::test::run_in_newsched_task; do run_in_newsched_task { - do spawn_supervised { fail!(); } + do spawn_supervised { fail2!(); } // Give child a chance to fail-but-not-kill-us. do 16.times { task::deschedule(); } } @@ -763,7 +763,7 @@ fn test_spawn_unlinked_sup_fail_down() { do run_in_newsched_task { let result: Result<(),()> = do try { do spawn_supervised { block_forever(); } - fail!(); // Shouldn't leave a child hanging around. + fail2!(); // Shouldn't leave a child hanging around. }; assert!(result.is_err()); } @@ -783,7 +783,7 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails b0.opts.supervised = true; do b0.spawn { - fail!(); + fail2!(); } block_forever(); // We should get punted awake }; @@ -802,7 +802,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails b0.opts.linked = true; b0.opts.supervised = true; do b0.spawn { block_forever(); } - fail!(); // *both* mechanisms would be wrong if this didn't kill the child + fail2!(); // *both* mechanisms would be wrong if this didn't kill the child }; assert!(result.is_err()); } @@ -814,7 +814,7 @@ fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails do run_in_newsched_task { let result: Result<(),()> = do try { // Default options are to spawn linked & unsupervised. - do spawn { fail!(); } + do spawn { fail2!(); } block_forever(); // We should get punted awake }; assert!(result.is_err()); @@ -828,7 +828,7 @@ fn test_spawn_linked_unsup_fail_down() { // parent fails; child fails let result: Result<(),()> = do try { // Default options are to spawn linked & unsupervised. do spawn { block_forever(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -843,7 +843,7 @@ fn test_spawn_linked_unsup_default_opts() { // parent fails; child fails let mut builder = task(); builder.linked(); do builder.spawn { block_forever(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -863,7 +863,7 @@ fn test_spawn_failure_propagate_grandchild() { do spawn_supervised { block_forever(); } } do 16.times { task::deschedule(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -880,7 +880,7 @@ fn test_spawn_failure_propagate_secondborn() { do spawn { block_forever(); } // linked } do 16.times { task::deschedule(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -897,7 +897,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { do spawn_supervised { block_forever(); } } do 16.times { task::deschedule(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -914,7 +914,7 @@ fn test_spawn_linked_sup_propagate_sibling() { do spawn { block_forever(); } // linked } do 16.times { task::deschedule(); } - fail!(); + fail2!(); }; assert!(result.is_err()); } @@ -994,7 +994,7 @@ fn test_future_result() { builder.future_result(|r| result = Some(r)); builder.unlinked(); do builder.spawn { - fail!(); + fail2!(); } assert_eq!(result.unwrap().recv(), Failure); } @@ -1012,17 +1012,17 @@ fn test_try_success() { ~"Success!" } { result::Ok(~"Success!") => (), - _ => fail!() + _ => fail2!() } } #[test] fn test_try_fail() { match do try { - fail!() + fail2!() } { result::Err(()) => (), - result::Ok(()) => fail!() + result::Ok(()) => fail2!() } } @@ -1212,7 +1212,7 @@ fn test_unkillable() { deschedule(); // We want to fail after the unkillable task // blocks on recv - fail!(); + fail2!(); } unsafe { @@ -1247,7 +1247,7 @@ fn test_unkillable_nested() { deschedule(); // We want to fail after the unkillable task // blocks on recv - fail!(); + fail2!(); } unsafe { @@ -1312,7 +1312,7 @@ fn test_spawn_watched() { t.watched(); do t.spawn { task::deschedule(); - fail!(); + fail2!(); } } }; @@ -1348,7 +1348,7 @@ fn test_indestructible() { do t.spawn { p3.recv(); task::deschedule(); - fail!(); + fail2!(); } c3.send(()); p2.recv(); diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 58cea8d7d0ecb..a77c974429802 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -712,7 +712,7 @@ fn test_spawn_raw_unsupervise() { .. default_task_opts() }; do spawn_raw(opts) { - fail!(); + fail2!(); } } @@ -741,7 +741,7 @@ fn test_spawn_raw_notify_failure() { .. default_task_opts() }; do spawn_raw(opts) { - fail!(); + fail2!(); } assert_eq!(notify_po.recv(), Failure); } diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index ff701267189ee..554b9a8510048 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -45,7 +45,7 @@ impl ToStr for (A,) { fn to_str(&self) -> ~str { match *self { (ref a,) => { - fmt!("(%s,)", (*a).to_str()) + format!("({},)", (*a).to_str()) } } } @@ -98,7 +98,7 @@ impl ToStr for (A, B) { //let &(ref a, ref b) = self; match *self { (ref a, ref b) => { - fmt!("(%s, %s)", (*a).to_str(), (*b).to_str()) + format!("({}, {})", (*a).to_str(), (*b).to_str()) } } } @@ -111,7 +111,7 @@ impl ToStr for (A, B, C) { //let &(ref a, ref b, ref c) = self; match *self { (ref a, ref b, ref c) => { - fmt!("(%s, %s, %s)", + format!("({}, {}, {})", (*a).to_str(), (*b).to_str(), (*c).to_str() @@ -221,7 +221,7 @@ mod tests { impl ToStr for StructWithToStrWithoutEqOrHash { fn to_str(&self) -> ~str { - fmt!("s%d", self.value) + format!("s{}", self.value) } } diff --git a/src/libstd/trie.rs b/src/libstd/trie.rs index 88a953a1601e9..c1b0cd500d6a1 100644 --- a/src/libstd/trie.rs +++ b/src/libstd/trie.rs @@ -422,7 +422,7 @@ fn remove(count: &mut uint, child: &mut Child, key: uint, External(stored, _) if stored == key => { match replace(child, Nothing) { External(_, value) => (Some(value), true), - _ => fail!() + _ => fail2!() } } External(*) => (None, false), @@ -531,7 +531,7 @@ mod test_map { assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { - None => fail!(), Some(x) => *x = new + None => fail2!(), Some(x) => *x = new } assert_eq!(m.find(&5), Some(&new)); } diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 41ff79bc88458..0045aef06f106 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -33,7 +33,7 @@ impl Drop for DynamicLibrary { } } { Ok(()) => {}, - Err(str) => fail!(str) + Err(str) => fail2!("{}", str) } } } @@ -96,7 +96,7 @@ mod test { // The math library does not need to be loaded since it is already // statically linked in let libm = match DynamicLibrary::open(None) { - Err(error) => fail!("Could not load self as module: %s", error), + Err(error) => fail2!("Could not load self as module: {}", error), Ok(libm) => libm }; @@ -104,7 +104,7 @@ mod test { // this as a C function let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe { match libm.symbol("cos") { - Err(error) => fail!("Could not load function cos: %s", error), + Err(error) => fail2!("Could not load function cos: {}", error), Ok(cosine) => cosine } }; @@ -113,7 +113,7 @@ mod test { let expected_result = 1.0; let result = cosine(argument); if result != expected_result { - fail!("cos(%?) != %? but equaled %? instead", argument, + fail2!("cos({:?}) != {:?} but equaled {:?} instead", argument, expected_result, result) } } @@ -129,7 +129,7 @@ mod test { let path = GenericPath::from_str("/dev/null"); match DynamicLibrary::open(Some(&path)) { Err(_) => {} - Ok(_) => fail!("Successfully opened the empty library.") + Ok(_) => fail2!("Successfully opened the empty library.") } } } @@ -241,7 +241,7 @@ pub mod dl { if 0 == error { Ok(result) } else { - Err(fmt!("Error code %?", error)) + Err(format!("Error code {}", error)) } } } diff --git a/src/libstd/unstable/extfmt.rs b/src/libstd/unstable/extfmt.rs index 4d53dd7d7bfff..b224c22df20a6 100644 --- a/src/libstd/unstable/extfmt.rs +++ b/src/libstd/unstable/extfmt.rs @@ -333,14 +333,14 @@ pub mod ct { 'f' => TyFloat, 'p' => TyPointer, '?' => TyPoly, - _ => err(fmt!("unknown type in conversion: %c", s.char_at(i))) + _ => err(format!("unknown type in conversion: {}", s.char_at(i))) }; Parsed::new(t, i + 1) } #[cfg(test)] - fn die(s: &str) -> ! { fail!(s.to_owned()) } + fn die(s: &str) -> ! { fail2!(s.to_owned()) } #[test] fn test_parse_count() { @@ -698,6 +698,6 @@ mod test { #[test] fn fmt_slice() { let s = "abc"; - let _s = fmt!("%s", s); + let _s = format!("{}", s); } } diff --git a/src/libstd/unstable/finally.rs b/src/libstd/unstable/finally.rs index c1365a44bc913..9fe3435c21ba1 100644 --- a/src/libstd/unstable/finally.rs +++ b/src/libstd/unstable/finally.rs @@ -87,7 +87,7 @@ fn test_fail() { let mut i = 0; do (|| { i = 10; - fail!(); + fail2!(); }).finally { assert!(failing()); assert_eq!(i, 10); diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index b2a0062d7272e..fca477763c5e6 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -27,8 +27,8 @@ pub fn fail_(expr: *c_char, file: *c_char, line: size_t) -> ! { #[lang="fail_bounds_check"] pub fn fail_bounds_check(file: *c_char, line: size_t, index: size_t, len: size_t) { - let msg = fmt!("index out of bounds: the len is %d but the index is %d", - len as int, index as int); + let msg = format!("index out of bounds: the len is {} but the index is {}", + len as int, index as int); do msg.with_c_str |buf| { fail_(buf, file, line); } diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index c2ef2300fc261..066c2173b5af2 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -172,7 +172,7 @@ impl UnsafeArc { // If 'put' returns the server end back to us, we were rejected; // someone else was trying to unwrap. Avoid guaranteed deadlock. cast::forget(data); - fail!("Another task is already unwrapping this Arc!"); + fail2!("Another task is already unwrapping this Arc!"); } } } @@ -386,7 +386,7 @@ impl Exclusive { let rec = self.x.get(); do (*rec).lock.lock { if (*rec).failed { - fail!("Poisoned Exclusive::new - another task failed inside!"); + fail2!("Poisoned Exclusive::new - another task failed inside!"); } (*rec).failed = true; let result = f(&mut (*rec).data); @@ -618,7 +618,7 @@ mod tests { let x2 = x.clone(); do task::spawn { do 10.times { task::deschedule(); } // try to let the unwrapper go - fail!(); // punt it awake from its deadlock + fail2!(); // punt it awake from its deadlock } let _z = x.unwrap(); unsafe { do x2.with |_hello| { } } diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 409aa919252d9..aa927d0f0a03b 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1022,7 +1022,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { /// Returns the first element of a vector, failing if the vector is empty. #[inline] fn head(&self) -> &'self T { - if self.len() == 0 { fail!("head: empty vector") } + if self.len() == 0 { fail2!("head: empty vector") } &self[0] } @@ -1055,7 +1055,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { /// Returns the last element of a vector, failing if the vector is empty. #[inline] fn last(&self) -> &'self T { - if self.len() == 0 { fail!("last: empty vector") } + if self.len() == 0 { fail2!("last: empty vector") } &self[self.len() - 1] } @@ -1301,7 +1301,7 @@ impl OwnedVector for ~[T] { let alloc = n * sys::nonzero_size_of::(); let size = alloc + sys::size_of::>(); if alloc / sys::nonzero_size_of::() != n || size < alloc { - fail!("vector size is too large: %u", n); + fail2!("vector size is too large: {}", n); } *ptr = realloc_raw(*ptr as *mut c_void, size) as *mut Vec<()>; @@ -1343,7 +1343,7 @@ impl OwnedVector for ~[T] { fn reserve_additional(&mut self, n: uint) { if self.capacity() - self.len() < n { match self.len().checked_add(&n) { - None => fail!("vec::reserve_additional: `uint` overflow"), + None => fail2!("vec::reserve_additional: `uint` overflow"), Some(new_cap) => self.reserve_at_least(new_cap) } } @@ -1570,7 +1570,7 @@ impl OwnedVector for ~[T] { fn swap_remove(&mut self, index: uint) -> T { let ln = self.len(); if index >= ln { - fail!("vec::swap_remove - index %u >= length %u", index, ln); + fail2!("vec::swap_remove - index {} >= length {}", index, ln); } if index < ln - 1 { self.swap(index, ln - 1); @@ -2958,7 +2958,7 @@ mod tests { 3 => assert_eq!(v, [2, 3, 1]), 4 => assert_eq!(v, [2, 1, 3]), 5 => assert_eq!(v, [1, 2, 3]), - _ => fail!(), + _ => fail2!(), } } } @@ -3205,7 +3205,7 @@ mod tests { #[should_fail] fn test_from_fn_fail() { do from_fn(100) |v| { - if v == 50 { fail!() } + if v == 50 { fail2!() } (~0, @0) }; } @@ -3224,7 +3224,7 @@ mod tests { fn clone(&self) -> S { let s = unsafe { cast::transmute_mut(self) }; s.f += 1; - if s.f == 10 { fail!() } + if s.f == 10 { fail2!() } S { f: s.f, boxes: s.boxes.clone() } } } @@ -3241,7 +3241,7 @@ mod tests { push((~0, @0)); push((~0, @0)); push((~0, @0)); - fail!(); + fail2!(); }; } @@ -3251,7 +3251,7 @@ mod tests { let mut v = ~[]; do v.grow_fn(100) |i| { if i == 50 { - fail!() + fail2!() } (~0, @0) } @@ -3264,7 +3264,7 @@ mod tests { let mut i = 0; do v.map |_elt| { if i == 2 { - fail!() + fail2!() } i += 1; ~[(~0, @0)] @@ -3278,7 +3278,7 @@ mod tests { let mut i = 0; do flat_map(v) |_elt| { if i == 2 { - fail!() + fail2!() } i += 1; ~[(~0, @0)] @@ -3292,7 +3292,7 @@ mod tests { let mut i = 0; for _ in v.permutations_iter() { if i == 2 { - fail!() + fail2!() } i += 1; } @@ -3303,7 +3303,7 @@ mod tests { fn test_as_imm_buf_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; do v.as_imm_buf |_buf, _i| { - fail!() + fail2!() } } @@ -3312,7 +3312,7 @@ mod tests { fn test_as_mut_buf_fail() { let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; do v.as_mut_buf |_buf, _i| { - fail!() + fail2!() } } @@ -3702,11 +3702,11 @@ mod tests { assert_eq!(cnt, 11); let xs = ~[Foo, Foo, Foo]; - assert_eq!(fmt!("%?", xs.slice(0, 2).to_owned()), + assert_eq!(format!("{:?}", xs.slice(0, 2).to_owned()), ~"~[vec::tests::Foo, vec::tests::Foo]"); let xs: [Foo, ..3] = [Foo, Foo, Foo]; - assert_eq!(fmt!("%?", xs.slice(0, 2).to_owned()), + assert_eq!(format!("{:?}", xs.slice(0, 2).to_owned()), ~"~[vec::tests::Foo, vec::tests::Foo]"); cnt = 0; for f in xs.iter() { @@ -3749,7 +3749,7 @@ mod bench { sum += *x; } // sum == 11806, to stop dead code elimination. - if sum == 0 {fail!()} + if sum == 0 {fail2!()} } } From 7e709bfd0dac1d5bbe5c97494980731b4d477e8f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 20:18:50 -0700 Subject: [PATCH 03/16] extra: Remove usage of fmt! --- src/libextra/arc.rs | 10 +- src/libextra/arena.rs | 8 +- src/libextra/base64.rs | 6 +- src/libextra/bitv.rs | 6 +- src/libextra/comm.rs | 6 +- src/libextra/crypto/cryptoutil.rs | 14 +-- src/libextra/dlist.rs | 4 +- src/libextra/ebml.rs | 87 ++++++++-------- src/libextra/fileinput.rs | 32 +++--- src/libextra/flate.rs | 4 +- src/libextra/flatpipes.rs | 26 ++--- src/libextra/future.rs | 8 +- src/libextra/getopts.rs | 124 +++++++++++------------ src/libextra/glob.rs | 4 +- src/libextra/hex.rs | 10 +- src/libextra/json.rs | 68 ++++++------- src/libextra/list.rs | 4 +- src/libextra/num/bigint.rs | 18 ++-- src/libextra/num/complex.rs | 8 +- src/libextra/num/rational.rs | 6 +- src/libextra/ringbuf.rs | 24 ++--- src/libextra/semver.rs | 10 +- src/libextra/smallintmap.rs | 2 +- src/libextra/sort.rs | 20 ++-- src/libextra/stats.rs | 12 +-- src/libextra/sync.rs | 22 ++-- src/libextra/term.rs | 12 +-- src/libextra/terminfo/parm.rs | 22 ++-- src/libextra/terminfo/parser/compiled.rs | 37 +++---- src/libextra/terminfo/searcher.rs | 4 +- src/libextra/test.rs | 66 ++++++------ src/libextra/time.rs | 76 +++++++------- src/libextra/treemap.rs | 4 +- src/libextra/url.rs | 22 ++-- src/libextra/uuid.rs | 31 +++--- src/libextra/workcache.rs | 28 ++--- 36 files changed, 424 insertions(+), 421 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index be55af697c66a..40ddea538955b 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -255,7 +255,7 @@ impl MutexArc { let inner = x.unwrap(); let MutexArcInner { failed: failed, data: data, _ } = inner; if failed { - fail!(~"Can't unwrap poisoned MutexArc - another task failed inside!"); + fail2!("Can't unwrap poisoned MutexArc - another task failed inside!"); } data } @@ -300,9 +300,9 @@ impl MutexArc { fn check_poison(is_mutex: bool, failed: bool) { if failed { if is_mutex { - fail!("Poisoned MutexArc - another task failed inside!"); + fail2!("Poisoned MutexArc - another task failed inside!"); } else { - fail!("Poisoned rw_arc - another task failed inside!"); + fail2!("Poisoned rw_arc - another task failed inside!"); } } } @@ -505,7 +505,7 @@ impl RWArc { let inner = x.unwrap(); let RWArcInner { failed: failed, data: data, _ } = inner; if failed { - fail!(~"Can't unwrap poisoned RWArc - another task failed inside!") + fail2!(~"Can't unwrap poisoned RWArc - another task failed inside!") } data } @@ -619,7 +619,7 @@ mod tests { assert_eq!(arc_v.get()[2], 3); assert_eq!(arc_v.get()[4], 5); - info!(arc_v); + info2!("{:?}", arc_v); } #[test] diff --git a/src/libextra/arena.rs b/src/libextra/arena.rs index 63c8e2010b07a..520faad1afa07 100644 --- a/src/libextra/arena.rs +++ b/src/libextra/arena.rs @@ -127,7 +127,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) { let start = round_up_to(after_tydesc, align); - //debug!("freeing object: idx = %u, size = %u, align = %u, done = %b", + //debug2!("freeing object: idx = {}, size = {}, align = {}, done = {}", // start, size, align, is_done); if is_done { ((*tydesc).drop_glue)(ptr::offset(buf, start as int) as *i8); @@ -176,7 +176,7 @@ impl Arena { } this.pod_head.fill = end; - //debug!("idx = %u, size = %u, align = %u, fill = %u", + //debug2!("idx = {}, size = {}, align = {}, fill = {}", // start, n_bytes, align, head.fill); ptr::offset(vec::raw::to_ptr(this.pod_head.data), start as int) @@ -232,7 +232,7 @@ impl Arena { let head = transmute_mut_region(&mut self.head); head.fill = round_up_to(end, sys::pref_align_of::<*TyDesc>()); - //debug!("idx = %u, size = %u, align = %u, fill = %u", + //debug2!("idx = {}, size = {}, align = {}, fill = {}", // start, n_bytes, align, head.fill); let buf = vec::raw::to_ptr(self.head.data); @@ -305,6 +305,6 @@ fn test_arena_destructors_fail() { // Now, fail while allocating do arena.alloc::<@int> { // Now fail. - fail!(); + fail2!(); }; } diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs index 730f92d953bb4..ed366047c848b 100644 --- a/src/libextra/base64.rs +++ b/src/libextra/base64.rs @@ -141,7 +141,7 @@ impl<'self> ToBase64 for &'self [u8] { v.push('=' as u8); } } - _ => fail!("Algebra is broken, please alert the math police") + _ => fail2!("Algebra is broken, please alert the math police") } unsafe { @@ -202,7 +202,7 @@ impl<'self> FromBase64 for &'self str { '/'|'_' => buf |= 0x3F, '\r'|'\n' => loop, '=' => break, - _ => return Err(fmt!("Invalid character '%c' at position %u", + _ => return Err(format!("Invalid character '{}' at position {}", self.char_at(idx), idx)) } @@ -218,7 +218,7 @@ impl<'self> FromBase64 for &'self str { for (idx, byte) in it { if (byte as char) != '=' { - return Err(fmt!("Invalid character '%c' at position %u", + return Err(format!("Invalid character '{}' at position {}", self.char_at(idx), idx)); } } diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index a24f3521fea99..49a38a00b1003 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -232,7 +232,7 @@ pub struct Bitv { } fn die() -> ! { - fail!("Tried to do operation on bit vectors with different sizes"); + fail2!("Tried to do operation on bit vectors with different sizes"); } impl Bitv { @@ -1357,7 +1357,7 @@ mod tests { let mut b = Bitv::new(14, true); b.clear(); do b.ones |i| { - fail!("found 1 at %?", i) + fail2!("found 1 at {:?}", i) }; } @@ -1366,7 +1366,7 @@ mod tests { let mut b = Bitv::new(140, true); b.clear(); do b.ones |i| { - fail!("found 1 at %?", i) + fail2!("found 1 at {:?}", i) }; } diff --git a/src/libextra/comm.rs b/src/libextra/comm.rs index dc6f4964b3177..476755919a4c4 100644 --- a/src/libextra/comm.rs +++ b/src/libextra/comm.rs @@ -179,7 +179,7 @@ mod test { let (port, chan) = rendezvous(); do spawn_unlinked { chan.duplex_stream.send(()); // Can't access this field outside this module - fail!() + fail2!() } port.recv() } @@ -189,7 +189,7 @@ mod test { let (port, chan) = rendezvous(); do spawn_unlinked { port.duplex_stream.recv(); - fail!() + fail2!() } chan.try_send(()); } @@ -200,7 +200,7 @@ mod test { let (port, chan) = rendezvous(); do spawn_unlinked { port.duplex_stream.recv(); - fail!() + fail2!() } chan.send(()); } diff --git a/src/libextra/crypto/cryptoutil.rs b/src/libextra/crypto/cryptoutil.rs index 3573bb55948f1..8c97f7db2bd8a 100644 --- a/src/libextra/crypto/cryptoutil.rs +++ b/src/libextra/crypto/cryptoutil.rs @@ -109,23 +109,23 @@ impl ToBits for u64 { } } -/// Adds the specified number of bytes to the bit count. fail!() if this would cause numeric +/// Adds the specified number of bytes to the bit count. fail2!() if this would cause numeric /// overflow. pub fn add_bytes_to_bits(bits: T, bytes: T) -> T { let (new_high_bits, new_low_bits) = bytes.to_bits(); if new_high_bits > Zero::zero() { - fail!("Numeric overflow occured.") + fail2!("Numeric overflow occured.") } match bits.checked_add(&new_low_bits) { Some(x) => return x, - None => fail!("Numeric overflow occured.") + None => fail2!("Numeric overflow occured.") } } /// Adds the specified number of bytes to the bit count, which is a tuple where the first element is -/// the high order value. fail!() if this would cause numeric overflow. +/// the high order value. fail2!() if this would cause numeric overflow. pub fn add_bytes_to_bits_tuple (bits: (T, T), bytes: T) -> (T, T) { @@ -144,7 +144,7 @@ pub fn add_bytes_to_bits_tuple } else { match hi.checked_add(&new_high_bits) { Some(y) => return (y, x), - None => fail!("Numeric overflow occured.") + None => fail2!("Numeric overflow occured.") } } }, @@ -152,7 +152,7 @@ pub fn add_bytes_to_bits_tuple let one: T = One::one(); let z = match new_high_bits.checked_add(&one) { Some(w) => w, - None => fail!("Numeric overflow occured.") + None => fail2!("Numeric overflow occured.") }; match hi.checked_add(&z) { // This re-executes the addition that was already performed earlier when overflow @@ -163,7 +163,7 @@ pub fn add_bytes_to_bits_tuple // be Unsigned - overflow is not defined for Signed types. This function could be // implemented for signed types as well if that were needed. Some(y) => return (y, low + new_low_bits), - None => fail!("Numeric overflow occured.") + None => fail2!("Numeric overflow occured.") } } } diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index da5d5d00e80cf..bf91c5c5d7e6f 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -632,11 +632,11 @@ pub fn check_links(list: &DList) { loop { match (last_ptr, node_ptr.prev.resolve_immut()) { (None , None ) => {} - (None , _ ) => fail!("prev link for list_head"), + (None , _ ) => fail2!("prev link for list_head"), (Some(p), Some(pptr)) => { assert_eq!(p as *Node, pptr as *Node); } - _ => fail!("prev link is none, not good"), + _ => fail2!("prev link is none, not good"), } match node_ptr.next { Some(ref next) => { diff --git a/src/libextra/ebml.rs b/src/libextra/ebml.rs index 4e5094dab6341..8cba1a417d049 100644 --- a/src/libextra/ebml.rs +++ b/src/libextra/ebml.rs @@ -138,7 +138,7 @@ pub mod reader { (data[start + 3u] as uint), next: start + 4u}; } - fail!("vint too big"); + fail2!("vint too big"); } #[cfg(target_arch = "x86")] @@ -216,8 +216,8 @@ pub mod reader { match maybe_get_doc(d, tg) { Some(d) => d, None => { - error!("failed to find block with tag %u", tg); - fail!(); + error2!("failed to find block with tag {}", tg); + fail2!(); } } } @@ -305,20 +305,20 @@ pub mod reader { self.pos = r_doc.end; let str = r_doc.as_str_slice(); if lbl != str { - fail!("Expected label %s but found %s", lbl, str); + fail2!("Expected label {} but found {}", lbl, str); } } } } fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> Doc { - debug!(". next_doc(exp_tag=%?)", exp_tag); + debug2!(". next_doc(exp_tag={:?})", exp_tag); if self.pos >= self.parent.end { - fail!("no more documents in current node!"); + fail2!("no more documents in current node!"); } let TaggedDoc { tag: r_tag, doc: r_doc } = doc_at(self.parent.data, self.pos); - debug!("self.parent=%?-%? self.pos=%? r_tag=%? r_doc=%?-%?", + debug2!("self.parent={}-{} self.pos={} r_tag={} r_doc={}-{}", self.parent.start, self.parent.end, self.pos, @@ -326,10 +326,11 @@ pub mod reader { r_doc.start, r_doc.end); if r_tag != (exp_tag as uint) { - fail!("expected EBML doc with tag %? but found tag %?", exp_tag, r_tag); + fail2!("expected EBML doc with tag {:?} but found tag {:?}", + exp_tag, r_tag); } if r_doc.end > self.parent.end { - fail!("invalid EBML, child extends to 0x%x, parent to 0x%x", + fail2!("invalid EBML, child extends to {:#x}, parent to {:#x}", r_doc.end, self.parent.end); } self.pos = r_doc.end; @@ -351,7 +352,7 @@ pub mod reader { fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> uint { let r = doc_as_u32(self.next_doc(exp_tag)); - debug!("_next_uint exp_tag=%? result=%?", exp_tag, r); + debug2!("_next_uint exp_tag={:?} result={}", exp_tag, r); r as uint } } @@ -383,7 +384,7 @@ pub mod reader { fn read_uint(&mut self) -> uint { let v = doc_as_u64(self.next_doc(EsUint)); if v > (::std::uint::max_value as u64) { - fail!("uint %? too large for this architecture", v); + fail2!("uint {} too large for this architecture", v); } v as uint } @@ -403,8 +404,8 @@ pub mod reader { fn read_int(&mut self) -> int { let v = doc_as_u64(self.next_doc(EsInt)) as i64; if v > (int::max_value as i64) || v < (int::min_value as i64) { - debug!("FIXME #6122: Removing this makes this function miscompile"); - fail!("int %? out of range for this architecture", v); + debug2!("FIXME \\#6122: Removing this makes this function miscompile"); + fail2!("int {} out of range for this architecture", v); } v as int } @@ -437,7 +438,7 @@ pub mod reader { name: &str, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum(%s)", name); + debug2!("read_enum({})", name); self._check_label(name); let doc = self.next_doc(EsEnum); @@ -457,9 +458,9 @@ pub mod reader { _: &[&str], f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_enum_variant()"); + debug2!("read_enum_variant()"); let idx = self._next_uint(EsEnumVid); - debug!(" idx=%u", idx); + debug2!(" idx={}", idx); let doc = self.next_doc(EsEnumBody); @@ -477,7 +478,7 @@ pub mod reader { fn read_enum_variant_arg(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum_variant_arg(idx=%u)", idx); + debug2!("read_enum_variant_arg(idx={})", idx); f(self) } @@ -485,9 +486,9 @@ pub mod reader { _: &[&str], f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_enum_struct_variant()"); + debug2!("read_enum_struct_variant()"); let idx = self._next_uint(EsEnumVid); - debug!(" idx=%u", idx); + debug2!(" idx={}", idx); let doc = self.next_doc(EsEnumBody); @@ -507,7 +508,7 @@ pub mod reader { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum_struct_variant_arg(name=%?, idx=%u)", name, idx); + debug2!("read_enum_struct_variant_arg(name={}, idx={})", name, idx); f(self) } @@ -516,7 +517,7 @@ pub mod reader { _: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_struct(name=%s)", name); + debug2!("read_struct(name={})", name); f(self) } @@ -525,19 +526,19 @@ pub mod reader { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_struct_field(name=%?, idx=%u)", name, idx); + debug2!("read_struct_field(name={}, idx={})", name, idx); self._check_label(name); f(self) } fn read_tuple(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_tuple()"); + debug2!("read_tuple()"); self.read_seq(f) } fn read_tuple_arg(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_tuple_arg(idx=%u)", idx); + debug2!("read_tuple_arg(idx={})", idx); self.read_seq_elt(idx, f) } @@ -545,7 +546,7 @@ pub mod reader { name: &str, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_tuple_struct(name=%?)", name); + debug2!("read_tuple_struct(name={})", name); self.read_tuple(f) } @@ -553,43 +554,43 @@ pub mod reader { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_tuple_struct_arg(idx=%u)", idx); + debug2!("read_tuple_struct_arg(idx={})", idx); self.read_tuple_arg(idx, f) } fn read_option(&mut self, f: &fn(&mut Decoder, bool) -> T) -> T { - debug!("read_option()"); + debug2!("read_option()"); do self.read_enum("Option") |this| { do this.read_enum_variant(["None", "Some"]) |this, idx| { match idx { 0 => f(this, false), 1 => f(this, true), - _ => fail!(), + _ => fail2!(), } } } } fn read_seq(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_seq()"); + debug2!("read_seq()"); do self.push_doc(EsVec) |d| { let len = d._next_uint(EsVecLen); - debug!(" len=%u", len); + debug2!(" len={}", len); f(d, len) } } fn read_seq_elt(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_seq_elt(idx=%u)", idx); + debug2!("read_seq_elt(idx={})", idx); self.push_doc(EsVecElt, f) } fn read_map(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_map()"); + debug2!("read_map()"); do self.push_doc(EsMap) |d| { let len = d._next_uint(EsMapLen); - debug!(" len=%u", len); + debug2!(" len={}", len); f(d, len) } } @@ -598,7 +599,7 @@ pub mod reader { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_map_elt_key(idx=%u)", idx); + debug2!("read_map_elt_key(idx={})", idx); self.push_doc(EsMapKey, f) } @@ -606,7 +607,7 @@ pub mod reader { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_map_elt_val(idx=%u)", idx); + debug2!("read_map_elt_val(idx={})", idx); self.push_doc(EsMapVal, f) } } @@ -642,7 +643,7 @@ pub mod writer { n as u8]), 4u => w.write(&[0x10u8 | ((n >> 24_u) as u8), (n >> 16_u) as u8, (n >> 8_u) as u8, n as u8]), - _ => fail!("vint to write too big: %?", n) + _ => fail2!("vint to write too big: {}", n) }; } @@ -651,7 +652,7 @@ pub mod writer { if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; } if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; } if n < 0x10000000_u { write_sized_vuint(w, n, 4u); return; } - fail!("vint to write too big: %?", n); + fail2!("vint to write too big: {}", n); } pub fn Encoder(w: @io::Writer) -> Encoder { @@ -665,7 +666,7 @@ pub mod writer { // FIXME (#2741): Provide a function to write the standard ebml header. impl Encoder { pub fn start_tag(&mut self, tag_id: uint) { - debug!("Start tag %u", tag_id); + debug2!("Start tag {}", tag_id); // Write the enum ID: write_vuint(self.writer, tag_id); @@ -684,7 +685,7 @@ pub mod writer { write_sized_vuint(self.writer, size, 4u); self.writer.seek(cur_pos as int, io::SeekSet); - debug!("End tag (size = %u)", size); + debug2!("End tag (size = {})", size); } pub fn wr_tag(&mut self, tag_id: uint, blk: &fn()) { @@ -748,12 +749,12 @@ pub mod writer { } pub fn wr_bytes(&mut self, b: &[u8]) { - debug!("Write %u bytes", b.len()); + debug2!("Write {} bytes", b.len()); self.writer.write(b); } pub fn wr_str(&mut self, s: &str) { - debug!("Write str: %?", s); + debug2!("Write str: {}", s); self.writer.write(s.as_bytes()); } } @@ -977,7 +978,7 @@ mod tests { #[test] fn test_option_int() { fn test_v(v: Option) { - debug!("v == %?", v); + debug2!("v == {:?}", v); let bytes = do io::with_bytes_writer |wr| { let mut ebml_w = writer::Encoder(wr); v.encode(&mut ebml_w) @@ -985,7 +986,7 @@ mod tests { let ebml_doc = reader::Doc(@bytes); let mut deser = reader::Decoder(ebml_doc); let v1 = serialize::Decodable::decode(&mut deser); - debug!("v1 == %?", v1); + debug2!("v1 == {:?}", v1); assert_eq!(v, v1); } diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs index 3ce58b58db6da..37bcb447f082e 100644 --- a/src/libextra/fileinput.rs +++ b/src/libextra/fileinput.rs @@ -43,7 +43,7 @@ to handle any `FileInput` structs. E.g. a simple `cat` program or a program that numbers lines after concatenating two files for input_vec_state(make_path_option_vec([~"a.txt", ~"b.txt"])) |line, state| { - io::println(fmt!("%u: %s", state.line_num, + io::println(format!("{}: %s", state.line_num, line)); } @@ -88,7 +88,7 @@ total line count). input.next_file(); // skip! for input.each_line_state |line, state| { - io::println(fmt!("%u: %s", state.line_num_file, + io::println(format!("{}: %s", state.line_num_file, line)) } } @@ -449,11 +449,11 @@ mod test { fn test_fileinput_read_byte() { let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-fileinput-read-byte-%u.tmp", i)), true); + |i| format!("tmp/lib-fileinput-test-fileinput-read-byte-{}.tmp", i)), true); // 3 files containing 0\n, 1\n, and 2\n respectively for (i, filename) in filenames.iter().enumerate() { - make_file(filename.get_ref(), [fmt!("%u", i)]); + make_file(filename.get_ref(), [format!("{}", i)]); } let fi = FileInput::from_vec(filenames.clone()); @@ -479,11 +479,11 @@ mod test { fn test_fileinput_read() { let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-fileinput-read-%u.tmp", i)), true); + |i| format!("tmp/lib-fileinput-test-fileinput-read-{}.tmp", i)), true); // 3 files containing 1\n, 2\n, and 3\n respectively for (i, filename) in filenames.iter().enumerate() { - make_file(filename.get_ref(), [fmt!("%u", i)]); + make_file(filename.get_ref(), [format!("{}", i)]); } let fi = FileInput::from_vec(filenames); @@ -500,13 +500,13 @@ mod test { let mut all_lines = ~[]; let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-input-vec-%u.tmp", i)), true); + |i| format!("tmp/lib-fileinput-test-input-vec-{}.tmp", i)), true); for (i, filename) in filenames.iter().enumerate() { let contents = - vec::from_fn(3, |j| fmt!("%u %u", i, j)); + vec::from_fn(3, |j| format!("{} {}", i, j)); make_file(filename.get_ref(), contents); - debug!("contents=%?", contents); + debug2!("contents={:?}", contents); all_lines.push_all(contents); } @@ -522,11 +522,11 @@ mod test { fn test_input_vec_state() { let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-input-vec-state-%u.tmp", i)),true); + |i| format!("tmp/lib-fileinput-test-input-vec-state-{}.tmp", i)),true); for (i, filename) in filenames.iter().enumerate() { let contents = - vec::from_fn(3, |j| fmt!("%u %u", i, j + 1)); + vec::from_fn(3, |j| format!("{} {}", i, j + 1)); make_file(filename.get_ref(), contents); } @@ -544,7 +544,7 @@ mod test { fn test_empty_files() { let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-empty-files-%u.tmp", i)),true); + |i| format!("tmp/lib-fileinput-test-empty-files-{}.tmp", i)),true); make_file(filenames[0].get_ref(), [~"1", ~"2"]); make_file(filenames[1].get_ref(), []); @@ -555,7 +555,7 @@ mod test { let expected_path = match line { "1" | "2" => filenames[0].clone(), "3" | "4" => filenames[2].clone(), - _ => fail!("unexpected line") + _ => fail2!("unexpected line") }; assert_eq!(state.current_path.clone(), expected_path); count += 1; @@ -593,11 +593,11 @@ mod test { fn test_next_file() { let filenames = make_path_option_vec(vec::from_fn( 3, - |i| fmt!("tmp/lib-fileinput-test-next-file-%u.tmp", i)),true); + |i| format!("tmp/lib-fileinput-test-next-file-{}.tmp", i)),true); for (i, filename) in filenames.iter().enumerate() { let contents = - vec::from_fn(3, |j| fmt!("%u %u", i, j + 1)); + vec::from_fn(3, |j| format!("{} {}", i, j + 1)); make_file(filename.get_ref(), contents); } @@ -609,7 +609,7 @@ mod test { // read all lines from 1 (but don't read any from 2), for i in range(1u, 4) { - assert_eq!(input.read_line(), fmt!("1 %u", i)); + assert_eq!(input.read_line(), format!("1 {}", i)); } // 1 is finished, but 2 hasn't been started yet, so this will // just "skip" to the beginning of 2 (Python's fileinput does diff --git a/src/libextra/flate.rs b/src/libextra/flate.rs index e12ac27648243..616c7522a488b 100644 --- a/src/libextra/flate.rs +++ b/src/libextra/flate.rs @@ -121,11 +121,11 @@ mod tests { do 2000.times { input.push_all(r.choose(words)); } - debug!("de/inflate of %u bytes of random word-sequences", + debug2!("de/inflate of {} bytes of random word-sequences", input.len()); let cmp = deflate_bytes(input); let out = inflate_bytes(cmp); - debug!("%u bytes deflated to %u (%.1f%% size)", + debug2!("{} bytes deflated to {} ({:.1f}% size)", input.len(), cmp.len(), 100.0 * ((cmp.len() as float) / (input.len() as float))); assert_eq!(input, out); diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs index 886a28ac9793f..1fd81626188c5 100644 --- a/src/libextra/flatpipes.rs +++ b/src/libextra/flatpipes.rs @@ -261,14 +261,14 @@ impl,P:BytePort> GenericPort for FlatPort { fn recv(&self) -> T { match self.try_recv() { Some(val) => val, - None => fail!("port is closed") + None => fail2!("port is closed") } } fn try_recv(&self) -> Option { let command = match self.byte_port.try_recv(CONTINUE.len()) { Some(c) => c, None => { - warn!("flatpipe: broken pipe"); + warn2!("flatpipe: broken pipe"); return None; } }; @@ -279,7 +279,7 @@ impl,P:BytePort> GenericPort for FlatPort { io::u64_from_be_bytes(bytes, 0, size_of::()) }, None => { - warn!("flatpipe: broken pipe"); + warn2!("flatpipe: broken pipe"); return None; } }; @@ -291,13 +291,13 @@ impl,P:BytePort> GenericPort for FlatPort { Some(self.unflattener.unflatten(bytes)) } None => { - warn!("flatpipe: broken pipe"); + warn2!("flatpipe: broken pipe"); return None; } } } else { - fail!("flatpipe: unrecognized command"); + fail2!("flatpipe: unrecognized command"); } } } @@ -477,7 +477,7 @@ pub mod flatteners { Ok(json) => { json::Decoder(json) } - Err(e) => fail!("flatpipe: can't parse json: %?", e) + Err(e) => fail2!("flatpipe: can't parse json: {:?}", e) } } } @@ -536,7 +536,7 @@ pub mod bytepipes { if left == 0 { return Some(bytes); } else { - warn!("flatpipe: dropped %? broken bytes", left); + warn2!("flatpipe: dropped {} broken bytes", left); return None; } } @@ -797,7 +797,7 @@ mod test { let listen_res = do tcp::listen( addr.clone(), port, 128, iotask, |_kill_ch| { // Tell the sender to initiate the connection - debug!("listening"); + debug2!("listening"); begin_connect_chan.send(()) }) |new_conn, kill_ch| { @@ -820,7 +820,7 @@ mod test { // Wait for the server to start listening begin_connect_port.recv(); - debug!("connecting"); + debug2!("connecting"); let iotask = &uv::global_loop::get(); let connect_result = tcp::connect(addr.clone(), port, iotask); assert!(connect_result.is_ok()); @@ -831,7 +831,7 @@ mod test { let chan = writer_chan(socket_buf); for i in range(0, 10) { - debug!("sending %?", i); + debug2!("sending {}", i); chan.send(i) } } @@ -841,9 +841,9 @@ mod test { // Wait for a connection let (conn, res_chan) = accept_port.recv(); - debug!("accepting connection"); + debug2!("accepting connection"); let accept_result = tcp::accept(conn); - debug!("accepted"); + debug2!("accepted"); assert!(accept_result.is_ok()); let sock = result::unwrap(accept_result); res_chan.send(()); @@ -855,7 +855,7 @@ mod test { for i in range(0, 10) { let j = port.recv(); - debug!("received %?", j); + debug2!("received {:?}", j); assert_eq!(i, j); } diff --git a/src/libextra/future.rs b/src/libextra/future.rs index fdb296e5f403b..516a34f531283 100644 --- a/src/libextra/future.rs +++ b/src/libextra/future.rs @@ -57,7 +57,7 @@ impl Future { let state = replace(&mut this.state, Evaluating); match state { Forced(v) => v, - _ => fail!( "Logic error." ), + _ => fail2!( "Logic error." ), } } @@ -69,10 +69,10 @@ impl Future { */ match self.state { Forced(ref v) => return v, - Evaluating => fail!("Recursive forcing of future!"), + Evaluating => fail2!("Recursive forcing of future!"), Pending(_) => { match replace(&mut self.state, Evaluating) { - Forced(_) | Evaluating => fail!("Logic error."), + Forced(_) | Evaluating => fail2!("Logic error."), Pending(f) => { self.state = Forced(f()); self.get_ref() @@ -217,7 +217,7 @@ mod test { #[test] #[should_fail] fn test_futurefail() { - let mut f = Future::spawn(|| fail!()); + let mut f = Future::spawn(|| fail2!()); let _x: ~str = f.get(); } diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index b5a98bd074013..e9ccbbf605a37 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -60,7 +60,7 @@ //! ]; //! let matches = match getopts(args.tail(), opts) { //! Ok(m) => { m } -//! Err(f) => { fail!(f.to_err_msg()) } +//! Err(f) => { fail2!(f.to_err_msg()) } //! }; //! if matches.opt_present("h") || matches.opt_present("help") { //! print_usage(program, opts); @@ -185,7 +185,7 @@ impl Matches { pub fn opt_vals(&self, nm: &str) -> ~[Optval] { match find_opt(self.opts, Name::from_str(nm)) { Some(id) => self.vals[id].clone(), - None => fail!("No option '%s' defined", nm) + None => fail2!("No option '{}' defined", nm) } } @@ -365,19 +365,19 @@ impl Fail_ { pub fn to_err_msg(self) -> ~str { match self { ArgumentMissing(ref nm) => { - fmt!("Argument to option '%s' missing.", *nm) + format!("Argument to option '{}' missing.", *nm) } UnrecognizedOption(ref nm) => { - fmt!("Unrecognized option: '%s'.", *nm) + format!("Unrecognized option: '{}'.", *nm) } OptionMissing(ref nm) => { - fmt!("Required option '%s' missing.", *nm) + format!("Required option '{}' missing.", *nm) } OptionDuplicated(ref nm) => { - fmt!("Option '%s' given more than once.", *nm) + format!("Option '{}' given more than once.", *nm) } UnexpectedArgument(ref nm) => { - fmt!("Option '%s' does not take an argument.", *nm) + format!("Option '{}' does not take an argument.", *nm) } } } @@ -551,7 +551,7 @@ pub mod groups { } = (*self).clone(); match (short_name.len(), long_name.len()) { - (0,0) => fail!("this long-format option was given no name"), + (0,0) => fail2!("this long-format option was given no name"), (0,_) => Opt { name: Long((long_name)), hasarg: hasarg, @@ -577,7 +577,7 @@ pub mod groups { } ] }, - (_,_) => fail!("something is wrong with the long-form opt") + (_,_) => fail2!("something is wrong with the long-form opt") } } } @@ -696,7 +696,7 @@ pub mod groups { row.push_str(short_name); row.push_char(' '); } - _ => fail!("the short name should only be 1 ascii char long"), + _ => fail2!("the short name should only be 1 ascii char long"), } // long option @@ -752,7 +752,7 @@ pub mod groups { row }); - fmt!("%s\n\nOptions:\n%s\n", brief, rows.collect::<~[~str]>().connect("\n")) + format!("{}\n\nOptions:\n{}\n", brief, rows.collect::<~[~str]>().connect("\n")) } /// Splits a string into substrings with possibly internal whitespace, @@ -810,7 +810,7 @@ pub mod groups { (B, Cr, UnderLim) => { B } (B, Cr, OverLim) if (i - last_start + 1) > lim - => fail!("word starting with %? longer than limit!", + => fail2!("word starting with {} longer than limit!", ss.slice(last_start, i + 1)), (B, Cr, OverLim) => { slice(); slice_start = last_start; B } (B, Ws, UnderLim) => { last_end = i; C } @@ -883,7 +883,7 @@ mod tests { assert!(m.opt_present("test")); assert_eq!(m.opt_str("test").unwrap(), ~"20"); } - _ => { fail!("test_reqopt_long failed"); } + _ => { fail2!("test_reqopt_long failed"); } } } @@ -894,7 +894,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionMissing_), - _ => fail!() + _ => fail2!() } } @@ -905,7 +905,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -916,7 +916,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -930,7 +930,7 @@ mod tests { assert!(m.opt_present("t")); assert_eq!(m.opt_str("t").unwrap(), ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -941,7 +941,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionMissing_), - _ => fail!() + _ => fail2!() } } @@ -952,7 +952,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -963,7 +963,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -979,7 +979,7 @@ mod tests { assert!(m.opt_present("test")); assert_eq!(m.opt_str("test").unwrap(), ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -990,7 +990,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("test")), - _ => fail!() + _ => fail2!() } } @@ -1001,7 +1001,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -1012,7 +1012,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -1026,7 +1026,7 @@ mod tests { assert!((m.opt_present("t"))); assert_eq!(m.opt_str("t").unwrap(), ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -1037,7 +1037,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("t")), - _ => fail!() + _ => fail2!() } } @@ -1048,7 +1048,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -1059,7 +1059,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -1072,7 +1072,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(m.opt_present("test")), - _ => fail!() + _ => fail2!() } } @@ -1083,7 +1083,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("test")), - _ => fail!() + _ => fail2!() } } @@ -1094,10 +1094,10 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => { - error!(f.clone().to_err_msg()); + error2!("{:?}", f.clone().to_err_msg()); check_fail_type(f, UnexpectedArgument_); } - _ => fail!() + _ => fail2!() } } @@ -1108,7 +1108,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -1119,7 +1119,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(m.opt_present("t")), - _ => fail!() + _ => fail2!() } } @@ -1130,7 +1130,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("t")), - _ => fail!() + _ => fail2!() } } @@ -1145,7 +1145,7 @@ mod tests { assert!(m.free[0] == ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -1156,7 +1156,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, OptionDuplicated_), - _ => fail!() + _ => fail2!() } } @@ -1170,7 +1170,7 @@ mod tests { Ok(ref m) => { assert_eq!(m.opt_count("v"), 1); } - _ => fail!() + _ => fail2!() } } @@ -1183,7 +1183,7 @@ mod tests { Ok(ref m) => { assert_eq!(m.opt_count("v"), 2); } - _ => fail!() + _ => fail2!() } } @@ -1196,7 +1196,7 @@ mod tests { Ok(ref m) => { assert_eq!(m.opt_count("v"), 2); } - _ => fail!() + _ => fail2!() } } @@ -1209,7 +1209,7 @@ mod tests { Ok(ref m) => { assert_eq!(m.opt_count("verbose"), 1); } - _ => fail!() + _ => fail2!() } } @@ -1222,7 +1222,7 @@ mod tests { Ok(ref m) => { assert_eq!(m.opt_count("verbose"), 2); } - _ => fail!() + _ => fail2!() } } @@ -1237,7 +1237,7 @@ mod tests { assert!((m.opt_present("test"))); assert_eq!(m.opt_str("test").unwrap(), ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -1248,7 +1248,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("test")), - _ => fail!() + _ => fail2!() } } @@ -1259,7 +1259,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -1276,7 +1276,7 @@ mod tests { assert!(pair[0] == ~"20"); assert!(pair[1] == ~"30"); } - _ => fail!() + _ => fail2!() } } @@ -1290,7 +1290,7 @@ mod tests { assert!((m.opt_present("t"))); assert_eq!(m.opt_str("t").unwrap(), ~"20"); } - _ => fail!() + _ => fail2!() } } @@ -1301,7 +1301,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert!(!m.opt_present("t")), - _ => fail!() + _ => fail2!() } } @@ -1312,7 +1312,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), - _ => fail!() + _ => fail2!() } } @@ -1329,7 +1329,7 @@ mod tests { assert!(pair[0] == ~"20"); assert!(pair[1] == ~"30"); } - _ => fail!() + _ => fail2!() } } @@ -1340,7 +1340,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, UnrecognizedOption_), - _ => fail!() + _ => fail2!() } } @@ -1351,7 +1351,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(f) => check_fail_type(f, UnrecognizedOption_), - _ => fail!() + _ => fail2!() } } @@ -1383,7 +1383,7 @@ mod tests { assert!(pair[1] == ~"-60 70"); assert!((!m.opt_present("notpresent"))); } - _ => fail!() + _ => fail2!() } } @@ -1394,7 +1394,7 @@ mod tests { let args_single = ~[~"-e", ~"foo"]; let matches_single = &match getopts(args_single, opts) { result::Ok(m) => m, - result::Err(_) => fail!() + result::Err(_) => fail2!() }; assert!(matches_single.opts_present([~"e"])); assert!(matches_single.opts_present([~"encrypt", ~"e"])); @@ -1410,7 +1410,7 @@ mod tests { let args_both = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"]; let matches_both = &match getopts(args_both, opts) { result::Ok(m) => m, - result::Err(_) => fail!() + result::Err(_) => fail2!() }; assert!(matches_both.opts_present([~"e"])); assert!(matches_both.opts_present([~"encrypt"])); @@ -1432,7 +1432,7 @@ mod tests { let opts = ~[optmulti("L"), optmulti("M")]; let matches = &match getopts(args, opts) { result::Ok(m) => m, - result::Err(_) => fail!() + result::Err(_) => fail2!() }; assert!(matches.opts_present([~"L"])); assert_eq!(matches.opts_str([~"L"]).unwrap(), ~"foo"); @@ -1575,8 +1575,8 @@ Options: let generated_usage = groups::usage("Usage: fruits", optgroups); - debug!("expected: <<%s>>", expected); - debug!("generated: <<%s>>", generated_usage); + debug2!("expected: <<{}>>", expected); + debug2!("generated: <<{}>>", generated_usage); assert_eq!(generated_usage, expected); } @@ -1603,8 +1603,8 @@ Options: let usage = groups::usage("Usage: fruits", optgroups); - debug!("expected: <<%s>>", expected); - debug!("generated: <<%s>>", usage); + debug2!("expected: <<{}>>", expected); + debug2!("generated: <<{}>>", usage); assert!(usage == expected) } @@ -1630,8 +1630,8 @@ Options: let usage = groups::usage("Usage: fruits", optgroups); - debug!("expected: <<%s>>", expected); - debug!("generated: <<%s>>", usage); + debug2!("expected: <<{}>>", expected); + debug2!("generated: <<{}>>", usage); assert!(usage == expected) } } diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs index 76ac7c91832bd..9af2f1acc6931 100644 --- a/src/libextra/glob.rs +++ b/src/libextra/glob.rs @@ -552,13 +552,13 @@ mod test { let pat = Pattern::new("a[0-9]b"); for i in range(0, 10) { - assert!(pat.matches(fmt!("a%db", i))); + assert!(pat.matches(format!("a{}b", i))); } assert!(!pat.matches("a_b")); let pat = Pattern::new("a[!0-9]b"); for i in range(0, 10) { - assert!(!pat.matches(fmt!("a%db", i))); + assert!(!pat.matches(format!("a{}b", i))); } assert!(pat.matches("a_b")); diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs index ad812513f840e..709b4a95981f2 100644 --- a/src/libextra/hex.rs +++ b/src/libextra/hex.rs @@ -102,8 +102,8 @@ impl<'self> FromHex for &'self str { buf >>= 4; loop } - _ => return Err(fmt!("Invalid character '%c' at position %u", - self.char_at(idx), idx)) + _ => return Err(format!("Invalid character '{}' at position {}", + self.char_at(idx), idx)) } modulus += 1; @@ -158,15 +158,15 @@ mod tests { #[test] pub fn test_to_hex_all_bytes() { for i in range(0, 256) { - assert_eq!([i as u8].to_hex(), fmt!("%02x", i as uint)); + assert_eq!([i as u8].to_hex(), format!("{:02x}", i as uint)); } } #[test] pub fn test_from_hex_all_bytes() { for i in range(0, 256) { - assert_eq!(fmt!("%02x", i as uint).from_hex().unwrap(), ~[i as u8]); - assert_eq!(fmt!("%02X", i as uint).from_hex().unwrap(), ~[i as u8]); + assert_eq!(format!("{:02x}", i as uint).from_hex().unwrap(), ~[i as u8]); + assert_eq!(format!("{:02X}", i as uint).from_hex().unwrap(), ~[i as u8]); } } diff --git a/src/libextra/json.rs b/src/libextra/json.rs index e0e860d102e05..fe1bbfc9ae4c8 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -885,10 +885,10 @@ pub fn Decoder(json: Json) -> Decoder { impl serialize::Decoder for Decoder { fn read_nil(&mut self) -> () { - debug!("read_nil"); + debug2!("read_nil"); match self.stack.pop() { Null => (), - value => fail!("not a null: %?", value) + value => fail2!("not a null: {:?}", value) } } @@ -905,20 +905,20 @@ impl serialize::Decoder for Decoder { fn read_int(&mut self) -> int { self.read_float() as int } fn read_bool(&mut self) -> bool { - debug!("read_bool"); + debug2!("read_bool"); match self.stack.pop() { Boolean(b) => b, - value => fail!("not a boolean: %?", value) + value => fail2!("not a boolean: {:?}", value) } } fn read_f64(&mut self) -> f64 { self.read_float() as f64 } fn read_f32(&mut self) -> f32 { self.read_float() as f32 } fn read_float(&mut self) -> float { - debug!("read_float"); + debug2!("read_float"); match self.stack.pop() { Number(f) => f, - value => fail!("not a number: %?", value) + value => fail2!("not a number: {:?}", value) } } @@ -926,20 +926,20 @@ impl serialize::Decoder for Decoder { let mut v = ~[]; let s = self.read_str(); for c in s.iter() { v.push(c) } - if v.len() != 1 { fail!("string must have one character") } + if v.len() != 1 { fail2!("string must have one character") } v[0] } fn read_str(&mut self) -> ~str { - debug!("read_str"); + debug2!("read_str"); match self.stack.pop() { String(s) => s, - json => fail!("not a string: %?", json) + json => fail2!("not a string: {:?}", json) } } fn read_enum(&mut self, name: &str, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum(%s)", name); + debug2!("read_enum({})", name); f(self) } @@ -947,13 +947,13 @@ impl serialize::Decoder for Decoder { names: &[&str], f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_enum_variant(names=%?)", names); + debug2!("read_enum_variant(names={:?})", names); let name = match self.stack.pop() { String(s) => s, Object(o) => { let n = match o.find(&~"variant").expect("invalidly encoded json") { &String(ref s) => s.clone(), - _ => fail!("invalidly encoded json"), + _ => fail2!("invalidly encoded json"), }; match o.find(&~"fields").expect("invalidly encoded json") { &List(ref l) => { @@ -961,15 +961,15 @@ impl serialize::Decoder for Decoder { self.stack.push(field.clone()); } }, - _ => fail!("invalidly encoded json") + _ => fail2!("invalidly encoded json") } n } - ref json => fail!("invalid variant: %?", *json), + ref json => fail2!("invalid variant: {:?}", *json), }; let idx = match names.iter().position(|n| str::eq_slice(*n, name)) { Some(idx) => idx, - None => fail!("Unknown variant name: %?", name), + None => fail2!("Unknown variant name: {}", name), }; f(self, idx) } @@ -978,7 +978,7 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum_variant_arg(idx=%u)", idx); + debug2!("read_enum_variant_arg(idx={})", idx); f(self) } @@ -986,7 +986,7 @@ impl serialize::Decoder for Decoder { names: &[&str], f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_enum_struct_variant(names=%?)", names); + debug2!("read_enum_struct_variant(names={:?})", names); self.read_enum_variant(names, f) } @@ -996,7 +996,7 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_enum_struct_variant_field(name=%?, idx=%u)", name, idx); + debug2!("read_enum_struct_variant_field(name={}, idx={})", name, idx); self.read_enum_variant_arg(idx, f) } @@ -1005,7 +1005,7 @@ impl serialize::Decoder for Decoder { len: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_struct(name=%s, len=%u)", name, len); + debug2!("read_struct(name={}, len={})", name, len); let value = f(self); self.stack.pop(); value @@ -1016,12 +1016,12 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_struct_field(name=%?, idx=%u)", name, idx); + debug2!("read_struct_field(name={}, idx={})", name, idx); match self.stack.pop() { Object(obj) => { let mut obj = obj; let value = match obj.pop(&name.to_owned()) { - None => fail!("no such field: %s", name), + None => fail2!("no such field: {}", name), Some(json) => { self.stack.push(json); f(self) @@ -1030,12 +1030,12 @@ impl serialize::Decoder for Decoder { self.stack.push(Object(obj)); value } - value => fail!("not an object: %?", value) + value => fail2!("not an object: {:?}", value) } } fn read_tuple(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_tuple()"); + debug2!("read_tuple()"); self.read_seq(f) } @@ -1043,7 +1043,7 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_tuple_arg(idx=%u)", idx); + debug2!("read_tuple_arg(idx={})", idx); self.read_seq_elt(idx, f) } @@ -1051,7 +1051,7 @@ impl serialize::Decoder for Decoder { name: &str, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_tuple_struct(name=%?)", name); + debug2!("read_tuple_struct(name={})", name); self.read_tuple(f) } @@ -1059,7 +1059,7 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_tuple_struct_arg(idx=%u)", idx); + debug2!("read_tuple_struct_arg(idx={})", idx); self.read_tuple_arg(idx, f) } @@ -1071,7 +1071,7 @@ impl serialize::Decoder for Decoder { } fn read_seq(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_seq()"); + debug2!("read_seq()"); let len = match self.stack.pop() { List(list) => { let len = list.len(); @@ -1080,18 +1080,18 @@ impl serialize::Decoder for Decoder { } len } - _ => fail!("not a list"), + _ => fail2!("not a list"), }; f(self, len) } fn read_seq_elt(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_seq_elt(idx=%u)", idx); + debug2!("read_seq_elt(idx={})", idx); f(self) } fn read_map(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T { - debug!("read_map()"); + debug2!("read_map()"); let len = match self.stack.pop() { Object(obj) => { let len = obj.len(); @@ -1101,7 +1101,7 @@ impl serialize::Decoder for Decoder { } len } - json => fail!("not an object: %?", json), + json => fail2!("not an object: {:?}", json), }; f(self, len) } @@ -1110,13 +1110,13 @@ impl serialize::Decoder for Decoder { idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_map_elt_key(idx=%u)", idx); + debug2!("read_map_elt_key(idx={})", idx); f(self) } fn read_map_elt_val(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T { - debug!("read_map_elt_val(idx=%u)", idx); + debug2!("read_map_elt_val(idx={})", idx); f(self) } } @@ -1321,7 +1321,7 @@ impl to_str::ToStr for Json { impl to_str::ToStr for Error { fn to_str(&self) -> ~str { - fmt!("%u:%u: %s", self.line, self.col, *self.msg) + format!("{}:{}: {}", self.line, self.col, *self.msg) } } diff --git a/src/libextra/list.rs b/src/libextra/list.rs index 0e8c50ac87302..5283edbf475e0 100644 --- a/src/libextra/list.rs +++ b/src/libextra/list.rs @@ -96,7 +96,7 @@ pub fn len(ls: @List) -> uint { pub fn tail(ls: @List) -> @List { match *ls { Cons(_, tl) => return tl, - Nil => fail!("list empty") + Nil => fail2!("list empty") } } @@ -105,7 +105,7 @@ pub fn head(ls: @List) -> T { match *ls { Cons(ref hd, _) => (*hd).clone(), // makes me sad - _ => fail!("head invoked on empty list") + _ => fail2!("head invoked on empty list") } } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index efb39f7c51e02..2ec9c7471799f 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -352,7 +352,7 @@ impl Rem for BigUint { impl Neg for BigUint { #[inline] - fn neg(&self) -> BigUint { fail!() } + fn neg(&self) -> BigUint { fail2!() } } impl Integer for BigUint { @@ -374,7 +374,7 @@ impl Integer for BigUint { } fn div_mod_floor(&self, other: &BigUint) -> (BigUint, BigUint) { - if other.is_zero() { fail!() } + if other.is_zero() { fail2!() } if self.is_zero() { return (Zero::zero(), Zero::zero()); } if *other == One::one() { return ((*self).clone(), Zero::zero()); } @@ -726,7 +726,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (1475789056, 8), 15 => (2562890625, 8), 16 => (4294967296, 8), - _ => fail!() + _ => fail2!() } } @@ -750,7 +750,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (38416, 4), 15 => (50625, 4), 16 => (65536, 4), - _ => fail!() + _ => fail2!() } } @@ -1004,7 +1004,7 @@ impl Integer for BigInt { let d = BigInt::from_biguint(Plus, d_ui); let r = BigInt::from_biguint(Plus, r_ui); match (self.sign, other.sign) { - (_, Zero) => fail!(), + (_, Zero) => fail2!(), (Plus, Plus) | (Zero, Plus) => ( d, r), (Plus, Minus) | (Zero, Minus) => (-d, r), (Minus, Plus) => (-d, -r), @@ -1030,7 +1030,7 @@ impl Integer for BigInt { let d = BigInt::from_biguint(Plus, d_ui); let m = BigInt::from_biguint(Plus, m_ui); match (self.sign, other.sign) { - (_, Zero) => fail!(), + (_, Zero) => fail2!(), (Plus, Plus) | (Zero, Plus) => (d, m), (Plus, Minus) | (Zero, Minus) => if m.is_zero() { (-d, Zero::zero()) @@ -1742,7 +1742,7 @@ mod biguint_tests { ~"2" + str::from_chars(vec::from_elem(bits / 2 - 1, '0')) + "1"), (10, match bits { - 32 => ~"8589934593", 16 => ~"131073", _ => fail!() + 32 => ~"8589934593", 16 => ~"131073", _ => fail2!() }), (16, ~"2" + @@ -1759,7 +1759,7 @@ mod biguint_tests { (10, match bits { 32 => ~"55340232229718589441", 16 => ~"12885032961", - _ => fail!() + _ => fail2!() }), (16, ~"3" + str::from_chars(vec::from_elem(bits / 4 - 1, '0')) + "2" + @@ -1814,7 +1814,7 @@ mod biguint_tests { fn check(n: uint, s: &str) { let n = factor(n); let ans = match FromStrRadix::from_str_radix(s, 10) { - Some(x) => x, None => fail!() + Some(x) => x, None => fail2!() }; assert_eq!(n, ans); } diff --git a/src/libextra/num/complex.rs b/src/libextra/num/complex.rs index 669dc1c1b45fa..8943e2ac012df 100644 --- a/src/libextra/num/complex.rs +++ b/src/libextra/num/complex.rs @@ -172,9 +172,9 @@ impl One for Cmplx { impl ToStr for Cmplx { fn to_str(&self) -> ~str { if self.im < Zero::zero() { - fmt!("%s-%si", self.re.to_str(), (-self.im).to_str()) + format!("{}-{}i", self.re.to_str(), (-self.im).to_str()) } else { - fmt!("%s+%si", self.re.to_str(), self.im.to_str()) + format!("{}+{}i", self.re.to_str(), self.im.to_str()) } } } @@ -182,9 +182,9 @@ impl ToStr for Cmplx { impl ToStrRadix for Cmplx { fn to_str_radix(&self, radix: uint) -> ~str { if self.im < Zero::zero() { - fmt!("%s-%si", self.re.to_str_radix(radix), (-self.im).to_str_radix(radix)) + format!("{}-{}i", self.re.to_str_radix(radix), (-self.im).to_str_radix(radix)) } else { - fmt!("%s+%si", self.re.to_str_radix(radix), self.im.to_str_radix(radix)) + format!("{}+{}i", self.re.to_str_radix(radix), self.im.to_str_radix(radix)) } } } diff --git a/src/libextra/num/rational.rs b/src/libextra/num/rational.rs index 1991d9f1b5bbc..e7142f6f9ff24 100644 --- a/src/libextra/num/rational.rs +++ b/src/libextra/num/rational.rs @@ -50,7 +50,7 @@ impl #[inline] pub fn new(numer: T, denom: T) -> Ratio { if denom == Zero::zero() { - fail!("denominator == 0"); + fail2!("denominator == 0"); } let mut ret = Ratio::new_raw(numer, denom); ret.reduce(); @@ -254,13 +254,13 @@ impl Fractional for Ratio { impl ToStr for Ratio { /// Renders as `numer/denom`. fn to_str(&self) -> ~str { - fmt!("%s/%s", self.numer.to_str(), self.denom.to_str()) + format!("{}/{}", self.numer.to_str(), self.denom.to_str()) } } impl ToStrRadix for Ratio { /// Renders as `numer/denom` where the numbers are in base `radix`. fn to_str_radix(&self, radix: uint) -> ~str { - fmt!("%s/%s", self.numer.to_str_radix(radix), self.denom.to_str_radix(radix)) + format!("{}/{}", self.numer.to_str_radix(radix), self.denom.to_str_radix(radix)) } } diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 1e3962914057a..5738faeca956b 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -127,7 +127,7 @@ impl RingBuf { pub fn get<'a>(&'a self, i: uint) -> &'a T { let idx = self.raw_index(i); match self.elts[idx] { - None => fail!(), + None => fail2!(), Some(ref v) => v } } @@ -138,7 +138,7 @@ impl RingBuf { pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T { let idx = self.raw_index(i); match self.elts[idx] { - None => fail!(), + None => fail2!(), Some(ref mut v) => v } } @@ -373,21 +373,21 @@ mod tests { assert_eq!(d.len(), 3u); d.push_back(137); assert_eq!(d.len(), 4u); - debug!(d.front()); + debug2!("{:?}", d.front()); assert_eq!(*d.front().unwrap(), 42); - debug!(d.back()); + debug2!("{:?}", d.back()); assert_eq!(*d.back().unwrap(), 137); let mut i = d.pop_front(); - debug!(i); + debug2!("{:?}", i); assert_eq!(i, Some(42)); i = d.pop_back(); - debug!(i); + debug2!("{:?}", i); assert_eq!(i, Some(137)); i = d.pop_back(); - debug!(i); + debug2!("{:?}", i); assert_eq!(i, Some(137)); i = d.pop_back(); - debug!(i); + debug2!("{:?}", i); assert_eq!(i, Some(17)); assert_eq!(d.len(), 0u); d.push_back(3); @@ -398,10 +398,10 @@ mod tests { assert_eq!(d.len(), 3u); d.push_front(1); assert_eq!(d.len(), 4u); - debug!(d.get(0)); - debug!(d.get(1)); - debug!(d.get(2)); - debug!(d.get(3)); + debug2!("{:?}", d.get(0)); + debug2!("{:?}", d.get(1)); + debug2!("{:?}", d.get(2)); + debug2!("{:?}", d.get(3)); assert_eq!(*d.get(0), 1); assert_eq!(*d.get(1), 2); assert_eq!(*d.get(2), 3); diff --git a/src/libextra/semver.rs b/src/libextra/semver.rs index 1644efb807046..fff10533af185 100644 --- a/src/libextra/semver.rs +++ b/src/libextra/semver.rs @@ -86,16 +86,16 @@ pub struct Version { impl ToStr for Version { #[inline] fn to_str(&self) -> ~str { - let s = fmt!("%u.%u.%u", self.major, self.minor, self.patch); + let s = format!("{}.{}.{}", self.major, self.minor, self.patch); let s = if self.pre.is_empty() { s } else { - fmt!("%s-%s", s, self.pre.map(|i| i.to_str()).connect(".")) + format!("{}-{}", s, self.pre.map(|i| i.to_str()).connect(".")) }; if self.build.is_empty() { s } else { - fmt!("%s+%s", s, self.build.map(|i| i.to_str()).connect(".")) + format!("{}+{}", s, self.build.map(|i| i.to_str()).connect(".")) } } } @@ -158,7 +158,7 @@ fn take_nonempty_prefix(rdr: @io::Reader, if buf.is_empty() { bad_parse::cond.raise(()) } - debug!("extracted nonempty prefix: %s", buf); + debug2!("extracted nonempty prefix: {}", buf); (buf, ch) } @@ -234,7 +234,7 @@ pub fn parse(s: &str) -> Option { } let s = s.trim(); let mut bad = false; - do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).inside { + do bad_parse::cond.trap(|_| { debug2!("bad"); bad = true }).inside { do io::with_str_reader(s) |rdr| { let v = parse_reader(rdr); if bad || v.to_str() != s.to_owned() { diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index 983247971d30d..2108415f468ff 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -265,7 +265,7 @@ mod test_map { assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { - None => fail!(), Some(x) => *x = new + None => fail2!(), Some(x) => *x = new } assert_eq!(m.find(&5), Some(&new)); } diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs index bab889ff9245a..5293a2c3fd7ce 100644 --- a/src/libextra/sort.rs +++ b/src/libextra/sort.rs @@ -564,7 +564,7 @@ impl MergeState { shift_vec(array, dest, c2, len2); swap(&mut array[dest+len2], &mut tmp[c1]); } else if len1 == 0 { - fail!("Comparison violates its contract!"); + fail2!("Comparison violates its contract!"); } else { assert_eq!(len2, 0); assert!(len1 > 1); @@ -683,7 +683,7 @@ impl MergeState { shift_vec(array, dest+1, c1+1, len1); swap(&mut array[dest], &mut tmp[c2]); } else if len2 == 0 { - fail!("Comparison violates its contract!"); + fail2!("Comparison violates its contract!"); } else { assert_eq!(len1, 0); assert!(len2 != 0); @@ -790,7 +790,7 @@ mod test_qsort { quick_sort::(v1, leual); let mut i = 0u; while i < len { - // debug!(v2[i]); + // debug2!(v2[i]); assert_eq!(v2[i], v1[i]); i += 1; } @@ -833,7 +833,7 @@ mod test_qsort { let immut_names = names; for (&a, &b) in expected.iter().zip(immut_names.iter()) { - debug!("%d %d", a, b); + debug2!("{} {}", a, b); assert_eq!(a, b); } } @@ -851,7 +851,7 @@ mod tests { let v3 = merge_sort::(v1, f); let mut i = 0u; while i < len { - debug!(v3[i]); + debug2!("{:?}", v3[i]); assert_eq!(v3[i], v2[i]); i += 1; } @@ -922,7 +922,7 @@ mod test_tim_sort { fn lt(&self, other: &CVal) -> bool { let mut rng = rand::rng(); if rng.gen::() > 0.995 { - fail!("It's happening!!!"); + fail2!("It's happening!!!"); } (*self).val < other.val } @@ -936,7 +936,7 @@ mod test_tim_sort { tim_sort::(v1); let mut i = 0u; while i < len { - // debug!(v2[i]); + // debug2!(v2[i]); assert_eq!(v2[i], v1[i]); i += 1u; } @@ -977,7 +977,7 @@ mod test_tim_sort { }; tim_sort(arr); - fail!("Guarantee the fail"); + fail2!("Guarantee the fail"); } #[deriving(Clone)] @@ -1045,7 +1045,7 @@ mod big_tests { fn isSorted(arr: &[T]) { for i in range(0u, arr.len() - 1) { if arr[i] > arr[i+1] { - fail!("Array not sorted"); + fail2!("Array not sorted"); } } } @@ -1116,7 +1116,7 @@ mod big_tests { fn isSorted(arr: &[@T]) { for i in range(0u, arr.len() - 1) { if arr[i] > arr[i+1] { - fail!("Array not sorted"); + fail2!("Array not sorted"); } } } diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index 2b6c53b3c8615..64c4a4a03fd56 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -267,12 +267,12 @@ pub fn winsorize(samples: &mut [f64], pct: f64) { /// Render writes the min, max and quartiles of the provided `Summary` to the provided `Writer`. pub fn write_5_number_summary(w: @io::Writer, s: &Summary) { let (q1,q2,q3) = s.quartiles; - w.write_str(fmt!("(min=%f, q1=%f, med=%f, q3=%f, max=%f)", - s.min as float, - q1 as float, - q2 as float, - q3 as float, - s.max as float)); + w.write_str(format!("(min={}, q1={}, med={}, q3={}, max={})", + s.min, + q1, + q2, + q3, + s.max)); } /// Render a boxplot to the provided writer. The boxplot shows the min, max and quartiles of the diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs index 31ae5e70a9942..75060166f8c0a 100644 --- a/src/libextra/sync.rs +++ b/src/libextra/sync.rs @@ -307,9 +307,9 @@ fn check_cvar_bounds(out_of_bounds: Option, id: uint, act: &str, blk: &fn() -> U) -> U { match out_of_bounds { Some(0) => - fail!("%s with illegal ID %u - this lock has no condvars!", act, id), + fail2!("{} with illegal ID {} - this lock has no condvars!", act, id), Some(length) => - fail!("%s with illegal ID %u - ID must be less than %u", act, id, length), + fail2!("{} with illegal ID {} - ID must be less than {}", act, id, length), None => blk() } } @@ -634,7 +634,7 @@ impl RWLock { pub fn downgrade<'a>(&self, token: RWLockWriteMode<'a>) -> RWLockReadMode<'a> { if !borrow::ref_eq(self, token.lock) { - fail!("Can't downgrade() with a different rwlock's write_mode!"); + fail2!("Can't downgrade() with a different rwlock's write_mode!"); } unsafe { do task::unkillable { @@ -918,7 +918,7 @@ mod tests { let result: result::Result<(),()> = do task::try { do m2.lock { - fail!(); + fail2!(); } }; assert!(result.is_err()); @@ -938,7 +938,7 @@ mod tests { do task::spawn || { // linked let _ = p.recv(); // wait for sibling to get in the mutex task::deschedule(); - fail!(); + fail2!(); } do m2.lock_cond |cond| { c.send(()); // tell sibling go ahead @@ -976,9 +976,9 @@ mod tests { do (|| { cond.wait(); // block forever }).finally { - error!("task unwinding and sending"); + error2!("task unwinding and sending"); c.send(()); - error!("task unwinding and done sending"); + error2!("task unwinding and done sending"); } } } @@ -988,7 +988,7 @@ mod tests { } do m2.lock { } c.send(sibling_convos); // let parent wait on all children - fail!(); + fail2!(); }; assert!(result.is_err()); // child task must have finished by the time try returns @@ -1028,7 +1028,7 @@ mod tests { let _ = p.recv(); do m.lock_cond |cond| { if !cond.signal_on(0) { - fail!(); // success; punt sibling awake. + fail2!(); // success; punt sibling awake. } } }; @@ -1272,7 +1272,7 @@ mod tests { let result: result::Result<(),()> = do task::try || { do lock_rwlock_in_mode(&x2, mode1) { - fail!(); + fail2!(); } }; assert!(result.is_err()); @@ -1319,7 +1319,7 @@ mod tests { let mut xopt = Some(xwrite); do y.write_downgrade |_ywrite| { y.downgrade(xopt.take_unwrap()); - error!("oops, y.downgrade(x) should have failed!"); + error2!("oops, y.downgrade(x) should have failed!"); } } } diff --git a/src/libextra/term.rs b/src/libextra/term.rs index d8eb3cfa50000..c7f2650790243 100644 --- a/src/libextra/term.rs +++ b/src/libextra/term.rs @@ -147,7 +147,7 @@ impl Terminal { self.out.write(s.unwrap()); return true } else { - warn!("%s", s.unwrap_err()); + warn2!("{}", s.unwrap_err()); } } false @@ -167,7 +167,7 @@ impl Terminal { self.out.write(s.unwrap()); return true } else { - warn!("%s", s.unwrap_err()); + warn2!("{}", s.unwrap_err()); } } false @@ -188,7 +188,7 @@ impl Terminal { self.out.write(s.unwrap()); return true } else { - warn!("%s", s.unwrap_err()); + warn2!("{}", s.unwrap_err()); } } false @@ -226,11 +226,11 @@ impl Terminal { if s.is_ok() { self.out.write(s.unwrap()); } else if self.num_colors > 0 { - warn!("%s", s.unwrap_err()); + warn2!("{}", s.unwrap_err()); } else { - // if we support attributes but not color, it would be nice to still warn!() + // if we support attributes but not color, it would be nice to still warn2!() // but it's not worth testing all known attributes just for this. - debug!("%s", s.unwrap_err()); + debug2!("{}", s.unwrap_err()); } } diff --git a/src/libextra/terminfo/parm.rs b/src/libextra/terminfo/parm.rs index 8c1595e7920c4..81c4b35d8d0d9 100644 --- a/src/libextra/terminfo/parm.rs +++ b/src/libextra/terminfo/parm.rs @@ -278,7 +278,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) 'e' => state = SeekIfEnd(0), ';' => (), - _ => return Err(fmt!("unrecognized format option %c", cur)) + _ => return Err(format!("unrecognized format option {}", cur)) } }, PushParam => { @@ -461,7 +461,7 @@ impl FormatOp { 'x' => FormatHex, 'X' => FormatHEX, 's' => FormatString, - _ => fail!("bad FormatOp char") + _ => fail2!("bad FormatOp char") } } fn to_char(self) -> char { @@ -551,7 +551,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> { s } _ => { - return Err(fmt!("non-string on stack with %%%c", op.to_char())) + return Err(format!("non-string on stack with %{}", op.to_char())) } } } @@ -606,23 +606,23 @@ mod test { for cap in caps.iter() { let res = expand(cap.as_bytes(), [], vars); assert!(res.is_err(), - "Op %s succeeded incorrectly with 0 stack entries", *cap); + "Op {} succeeded incorrectly with 0 stack entries", *cap); let p = if *cap == "%s" || *cap == "%l" { String(~"foo") } else { Number(97) }; let res = expand((bytes!("%p1")).to_owned() + cap.as_bytes(), [p], vars); assert!(res.is_ok(), - "Op %s failed with 1 stack entry: %s", *cap, res.unwrap_err()); + "Op {} failed with 1 stack entry: {}", *cap, res.unwrap_err()); } let caps = ["%+", "%-", "%*", "%/", "%m", "%&", "%|", "%A", "%O"]; for cap in caps.iter() { let res = expand(cap.as_bytes(), [], vars); assert!(res.is_err(), - "Binop %s succeeded incorrectly with 0 stack entries", *cap); + "Binop {} succeeded incorrectly with 0 stack entries", *cap); let res = expand((bytes!("%{1}")).to_owned() + cap.as_bytes(), [], vars); assert!(res.is_err(), - "Binop %s succeeded incorrectly with 1 stack entry", *cap); + "Binop {} succeeded incorrectly with 1 stack entry", *cap); let res = expand((bytes!("%{1}%{2}")).to_owned() + cap.as_bytes(), [], vars); assert!(res.is_ok(), - "Binop %s failed with 2 stack entries: %s", *cap, res.unwrap_err()); + "Binop {} failed with 2 stack entries: {}", *cap, res.unwrap_err()); } } @@ -635,15 +635,15 @@ mod test { fn test_comparison_ops() { let v = [('<', [1u8, 0u8, 0u8]), ('=', [0u8, 1u8, 0u8]), ('>', [0u8, 0u8, 1u8])]; for &(op, bs) in v.iter() { - let s = fmt!("%%{1}%%{2}%%%c%%d", op); + let s = format!("%\\{1\\}%\\{2\\}%{}%d", op); let res = expand(s.as_bytes(), [], &mut Variables::new()); assert!(res.is_ok(), res.unwrap_err()); assert_eq!(res.unwrap(), ~['0' as u8 + bs[0]]); - let s = fmt!("%%{1}%%{1}%%%c%%d", op); + let s = format!("%\\{1\\}%\\{1\\}%{}%d", op); let res = expand(s.as_bytes(), [], &mut Variables::new()); assert!(res.is_ok(), res.unwrap_err()); assert_eq!(res.unwrap(), ~['0' as u8 + bs[1]]); - let s = fmt!("%%{2}%%{1}%%%c%%d", op); + let s = format!("%\\{2\\}%\\{1\\}%{}%d", op); let res = expand(s.as_bytes(), [], &mut Variables::new()); assert!(res.is_ok(), res.unwrap_err()); assert_eq!(res.unwrap(), ~['0' as u8 + bs[2]]); diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 49a6210e3a9e2..caef3e70ce80a 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -178,7 +178,8 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { // Check magic number let magic = file.read_le_u16(); if (magic != 0x011A) { - return Err(fmt!("invalid magic number: expected %x but found %x", 0x011A, magic as uint)); + return Err(format!("invalid magic number: expected {:x} but found {:x}", + 0x011A, magic as uint)); } let names_bytes = file.read_le_i16() as int; @@ -189,26 +190,26 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { assert!(names_bytes > 0); - debug!("names_bytes = %?", names_bytes); - debug!("bools_bytes = %?", bools_bytes); - debug!("numbers_count = %?", numbers_count); - debug!("string_offsets_count = %?", string_offsets_count); - debug!("string_table_bytes = %?", string_table_bytes); + debug2!("names_bytes = {}", names_bytes); + debug2!("bools_bytes = {}", bools_bytes); + debug2!("numbers_count = {}", numbers_count); + debug2!("string_offsets_count = {}", string_offsets_count); + debug2!("string_table_bytes = {}", string_table_bytes); if (bools_bytes as uint) > boolnames.len() { - error!("expected bools_bytes to be less than %? but found %?", boolnames.len(), + error2!("expected bools_bytes to be less than {} but found {}", boolnames.len(), bools_bytes); return Err(~"incompatible file: more booleans than expected"); } if (numbers_count as uint) > numnames.len() { - error!("expected numbers_count to be less than %? but found %?", numnames.len(), + error2!("expected numbers_count to be less than {} but found {}", numnames.len(), numbers_count); return Err(~"incompatible file: more numbers than expected"); } if (string_offsets_count as uint) > stringnames.len() { - error!("expected string_offsets_count to be less than %? but found %?", stringnames.len(), + error2!("expected string_offsets_count to be less than {} but found {}", stringnames.len(), string_offsets_count); return Err(~"incompatible file: more string offsets than expected"); } @@ -218,26 +219,26 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { file.read_byte(); // consume NUL - debug!("term names: %?", term_names); + debug2!("term names: {:?}", term_names); let mut bools_map = HashMap::new(); if bools_bytes != 0 { for i in range(0, bools_bytes) { let b = file.read_byte(); if b < 0 { - error!("EOF reading bools after %? entries", i); + error2!("EOF reading bools after {} entries", i); return Err(~"error: expected more bools but hit EOF"); } else if b == 1 { - debug!("%s set", bnames[i]); + debug2!("{} set", bnames[i]); bools_map.insert(bnames[i].to_owned(), true); } } } - debug!("bools: %?", bools_map); + debug2!("bools: {:?}", bools_map); if (bools_bytes + names_bytes) % 2 == 1 { - debug!("adjusting for padding between bools and numbers"); + debug2!("adjusting for padding between bools and numbers"); file.read_byte(); // compensate for padding } @@ -246,13 +247,13 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { for i in range(0, numbers_count) { let n = file.read_le_u16(); if n != 0xFFFF { - debug!("%s#%?", nnames[i], n); + debug2!("{}\\#{}", nnames[i], n); numbers_map.insert(nnames[i].to_owned(), n); } } } - debug!("numbers: %?", numbers_map); + debug2!("numbers: {:?}", numbers_map); let mut string_map = HashMap::new(); @@ -262,12 +263,12 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { string_offsets.push(file.read_le_u16()); } - debug!("offsets: %?", string_offsets); + debug2!("offsets: {:?}", string_offsets); let string_table = file.read_bytes(string_table_bytes as uint); if string_table.len() != string_table_bytes as uint { - error!("EOF reading string table after %? bytes, wanted %?", string_table.len(), + error2!("EOF reading string table after {} bytes, wanted {}", string_table.len(), string_table_bytes); return Err(~"error: hit EOF before end of string table"); } diff --git a/src/libextra/terminfo/searcher.rs b/src/libextra/terminfo/searcher.rs index f7999050804c5..5c7efdb298f27 100644 --- a/src/libextra/terminfo/searcher.rs +++ b/src/libextra/terminfo/searcher.rs @@ -60,7 +60,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> { return Some(newp); } // on some installations the dir is named after the hex of the char (e.g. OS X) - let newp = ~p.push_many(&[fmt!("%x", first_char as uint), term.to_owned()]); + let newp = ~p.push_many(&[format!("{:x}", first_char as uint), term.to_owned()]); if os::path_exists(p) && os::path_exists(newp) { return Some(newp); } @@ -72,7 +72,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> { pub fn open(term: &str) -> Result<@Reader, ~str> { match get_dbpath_for_term(term) { Some(x) => file_reader(x), - None => Err(fmt!("could not find terminfo entry for %s", term)) + None => Err(format!("could not find terminfo entry for {}", term)) } } diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 4721a6b412264..1370a0690ca17 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -125,10 +125,10 @@ pub fn test_main(args: &[~str], tests: ~[TestDescAndFn]) { let opts = match parse_opts(args) { Some(Ok(o)) => o, - Some(Err(msg)) => fail!(msg), + Some(Err(msg)) => fail2!(msg), None => return }; - if !run_tests_console(&opts, tests) { fail!("Some tests failed"); } + if !run_tests_console(&opts, tests) { fail2!("Some tests failed"); } } // A variant optimized for invocation with a static test vector. @@ -148,7 +148,7 @@ pub fn test_main_static(args: &[~str], tests: &[TestDescAndFn]) { TestDescAndFn { testfn: StaticBenchFn(f), desc: t.desc.clone() }, _ => { - fail!("non-static tests passed to test::test_main_static"); + fail2!("non-static tests passed to test::test_main_static"); } } }; @@ -192,7 +192,7 @@ fn optgroups() -> ~[getopts::groups::OptGroup] { fn usage(binary: &str, helpstr: &str) { #[fixed_stack_segment]; #[inline(never)]; - let message = fmt!("Usage: %s [OPTIONS] [FILTER]", binary); + let message = format!("Usage: {} [OPTIONS] [FILTER]", binary); println(groups::usage(message, optgroups())); println(""); if helpstr == "help" { @@ -210,7 +210,7 @@ Test Attributes: #[bench] - Indicates a function is a benchmark to be run. This function takes one argument (extra::test::BenchHarness). #[should_fail] - This function (also labeled with #[test]) will only pass if - the code causes a failure (an assertion failure or fail!) + the code causes a failure (an assertion failure or fail2!) #[ignore] - When applied to a function which is already attributed as a test, then the test runner will ignore these tests during normal test runs. Running with --ignored will run these @@ -327,7 +327,7 @@ impl ConsoleTestState { io::Truncate]) { result::Ok(w) => Some(w), result::Err(ref s) => { - fail!("can't open output file: %s", *s) + fail2!("can't open output file: {}", *s) } }, None => None @@ -408,11 +408,11 @@ impl ConsoleTestState { pub fn write_run_start(&mut self, len: uint) { self.total = len; let noun = if len != 1 { &"tests" } else { &"test" }; - self.out.write_line(fmt!("\nrunning %u %s", len, noun)); + self.out.write_line(format!("\nrunning {} {}", len, noun)); } pub fn write_test_start(&self, test: &TestDesc) { - self.out.write_str(fmt!("test %s ... ", test.name.to_str())); + self.out.write_str(format!("test {} ... ", test.name.to_str())); } pub fn write_result(&self, result: &TestResult) { @@ -436,7 +436,7 @@ impl ConsoleTestState { match self.log_out { None => (), Some(out) => { - out.write_line(fmt!("%s %s", + out.write_line(format!("{} {}", match *result { TrOk => ~"ok", TrFailed => ~"failed", @@ -456,7 +456,7 @@ impl ConsoleTestState { } sort::tim_sort(failures); for name in failures.iter() { - self.out.write_line(fmt!(" %s", name.to_str())); + self.out.write_line(format!(" {}", name.to_str())); } } @@ -473,31 +473,31 @@ impl ConsoleTestState { MetricAdded => { added += 1; self.write_added(); - self.out.write_line(fmt!(": %s", *k)); + self.out.write_line(format!(": {}", *k)); } MetricRemoved => { removed += 1; self.write_removed(); - self.out.write_line(fmt!(": %s", *k)); + self.out.write_line(format!(": {}", *k)); } Improvement(pct) => { improved += 1; self.out.write_str(*k); self.out.write_str(": "); self.write_improved(); - self.out.write_line(fmt!(" by %.2f%%", pct as float)) + self.out.write_line(format!(" by {:.2f}%", pct as float)) } Regression(pct) => { regressed += 1; self.out.write_str(*k); self.out.write_str(": "); self.write_regressed(); - self.out.write_line(fmt!(" by %.2f%%", pct as float)) + self.out.write_line(format!(" by {:.2f}%", pct as float)) } } } - self.out.write_line(fmt!("result of ratchet: %u matrics added, %u removed, \ - %u improved, %u regressed, %u noise", + self.out.write_line(format!("result of ratchet: {} matrics added, {} removed, \ + {} improved, {} regressed, {} noise", added, removed, improved, regressed, noise)); if regressed == 0 { self.out.write_line("updated ratchet file") @@ -514,11 +514,11 @@ impl ConsoleTestState { let ratchet_success = match *ratchet_metrics { None => true, Some(ref pth) => { - self.out.write_str(fmt!("\nusing metrics ratchet: %s\n", pth.to_str())); + self.out.write_str(format!("\nusing metrics ratchet: {}\n", pth.to_str())); match ratchet_pct { None => (), Some(pct) => - self.out.write_str(fmt!("with noise-tolerance forced to: %f%%\n", + self.out.write_str(format!("with noise-tolerance forced to: {}%%\n", pct as float)) } let (diff, ok) = self.metrics.ratchet(pth, ratchet_pct); @@ -541,7 +541,7 @@ impl ConsoleTestState { } else { self.write_failed(); } - self.out.write_str(fmt!(". %u passed; %u failed; %u ignored; %u measured\n\n", + self.out.write_str(format!(". {} passed; {} failed; {} ignored; {} measured\n\n", self.passed, self.failed, self.ignored, self.measured)); return success; } @@ -549,7 +549,7 @@ impl ConsoleTestState { pub fn fmt_metrics(mm: &MetricMap) -> ~str { let v : ~[~str] = mm.iter() - .map(|(k,v)| fmt!("%s: %f (+/- %f)", + .map(|(k,v)| format!("{}: {} (+/- {})", *k, v.value as float, v.noise as float)) @@ -559,12 +559,12 @@ pub fn fmt_metrics(mm: &MetricMap) -> ~str { pub fn fmt_bench_samples(bs: &BenchSamples) -> ~str { if bs.mb_s != 0 { - fmt!("%u ns/iter (+/- %u) = %u MB/s", + format!("{} ns/iter (+/- {}) = {} MB/s", bs.ns_iter_summ.median as uint, (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as uint, bs.mb_s) } else { - fmt!("%u ns/iter (+/- %u)", + format!("{} ns/iter (+/- {})", bs.ns_iter_summ.median as uint, (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as uint) } @@ -574,7 +574,7 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> ~str { pub fn run_tests_console(opts: &TestOpts, tests: ~[TestDescAndFn]) -> bool { fn callback(event: &TestEvent, st: &mut ConsoleTestState) { - debug!("callback(event=%?)", event); + debug2!("callback(event={:?})", event); match (*event).clone() { TeFiltered(ref filtered_tests) => st.write_run_start(filtered_tests.len()), TeWait(ref test) => st.write_test_start(test), @@ -612,7 +612,7 @@ pub fn run_tests_console(opts: &TestOpts, None => (), Some(ref pth) => { st.metrics.save(pth); - st.out.write_str(fmt!("\nmetrics saved to: %s", pth.to_str())); + st.out.write_str(format!("\nmetrics saved to: {}", pth.to_str())); } } return st.write_run_finish(&opts.ratchet_metrics, opts.ratchet_noise_percent); @@ -688,7 +688,7 @@ fn run_tests(opts: &TestOpts, // It's tempting to just spawn all the tests at once, but since we have // many tests that run in other processes we would be making a big mess. let concurrency = get_concurrency(); - debug!("using %u test tasks", concurrency); + debug2!("using {} test tasks", concurrency); let mut remaining = filtered_tests; remaining.reverse(); @@ -735,7 +735,7 @@ fn get_concurrency() -> uint { let opt_n: Option = FromStr::from_str(s); match opt_n { Some(n) if n > 0 => n, - _ => fail!("RUST_TEST_TASKS is `%s`, should be a positive integer.", s) + _ => fail2!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s) } } None => { @@ -1001,7 +1001,7 @@ impl MetricMap { }; if ok { - debug!("rewriting file '%s' with updated metrics"); + debug2!("rewriting file '{:?}' with updated metrics", p); self.save(p); } return (diff, ok) @@ -1040,7 +1040,7 @@ impl BenchHarness { pub fn bench_n(&mut self, n: u64, f: &fn(&mut BenchHarness)) { self.iterations = n; - debug!("running benchmark for %u iterations", + debug2!("running benchmark for {} iterations", n as uint); f(self); } @@ -1081,7 +1081,7 @@ impl BenchHarness { stats::winsorize(samples, 5.0); let summ5 = stats::Summary::new(samples); - debug!("%u samples, median %f, MAD=%f, MADP=%f", + debug2!("{} samples, median {}, MAD={}, MADP={}", samples.len(), summ.median as float, summ.median_abs_dev as float, @@ -1153,7 +1153,7 @@ mod tests { #[test] pub fn do_not_run_ignored_tests() { - fn f() { fail!(); } + fn f() { fail2!(); } let desc = TestDescAndFn { desc: TestDesc { name: StaticTestName("whatever"), @@ -1189,7 +1189,7 @@ mod tests { #[test] fn test_should_fail() { - fn f() { fail!(); } + fn f() { fail2!(); } let desc = TestDescAndFn { desc: TestDesc { name: StaticTestName("whatever"), @@ -1228,7 +1228,7 @@ mod tests { let args = ~[~"progname", ~"filter"]; let opts = match parse_opts(args) { Some(Ok(o)) => o, - _ => fail!("Malformed arg in first_free_arg_should_be_a_filter") + _ => fail2!("Malformed arg in first_free_arg_should_be_a_filter") }; assert!("filter" == opts.filter.clone().unwrap()); } @@ -1238,7 +1238,7 @@ mod tests { let args = ~[~"progname", ~"filter", ~"--ignored"]; let opts = match parse_opts(args) { Some(Ok(o)) => o, - _ => fail!("Malformed arg in parse_ignored_flag") + _ => fail2!("Malformed arg in parse_ignored_flag") }; assert!((opts.run_ignored)); } diff --git a/src/libextra/time.rs b/src/libextra/time.rs index d51d1c2178571..7f08fcd908aea 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -259,7 +259,7 @@ impl Tm { let mut m = num::abs(self.tm_gmtoff) / 60_i32; let h = m / 60_i32; m -= h * 60_i32; - s + fmt!("%c%02d:%02d", sign, h as int, m as int) + s + format!("{}{:02d}:{:02d}", sign, h as int, m as int) } } } @@ -364,7 +364,7 @@ fn do_strptime(s: &str, format: &str) -> Result { if c == range.ch { Ok(range.next) } else { - Err(fmt!("Expected %?, found %?", + Err(format!("Expected {}, found {}", str::from_char(c), str::from_char(range.ch))) } @@ -671,7 +671,7 @@ fn do_strptime(s: &str, format: &str) -> Result { } '%' => parse_char(s, pos, '%'), ch => { - Err(fmt!("unknown formatting type: %?", str::from_char(ch))) + Err(format!("unknown formatting type: {}", str::from_char(ch))) } } } @@ -736,7 +736,7 @@ fn do_strptime(s: &str, format: &str) -> Result { fn do_strftime(format: &str, tm: &Tm) -> ~str { fn parse_type(ch: char, tm: &Tm) -> ~str { //FIXME (#2350): Implement missing types. - let die = || fmt!("strftime: can't understand this format %c ", ch); + let die = || format!("strftime: can't understand this format {} ", ch); match ch { 'A' => match tm.tm_wday as int { 0 => ~"Sunday", @@ -788,9 +788,9 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str { 11 => ~"Dec", _ => die() }, - 'C' => fmt!("%02d", (tm.tm_year as int + 1900) / 100), + 'C' => format!("{:02d}", (tm.tm_year as int + 1900) / 100), 'c' => { - fmt!("%s %s %s %s %s", + format!("{} {} {} {} {}", parse_type('a', tm), parse_type('b', tm), parse_type('e', tm), @@ -798,58 +798,58 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str { parse_type('Y', tm)) } 'D' | 'x' => { - fmt!("%s/%s/%s", + format!("{}/{}/{}", parse_type('m', tm), parse_type('d', tm), parse_type('y', tm)) } - 'd' => fmt!("%02d", tm.tm_mday as int), - 'e' => fmt!("%2d", tm.tm_mday as int), - 'f' => fmt!("%09d", tm.tm_nsec as int), + 'd' => format!("{:02d}", tm.tm_mday), + 'e' => format!("{:2d}", tm.tm_mday), + 'f' => format!("{:09d}", tm.tm_nsec), 'F' => { - fmt!("%s-%s-%s", + format!("{}-{}-{}", parse_type('Y', tm), parse_type('m', tm), parse_type('d', tm)) } //'G' {} //'g' {} - 'H' => fmt!("%02d", tm.tm_hour as int), + 'H' => format!("{:02d}", tm.tm_hour), 'I' => { - let mut h = tm.tm_hour as int; + let mut h = tm.tm_hour; if h == 0 { h = 12 } if h > 12 { h -= 12 } - fmt!("%02d", h) + format!("{:02d}", h) } - 'j' => fmt!("%03d", tm.tm_yday as int + 1), - 'k' => fmt!("%2d", tm.tm_hour as int), + 'j' => format!("{:03d}", tm.tm_yday + 1), + 'k' => format!("{:2d}", tm.tm_hour), 'l' => { - let mut h = tm.tm_hour as int; + let mut h = tm.tm_hour; if h == 0 { h = 12 } if h > 12 { h -= 12 } - fmt!("%2d", h) + format!("{:2d}", h) } - 'M' => fmt!("%02d", tm.tm_min as int), - 'm' => fmt!("%02d", tm.tm_mon as int + 1), + 'M' => format!("{:02d}", tm.tm_min), + 'm' => format!("{:02d}", tm.tm_mon + 1), 'n' => ~"\n", 'P' => if (tm.tm_hour as int) < 12 { ~"am" } else { ~"pm" }, 'p' => if (tm.tm_hour as int) < 12 { ~"AM" } else { ~"PM" }, 'R' => { - fmt!("%s:%s", + format!("{}:{}", parse_type('H', tm), parse_type('M', tm)) } 'r' => { - fmt!("%s:%s:%s %s", + format!("{}:{}:{} {}", parse_type('I', tm), parse_type('M', tm), parse_type('S', tm), parse_type('p', tm)) } - 'S' => fmt!("%02d", tm.tm_sec as int), - 's' => fmt!("%d", tm.to_timespec().sec as int), + 'S' => format!("{:02d}", tm.tm_sec), + 's' => format!("{}", tm.to_timespec().sec), 'T' | 'X' => { - fmt!("%s:%s:%s", + format!("{}:{}:{}", parse_type('H', tm), parse_type('M', tm), parse_type('S', tm)) @@ -862,7 +862,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str { } //'V' {} 'v' => { - fmt!("%s-%s-%s", + format!("{}-{}-{}", parse_type('e', tm), parse_type('b', tm), parse_type('Y', tm)) @@ -872,14 +872,14 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str { //'X' {} //'x' {} 'Y' => (tm.tm_year as int + 1900).to_str(), - 'y' => fmt!("%02d", (tm.tm_year as int + 1900) % 100), + 'y' => format!("{:02d}", (tm.tm_year as int + 1900) % 100), 'Z' => tm.tm_zone.clone(), 'z' => { let sign = if tm.tm_gmtoff > 0_i32 { '+' } else { '-' }; let mut m = num::abs(tm.tm_gmtoff) / 60_i32; let h = m / 60_i32; m -= h * 60_i32; - fmt!("%c%02d%02d", sign, h as int, m as int) + format!("{}{:02d}{:02d}", sign, h, m) } //'+' {} '%' => ~"%", @@ -914,13 +914,13 @@ mod tests { static SOME_FUTURE_DATE: i64 = 1577836800i64; // 2020-01-01T00:00:00Z let tv1 = get_time(); - debug!("tv1=%? sec + %? nsec", tv1.sec as uint, tv1.nsec as uint); + debug2!("tv1={:?} sec + {:?} nsec", tv1.sec as uint, tv1.nsec as uint); assert!(tv1.sec > SOME_RECENT_DATE); assert!(tv1.nsec < 1000000000i32); let tv2 = get_time(); - debug!("tv2=%? sec + %? nsec", tv2.sec as uint, tv2.nsec as uint); + debug2!("tv2={:?} sec + {:?} nsec", tv2.sec as uint, tv2.nsec as uint); assert!(tv2.sec >= tv1.sec); assert!(tv2.sec < SOME_FUTURE_DATE); @@ -934,16 +934,16 @@ mod tests { let s0 = precise_time_s(); let ns1 = precise_time_ns(); - debug!("s0=%s sec", float::to_str_digits(s0, 9u)); + debug2!("s0={} sec", float::to_str_digits(s0, 9u)); assert!(s0 > 0.); let ns0 = (s0 * 1000000000.) as u64; - debug!("ns0=%? ns", ns0); + debug2!("ns0={:?} ns", ns0); - debug!("ns1=%? ns", ns0); + debug2!("ns1={:?} ns", ns0); assert!(ns1 >= ns0); let ns2 = precise_time_ns(); - debug!("ns2=%? ns", ns0); + debug2!("ns2={:?} ns", ns0); assert!(ns2 >= ns1); } @@ -975,7 +975,7 @@ mod tests { let time = Timespec::new(1234567890, 54321); let local = at(time); - error!("time_at: %?", local); + error2!("time_at: {:?}", local); assert!(local.tm_sec == 30_i32); assert!(local.tm_min == 31_i32); @@ -1050,7 +1050,7 @@ mod tests { == Err(~"Invalid time")); match strptime("Fri Feb 13 15:31:30.01234 2009", format) { - Err(e) => fail!(e), + Err(e) => fail2!(e), Ok(ref tm) => { assert!(tm.tm_sec == 30_i32); assert!(tm.tm_min == 31_i32); @@ -1070,7 +1070,7 @@ mod tests { fn test(s: &str, format: &str) -> bool { match strptime(s, format) { Ok(ref tm) => tm.strftime(format) == s.to_owned(), - Err(e) => fail!(e) + Err(e) => fail2!(e) } } @@ -1196,7 +1196,7 @@ mod tests { let utc = at_utc(time); let local = at(time); - error!("test_ctime: %? %?", utc.ctime(), local.ctime()); + error2!("test_ctime: {:?} {:?}", utc.ctime(), local.ctime()); assert_eq!(utc.ctime(), ~"Fri Feb 13 23:31:30 2009"); assert_eq!(local.ctime(), ~"Fri Feb 13 15:31:30 2009"); diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 8ddc0413aa3c7..ee7ba4a888b86 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -831,7 +831,7 @@ fn remove(node: &mut Option<~TreeNode>, } } return match node.take() { - Some(~TreeNode{value, _}) => Some(value), None => fail!() + Some(~TreeNode{value, _}) => Some(value), None => fail2!() }; } @@ -900,7 +900,7 @@ mod test_treemap { assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { - None => fail!(), Some(x) => *x = new + None => fail2!(), Some(x) => *x = new } assert_eq!(m.find(&5), Some(&new)); } diff --git a/src/libextra/url.rs b/src/libextra/url.rs index 451b410833f0f..7a10c0439daf4 100644 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@ -93,10 +93,10 @@ fn encode_inner(s: &str, full_url: bool) -> ~str { out.push_char(ch); } - _ => out.push_str(fmt!("%%%X", ch as uint)) + _ => out.push_str(format!("%{:X}", ch as uint)) } } else { - out.push_str(fmt!("%%%X", ch as uint)); + out.push_str(format!("%{:X}", ch as uint)); } } } @@ -192,7 +192,7 @@ fn encode_plus(s: &str) -> ~str { out.push_char(ch); } ' ' => out.push_char('+'), - _ => out.push_str(fmt!("%%%X", ch as uint)) + _ => out.push_str(format!("%{:X}", ch as uint)) } } @@ -218,7 +218,7 @@ pub fn encode_form_urlencoded(m: &HashMap<~str, ~[~str]>) -> ~str { first = false; } - out.push_str(fmt!("%s=%s", key, encode_plus(*value))); + out.push_str(format!("{}={}", key, encode_plus(*value))); } } @@ -324,8 +324,8 @@ fn userinfo_from_str(uinfo: &str) -> UserInfo { fn userinfo_to_str(userinfo: &UserInfo) -> ~str { match userinfo.pass { - Some(ref pass) => fmt!("%s:%s@", userinfo.user, *pass), - None => fmt!("%s@", userinfo.user), + Some(ref pass) => format!("{}:{}@", userinfo.user, *pass), + None => format!("{}@", userinfo.user), } } @@ -345,7 +345,7 @@ pub fn query_to_str(query: &Query) -> ~str { for kv in query.iter() { match kv { &(ref k, ref v) => { - strvec.push(fmt!("%s=%s", + strvec.push(format!("{}={}", encode_component(*k), encode_component(*v)) ); @@ -673,21 +673,21 @@ pub fn to_str(url: &Url) -> ~str { let authority = if url.host.is_empty() { ~"" } else { - fmt!("//%s%s", user, url.host) + format!("//{}{}", user, url.host) }; let query = if url.query.is_empty() { ~"" } else { - fmt!("?%s", query_to_str(&url.query)) + format!("?{}", query_to_str(&url.query)) }; let fragment = match url.fragment { - Some(ref fragment) => fmt!("#%s", encode_component(*fragment)), + Some(ref fragment) => format!("\\#{}", encode_component(*fragment)), None => ~"", }; - fmt!("%s:%s%s%s%s", url.scheme, authority, url.path, query, fragment) + format!("{}:{}{}{}{}", url.scheme, authority, url.path, query, fragment) } impl ToStr for Url { diff --git a/src/libextra/uuid.rs b/src/libextra/uuid.rs index 77f8edc10aa5c..6da97d8628a87 100644 --- a/src/libextra/uuid.rs +++ b/src/libextra/uuid.rs @@ -129,17 +129,17 @@ impl ToStr for ParseError { fn to_str(&self) -> ~str { match *self { ErrorInvalidLength(found) => - fmt!("Invalid length; expecting 32, 36 or 45 chars, found %u", - found), + format!("Invalid length; expecting 32, 36 or 45 chars, found {}", + found), ErrorInvalidCharacter(found, pos) => - fmt!("Invalid character; found `%c` (0x%02x) at offset %u", - found, found as uint, pos), + format!("Invalid character; found `{}` (0x{:02x}) at offset {}", + found, found as uint, pos), ErrorInvalidGroups(found) => - fmt!("Malformed; wrong number of groups: expected 1 or 5, found %u", - found), + format!("Malformed; wrong number of groups: expected 1 or 5, found {}", + found), ErrorInvalidGroupLength(group, found, expecting) => - fmt!("Malformed; length of group %u was %u, expecting %u", - group, found, expecting), + format!("Malformed; length of group {} was {}, expecting {}", + group, found, expecting), } } } @@ -303,7 +303,7 @@ impl Uuid { pub fn to_simple_str(&self) -> ~str { let mut s: ~[u8] = vec::from_elem(32, 0u8); for i in range(0u, 16u) { - let digit = fmt!("%02x", self.bytes[i] as uint); + let digit = format!("{:02x}", self.bytes[i] as uint); s[i*2+0] = digit[0]; s[i*2+1] = digit[1]; } @@ -324,12 +324,13 @@ impl Uuid { uf.data1 = to_be32(uf.data1 as i32) as u32; uf.data2 = to_be16(uf.data2 as i16) as u16; uf.data3 = to_be16(uf.data3 as i16) as u16; - let s = fmt!("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uf.data1 as uint, - uf.data2 as uint, uf.data3 as uint, - uf.data4[0] as uint, uf.data4[1] as uint, - uf.data4[2] as uint, uf.data4[3] as uint, uf.data4[4] as uint, - uf.data4[5] as uint, uf.data4[6] as uint, uf.data4[7] as uint); + let s = format!("{:08x}-{:04x}-{:04x}-{:02x}{:02x}-\ + {:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", + uf.data1, + uf.data2, uf.data3, + uf.data4[0], uf.data4[1], + uf.data4[2], uf.data4[3], uf.data4[4], + uf.data4[5], uf.data4[6], uf.data4[7]); s } diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs index e24fe3eb8c25e..32a2d83d814e1 100644 --- a/src/libextra/workcache.rs +++ b/src/libextra/workcache.rs @@ -183,11 +183,11 @@ impl Database { assert!(os::path_exists(&self.db_filename)); let f = io::file_reader(&self.db_filename); match f { - Err(e) => fail!("Couldn't load workcache database %s: %s", + Err(e) => fail2!("Couldn't load workcache database {}: {}", self.db_filename.to_str(), e.to_str()), Ok(r) => match json::from_reader(r) { - Err(e) => fail!("Couldn't parse workcache database (from file %s): %s", + Err(e) => fail2!("Couldn't parse workcache database (from file {}): {}", self.db_filename.to_str(), e.to_str()), Ok(r) => { let mut decoder = json::Decoder(r); @@ -264,7 +264,7 @@ fn json_encode>(t: &T) -> ~str { // FIXME(#5121) fn json_decode>(s: &str) -> T { - debug!("json decoding: %s", s); + debug2!("json decoding: {}", s); do io::with_str_reader(s) |rdr| { let j = json::from_reader(rdr).unwrap(); let mut decoder = json::Decoder(j); @@ -321,7 +321,7 @@ impl Exec { dependency_kind: &str, dependency_name: &str, dependency_val: &str) { - debug!("Discovering input %s %s %s", dependency_kind, dependency_name, dependency_val); + debug2!("Discovering input {} {} {}", dependency_kind, dependency_name, dependency_val); self.discovered_inputs.insert_work_key(WorkKey::new(dependency_kind, dependency_name), dependency_val.to_owned()); } @@ -329,7 +329,7 @@ impl Exec { dependency_kind: &str, dependency_name: &str, dependency_val: &str) { - debug!("Discovering output %s %s %s", dependency_kind, dependency_name, dependency_val); + debug2!("Discovering output {} {} {}", dependency_kind, dependency_name, dependency_val); self.discovered_outputs.insert_work_key(WorkKey::new(dependency_kind, dependency_name), dependency_val.to_owned()); } @@ -368,7 +368,7 @@ impl<'self> Prep<'self> { impl<'self> Prep<'self> { pub fn declare_input(&mut self, kind: &str, name: &str, val: &str) { - debug!("Declaring input %s %s %s", kind, name, val); + debug2!("Declaring input {} {} {}", kind, name, val); self.declared_inputs.insert_work_key(WorkKey::new(kind, name), val.to_owned()); } @@ -377,17 +377,17 @@ impl<'self> Prep<'self> { name: &str, val: &str) -> bool { let k = kind.to_owned(); let f = self.ctxt.freshness.get().find(&k); - debug!("freshness for: %s/%s/%s/%s", cat, kind, name, val) + debug2!("freshness for: {}/{}/{}/{}", cat, kind, name, val) let fresh = match f { - None => fail!("missing freshness-function for '%s'", kind), + None => fail2!("missing freshness-function for '{}'", kind), Some(f) => (*f)(name, val) }; do self.ctxt.logger.write |lg| { if fresh { - lg.info(fmt!("%s %s:%s is fresh", + lg.info(format!("{} {}:{} is fresh", cat, kind, name)); } else { - lg.info(fmt!("%s %s:%s is not fresh", + lg.info(format!("{} {}:{} is not fresh", cat, kind, name)) } }; @@ -418,7 +418,7 @@ impl<'self> Prep<'self> { &'self self, blk: ~fn(&mut Exec) -> T) -> Work<'self, T> { let mut bo = Some(blk); - debug!("exec_work: looking up %s and %?", self.fn_name, + debug2!("exec_work: looking up {} and {:?}", self.fn_name, self.declared_inputs); let cached = do self.ctxt.db.read |db| { db.prepare(self.fn_name, &self.declared_inputs) @@ -429,14 +429,14 @@ impl<'self> Prep<'self> { if self.all_fresh("declared input",&self.declared_inputs) && self.all_fresh("discovered input", disc_in) && self.all_fresh("discovered output", disc_out) => { - debug!("Cache hit!"); - debug!("Trying to decode: %? / %? / %?", + debug2!("Cache hit!"); + debug2!("Trying to decode: {:?} / {:?} / {}", disc_in, disc_out, *res); Work::from_value(json_decode(*res)) } _ => { - debug!("Cache miss!"); + debug2!("Cache miss!"); let (port, chan) = oneshot(); let blk = bo.take_unwrap(); let chan = Cell::new(chan); From af3b132285bc9314d545cae2e4eaef079a26252a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 21:01:58 -0700 Subject: [PATCH 04/16] syntax: Remove usage of fmt! --- src/libextra/arc.rs | 2 +- src/libextra/test.rs | 2 +- src/libsyntax/abi.rs | 12 +-- src/libsyntax/ast.rs | 4 +- src/libsyntax/ast_map.rs | 34 +++---- src/libsyntax/ast_util.rs | 20 ++-- src/libsyntax/attr.rs | 24 ++--- src/libsyntax/codemap.rs | 20 ++-- src/libsyntax/diagnostic.rs | 20 ++-- src/libsyntax/ext/asm.rs | 2 +- src/libsyntax/ext/base.rs | 12 +-- src/libsyntax/ext/deriving/clone.rs | 6 +- src/libsyntax/ext/deriving/decodable.rs | 2 +- src/libsyntax/ext/deriving/encodable.rs | 2 +- src/libsyntax/ext/deriving/generic.rs | 11 ++- src/libsyntax/ext/deriving/mod.rs | 4 +- src/libsyntax/ext/env.rs | 2 +- src/libsyntax/ext/expand.rs | 93 +++++++++---------- src/libsyntax/ext/fmt.rs | 60 ++++++------ src/libsyntax/ext/format.rs | 58 ++++++------ src/libsyntax/ext/quote.rs | 10 +- src/libsyntax/ext/tt/macro_parser.rs | 12 +-- src/libsyntax/ext/tt/transcribe.rs | 10 +- src/libsyntax/fold.rs | 2 +- src/libsyntax/opt_vec.rs | 2 +- src/libsyntax/parse/attr.rs | 8 +- src/libsyntax/parse/comments.rs | 32 +++---- src/libsyntax/parse/lexer.rs | 7 +- src/libsyntax/parse/mod.rs | 6 +- src/libsyntax/parse/obsolete.rs | 4 +- src/libsyntax/parse/parser.rs | 117 ++++++++++++------------ src/libsyntax/parse/token.rs | 12 +-- src/libsyntax/print/pp.rs | 56 ++++++------ src/libsyntax/print/pprust.rs | 16 ++-- 34 files changed, 342 insertions(+), 342 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 40ddea538955b..1cb30eaa040b2 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -505,7 +505,7 @@ impl RWArc { let inner = x.unwrap(); let RWArcInner { failed: failed, data: data, _ } = inner; if failed { - fail2!(~"Can't unwrap poisoned RWArc - another task failed inside!") + fail2!("Can't unwrap poisoned RWArc - another task failed inside!") } data } diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 1370a0690ca17..16937e38695b7 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -125,7 +125,7 @@ pub fn test_main(args: &[~str], tests: ~[TestDescAndFn]) { let opts = match parse_opts(args) { Some(Ok(o)) => o, - Some(Err(msg)) => fail2!(msg), + Some(Err(msg)) => fail2!("{}", msg), None => return }; if !run_tests_console(&opts, tests) { fail2!("Some tests failed"); } diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 883020e637a1b..4875ef6d3caa5 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -221,7 +221,7 @@ impl AbiSet { let data = abi.data(); for other_abi in abis.slice(0, i).iter() { let other_data = other_abi.data(); - debug!("abis=(%?,%?) datas=(%?,%?)", + debug2!("abis=({:?},{:?}) datas=({:?},{:?})", abi, data.abi_arch, other_abi, other_data.abi_arch); match (&data.abi_arch, &other_data.abi_arch) { @@ -273,7 +273,7 @@ impl ToStr for AbiSet { strs.push(abi.data().name); true }; - fmt!("\"%s\"", strs.connect(" ")) + format!("\"{}\"", strs.connect(" ")) } } @@ -306,7 +306,7 @@ fn cannot_combine(n: Abi, m: Abi) { (m == a && n == b)); } None => { - fail!("Invalid match not detected"); + fail2!("Invalid match not detected"); } } } @@ -318,7 +318,7 @@ fn can_combine(n: Abi, m: Abi) { set.add(m); match set.check_valid() { Some((_, _)) => { - fail!("Valid match declared invalid"); + fail2!("Valid match declared invalid"); } None => {} } @@ -367,7 +367,7 @@ fn abi_to_str_c_aaps() { let mut set = AbiSet::empty(); set.add(Aapcs); set.add(C); - debug!("set = %s", set.to_str()); + debug2!("set = {}", set.to_str()); assert!(set.to_str() == ~"\"aapcs C\""); } @@ -375,7 +375,7 @@ fn abi_to_str_c_aaps() { fn abi_to_str_rust() { let mut set = AbiSet::empty(); set.add(Rust); - debug!("set = %s", set.to_str()); + debug2!("set = {}", set.to_str()); assert!(set.to_str() == ~"\"Rust\""); } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7e4cbf8e97511..f2d7ebdd5993f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -47,8 +47,8 @@ impl Eq for Ident { // if it should be non-hygienic (most things are), just compare the // 'name' fields of the idents. Or, even better, replace the idents // with Name's. - fail!(fmt!("not allowed to compare these idents: %?, %?. Probably \ - related to issue #6993", self, other)); + fail2!("not allowed to compare these idents: {:?}, {:?}. + Probably related to issue \\#6993", self, other); } } fn ne(&self, other: &Ident) -> bool { diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 1323db7acba51..105d222926e23 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -66,7 +66,7 @@ pub fn path_ident_to_str(p: &path, i: Ident, itr: @ident_interner) -> ~str { if p.is_empty() { itr.get(i.name).to_owned() } else { - fmt!("%s::%s", path_to_str(*p, itr), itr.get(i.name)) + format!("{}::{}", path_to_str(*p, itr), itr.get(i.name)) } } @@ -96,7 +96,7 @@ pub fn impl_pretty_name(trait_ref: &Option, // XXX: this dollar sign is actually a relic of being one of the // very few valid symbol names on unix. These kinds of // details shouldn't be exposed way up here in the ast. - let s = fmt!("%s$%s", + let s = format!("{}${}", itr.get(trait_ref.path.segments.last().identifier.name), itr.get(ty_ident.name)); path_pretty_name(Ident::new(itr.gensym(s)), hash) @@ -185,7 +185,7 @@ impl Ctx { item, p)); } - _ => fail!("struct def parent wasn't an item") + _ => fail2!("struct def parent wasn't an item") } } } @@ -426,7 +426,7 @@ pub fn map_decoded_item(diag: @mut span_handler, pub fn node_id_to_str(map: map, id: NodeId, itr: @ident_interner) -> ~str { match map.find(&id) { None => { - fmt!("unknown node (id=%d)", id) + format!("unknown node (id={})", id) } Some(&node_item(item, path)) => { let path_str = path_ident_to_str(path, item.ident, itr); @@ -442,46 +442,46 @@ pub fn node_id_to_str(map: map, id: NodeId, itr: @ident_interner) -> ~str { item_impl(*) => ~"impl", item_mac(*) => ~"macro" }; - fmt!("%s %s (id=%?)", item_str, path_str, id) + format!("{} {} (id={})", item_str, path_str, id) } Some(&node_foreign_item(item, abi, _, path)) => { - fmt!("foreign item %s with abi %? (id=%?)", + format!("foreign item {} with abi {:?} (id={})", path_ident_to_str(path, item.ident, itr), abi, id) } Some(&node_method(m, _, path)) => { - fmt!("method %s in %s (id=%?)", + format!("method {} in {} (id={})", itr.get(m.ident.name), path_to_str(*path, itr), id) } Some(&node_trait_method(ref tm, _, path)) => { let m = ast_util::trait_method_to_ty_method(&**tm); - fmt!("method %s in %s (id=%?)", + format!("method {} in {} (id={})", itr.get(m.ident.name), path_to_str(*path, itr), id) } Some(&node_variant(ref variant, _, path)) => { - fmt!("variant %s in %s (id=%?)", + format!("variant {} in {} (id={})", itr.get(variant.node.name.name), path_to_str(*path, itr), id) } Some(&node_expr(expr)) => { - fmt!("expr %s (id=%?)", pprust::expr_to_str(expr, itr), id) + format!("expr {} (id={})", pprust::expr_to_str(expr, itr), id) } Some(&node_callee_scope(expr)) => { - fmt!("callee_scope %s (id=%?)", pprust::expr_to_str(expr, itr), id) + format!("callee_scope {} (id={})", pprust::expr_to_str(expr, itr), id) } Some(&node_stmt(stmt)) => { - fmt!("stmt %s (id=%?)", + format!("stmt {} (id={})", pprust::stmt_to_str(stmt, itr), id) } Some(&node_arg(pat)) => { - fmt!("arg %s (id=%?)", pprust::pat_to_str(pat, itr), id) + format!("arg {} (id={})", pprust::pat_to_str(pat, itr), id) } Some(&node_local(ident)) => { - fmt!("local (id=%?, name=%s)", id, itr.get(ident.name)) + format!("local (id={}, name={})", id, itr.get(ident.name)) } Some(&node_block(ref block)) => { - fmt!("block %s (id=%?)", pprust::block_to_str(block, itr), id) + format!("block {} (id={})", pprust::block_to_str(block, itr), id) } Some(&node_struct_ctor(_, _, path)) => { - fmt!("struct_ctor %s (id=%?)", path_to_str(*path, itr), id) + format!("struct_ctor {} (id={})", path_to_str(*path, itr), id) } } } @@ -491,6 +491,6 @@ pub fn node_item_query(items: map, id: NodeId, error_msg: ~str) -> Result { match items.find(&id) { Some(&node_item(it, _)) => query(it), - _ => fail!(error_msg) + _ => fail2!("{}", error_msg) } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 9e23501a13bff..f93fc1e81da23 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -45,7 +45,7 @@ pub fn stmt_id(s: &Stmt) -> NodeId { StmtDecl(_, id) => id, StmtExpr(_, id) => id, StmtSemi(_, id) => id, - StmtMac(*) => fail!("attempted to analyze unexpanded stmt") + StmtMac(*) => fail2!("attempted to analyze unexpanded stmt") } } @@ -72,7 +72,7 @@ pub fn def_id_of_def(d: Def) -> DefId { local_def(id) } - DefPrimTy(_) => fail!() + DefPrimTy(_) => fail2!() } } @@ -756,7 +756,7 @@ pub fn new_mark_internal(m:Mrk, tail:SyntaxContext,table:&mut SCTable) } true => { match table.mark_memo.find(&key) { - None => fail!(~"internal error: key disappeared 2013042901"), + None => fail2!("internal error: key disappeared 2013042901"), Some(idxptr) => {*idxptr} } } @@ -783,7 +783,7 @@ pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SC } true => { match table.rename_memo.find(&key) { - None => fail!(~"internal error: key disappeared 2013042902"), + None => fail2!("internal error: key disappeared 2013042902"), Some(idxptr) => {*idxptr} } } @@ -816,9 +816,9 @@ pub fn get_sctable() -> @mut SCTable { /// print out an SCTable for debugging pub fn display_sctable(table : &SCTable) { - error!("SC table:"); + error2!("SC table:"); for (idx,val) in table.table.iter().enumerate() { - error!("%4u : %?",idx,val); + error2!("{:4u} : {:?}",idx,val); } } @@ -880,7 +880,7 @@ pub fn resolve_internal(id : Ident, resolvedthis } } - IllegalCtxt() => fail!(~"expected resolvable context, got IllegalCtxt") + IllegalCtxt() => fail2!("expected resolvable context, got IllegalCtxt") } }; resolve_table.insert(key,resolved); @@ -921,7 +921,7 @@ pub fn marksof(ctxt: SyntaxContext, stopname: Name, table: &SCTable) -> ~[Mrk] { loopvar = tl; } } - IllegalCtxt => fail!(~"expected resolvable context, got IllegalCtxt") + IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt") } } } @@ -932,7 +932,7 @@ pub fn mtwt_outer_mark(ctxt: SyntaxContext) -> Mrk { let sctable = get_sctable(); match sctable.table[ctxt] { ast::Mark(mrk,_) => mrk, - _ => fail!("can't retrieve outer mark when outside is not a mark") + _ => fail2!("can't retrieve outer mark when outside is not a mark") } } @@ -1064,7 +1064,7 @@ mod test { sc = tail; loop; } - IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt") + IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt") } } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 47a7d0fbf9e95..31905f6ccc7aa 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -168,17 +168,17 @@ pub fn mk_sugared_doc_attr(text: @str, lo: BytePos, hi: BytePos) -> Attribute { /// span included in the `==` comparison a plain MetaItem. pub fn contains(haystack: &[@ast::MetaItem], needle: @ast::MetaItem) -> bool { - debug!("attr::contains (name=%s)", needle.name()); + debug2!("attr::contains (name={})", needle.name()); do haystack.iter().any |item| { - debug!(" testing: %s", item.name()); + debug2!(" testing: {}", item.name()); item.node == needle.node } } pub fn contains_name(metas: &[AM], name: &str) -> bool { - debug!("attr::contains_name (name=%s)", name); + debug2!("attr::contains_name (name={})", name); do metas.iter().any |item| { - debug!(" testing: %s", item.name()); + debug2!(" testing: {}", item.name()); name == item.name() } } @@ -279,23 +279,23 @@ pub fn test_cfg> // this would be much nicer as a chain of iterator adaptors, but // this doesn't work. let some_cfg_matches = do metas.any |mi| { - debug!("testing name: %s", mi.name()); + debug2!("testing name: {}", mi.name()); if "cfg" == mi.name() { // it is a #[cfg()] attribute - debug!("is cfg"); + debug2!("is cfg"); no_cfgs = false; // only #[cfg(...)] ones are understood. match mi.meta_item_list() { Some(cfg_meta) => { - debug!("is cfg(...)"); + debug2!("is cfg(...)"); do cfg_meta.iter().all |cfg_mi| { - debug!("cfg(%s[...])", cfg_mi.name()); + debug2!("cfg({}[...])", cfg_mi.name()); match cfg_mi.node { ast::MetaList(s, ref not_cfgs) if "not" == s => { - debug!("not!"); + debug2!("not!"); // inside #[cfg(not(...))], so these need to all // not match. not_cfgs.iter().all(|mi| { - debug!("cfg(not(%s[...]))", mi.name()); + debug2!("cfg(not({}[...]))", mi.name()); !contains(cfg, *mi) }) } @@ -309,7 +309,7 @@ pub fn test_cfg> false } }; - debug!("test_cfg (no_cfgs=%?, some_cfg_matches=%?)", no_cfgs, some_cfg_matches); + debug2!("test_cfg (no_cfgs={}, some_cfg_matches={})", no_cfgs, some_cfg_matches); no_cfgs || some_cfg_matches } @@ -359,7 +359,7 @@ pub fn require_unique_names(diagnostic: @mut span_handler, if !set.insert(name) { diagnostic.span_fatal(meta.span, - fmt!("duplicate meta item `%s`", name)); + format!("duplicate meta item `{}`", name)); } } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index c8e40b82e0c30..de8f45c880d2a 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -290,7 +290,7 @@ impl CodeMap { pub fn mk_substr_filename(&self, sp: Span) -> ~str { let pos = self.lookup_char_pos(sp.lo); - return fmt!("<%s:%u:%u>", pos.file.name, + return format!("<{}:{}:{}>", pos.file.name, pos.line, pos.col.to_uint()); } @@ -336,7 +336,7 @@ impl CodeMap { let lo = self.lookup_char_pos_adj(sp.lo); let hi = self.lookup_char_pos_adj(sp.hi); - return fmt!("%s:%u:%u: %u:%u", lo.filename, + return format!("{}:{}:{}: {}:{}", lo.filename, lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint()) } @@ -374,7 +374,7 @@ impl CodeMap { for fm in self.files.iter() { if filename == fm.name { return *fm; } } //XXjdm the following triggers a mismatched type bug // (or expected function, found _|_) - fail!(); // ("asking for " + filename + " which we don't know about"); + fail2!(); // ("asking for " + filename + " which we don't know about"); } } @@ -393,7 +393,7 @@ impl CodeMap { } } if (a >= len) { - fail!("position %u does not resolve to a source location", pos.to_uint()) + fail2!("position {} does not resolve to a source location", pos.to_uint()) } return a; @@ -419,11 +419,11 @@ impl CodeMap { let chpos = self.bytepos_to_local_charpos(pos); let linebpos = f.lines[a]; let linechpos = self.bytepos_to_local_charpos(linebpos); - debug!("codemap: byte pos %? is on the line at byte pos %?", + debug2!("codemap: byte pos {:?} is on the line at byte pos {:?}", pos, linebpos); - debug!("codemap: char pos %? is on the line at char pos %?", + debug2!("codemap: char pos {:?} is on the line at char pos {:?}", chpos, linechpos); - debug!("codemap: byte is on line: %?", line); + debug2!("codemap: byte is on line: {:?}", line); assert!(chpos >= linechpos); return Loc { file: f, @@ -435,7 +435,7 @@ impl CodeMap { fn span_to_str_no_adj(&self, sp: Span) -> ~str { let lo = self.lookup_char_pos(sp.lo); let hi = self.lookup_char_pos(sp.hi); - return fmt!("%s:%u:%u: %u:%u", lo.file.name, + return format!("{}:{}:{}: {}:{}", lo.file.name, lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint()) } @@ -450,7 +450,7 @@ impl CodeMap { // Converts an absolute BytePos to a CharPos relative to the file it is // located in fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos { - debug!("codemap: converting %? to char pos", bpos); + debug2!("codemap: converting {:?} to char pos", bpos); let idx = self.lookup_filemap_idx(bpos); let map = self.files[idx]; @@ -458,7 +458,7 @@ impl CodeMap { let mut total_extra_bytes = 0; for mbc in map.multibyte_chars.iter() { - debug!("codemap: %?-byte char at %?", mbc.bytes, mbc.pos); + debug2!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos < bpos { total_extra_bytes += mbc.bytes; // We should never see a byte position in the middle of a diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index aa06e1bee4141..03b47f89ab6cd 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -69,7 +69,7 @@ struct CodemapT { impl span_handler for CodemapT { fn span_fatal(@mut self, sp: Span, msg: &str) -> ! { self.handler.emit(Some((self.cm, sp)), msg, fatal); - fail!(); + fail2!(); } fn span_err(@mut self, sp: Span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, error); @@ -95,7 +95,7 @@ impl span_handler for CodemapT { impl handler for HandlerT { fn fatal(@mut self, msg: &str) -> ! { self.emit.emit(None, msg, fatal); - fail!(); + fail2!(); } fn err(@mut self, msg: &str) { self.emit.emit(None, msg, error); @@ -116,7 +116,7 @@ impl handler for HandlerT { 0u => return, 1u => s = ~"aborting due to previous error", _ => { - s = fmt!("aborting due to %u previous errors", + s = format!("aborting due to {} previous errors", self.err_count); } } @@ -143,7 +143,7 @@ impl handler for HandlerT { } pub fn ice_msg(msg: &str) -> ~str { - fmt!("internal compiler error: %s", msg) + format!("internal compiler error: {}", msg) } pub fn mk_span_handler(handler: @mut handler, cm: @codemap::CodeMap) @@ -228,12 +228,12 @@ fn print_diagnostic(topic: &str, lvl: level, msg: &str) { let stderr = io::stderr(); if !topic.is_empty() { - stderr.write_str(fmt!("%s ", topic)); + stderr.write_str(format!("{} ", topic)); } - print_maybe_styled(fmt!("%s: ", diagnosticstr(lvl)), + print_maybe_styled(format!("{}: ", diagnosticstr(lvl)), term::attr::ForegroundColor(diagnosticcolor(lvl))); - print_maybe_styled(fmt!("%s\n", msg), term::attr::Bold); + print_maybe_styled(format!("{}\n", msg), term::attr::Bold); } pub struct DefaultEmitter; @@ -273,13 +273,13 @@ fn highlight_lines(cm: @codemap::CodeMap, } // Print the offending lines for line in display_lines.iter() { - io::stderr().write_str(fmt!("%s:%u ", fm.name, *line + 1u)); + io::stderr().write_str(format!("{}:{} ", fm.name, *line + 1u)); let s = fm.get_line(*line as int) + "\n"; io::stderr().write_str(s); } if elided { let last_line = display_lines[display_lines.len() - 1u]; - let s = fmt!("%s:%u ", fm.name, last_line + 1u); + let s = format!("{}:{} ", fm.name, last_line + 1u); let mut indent = s.len(); let mut out = ~""; while indent > 0u { @@ -339,7 +339,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) { for ei in sp.expn_info.iter() { let ss = ei.callee.span.map_default(~"", |span| cm.span_to_str(*span)); print_diagnostic(ss, note, - fmt!("in expansion of %s!", ei.callee.name)); + format!("in expansion of {}!", ei.callee.name)); let ss = cm.span_to_str(ei.call_site); print_diagnostic(ss, note, "expansion site"); print_macro_backtrace(cm, ei.call_site); diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index d47435dab5610..9241e8c4fbcb1 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -111,7 +111,7 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) p.eat(&token::COMMA); } - let clob = fmt!("~{%s}", p.parse_str()); + let clob = format!("~\\{{}\\}", p.parse_str()); clobs.push(clob); } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 4824924bc0fad..3b4be1de3e81b 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -423,7 +423,7 @@ pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::Expr, err_msg: &str) -> @str { pub fn check_zero_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree], name: &str) { if tts.len() != 0 { - cx.span_fatal(sp, fmt!("%s takes no arguments", name)); + cx.span_fatal(sp, format!("{} takes no arguments", name)); } } @@ -433,12 +433,12 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt, name: &str) -> @str { if tts.len() != 1 { - cx.span_fatal(sp, fmt!("%s takes 1 argument.", name)); + cx.span_fatal(sp, format!("{} takes 1 argument.", name)); } match tts[0] { ast::tt_tok(_, token::LIT_STR(ident)) => cx.str_of(ident), - _ => cx.span_fatal(sp, fmt!("%s requires a string.", name)), + _ => cx.span_fatal(sp, format!("{} requires a string.", name)), } } @@ -539,11 +539,11 @@ impl MapChain{ // names? I think not. // delaying implementing this.... pub fn each_key (&self, _f: &fn (&K)->bool) { - fail!("unimplemented 2013-02-15T10:01"); + fail2!("unimplemented 2013-02-15T10:01"); } pub fn each_value (&self, _f: &fn (&V) -> bool) { - fail!("unimplemented 2013-02-15T10:02"); + fail2!("unimplemented 2013-02-15T10:02"); } // Returns a copy of the value that the name maps to. @@ -586,7 +586,7 @@ impl MapChain{ if satisfies_pred(map,&n,pred) { map.insert(key,ext); } else { - fail!(~"expected map chain containing satisfying frame") + fail2!("expected map chain containing satisfying frame") } }, ConsMapChain (~ref mut map, rest) => { diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index 9ef995b0d5700..5b107a49175ad 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -86,10 +86,10 @@ fn cs_clone( all_fields = af; }, EnumNonMatching(*) => cx.span_bug(span, - fmt!("Non-matching enum variants in `deriving(%s)`", + format!("Non-matching enum variants in `deriving({})`", name)), StaticEnum(*) | StaticStruct(*) => cx.span_bug(span, - fmt!("Static method in `deriving(%s)`", + format!("Static method in `deriving({})`", name)) } @@ -105,7 +105,7 @@ fn cs_clone( let ident = match o_id { Some(i) => i, None => cx.span_bug(span, - fmt!("unnamed field in normal struct in `deriving(%s)`", + format!("unnamed field in normal struct in `deriving({})`", name)) }; cx.field_imm(span, ident, subcall(self_f)) diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index 66cd2d511a89d..91fe71c54145e 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -84,7 +84,7 @@ fn decodable_substructure(cx: @ExtCtxt, span: Span, } else { let mut fields = vec::with_capacity(n); for i in range(0, n) { - fields.push(getarg(fmt!("_field%u", i).to_managed(), i)); + fields.push(getarg(format!("_field{}", i).to_managed(), i)); } cx.expr_call_ident(span, substr.type_ident, fields) } diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 99b2359232c2a..d1c436c045d2b 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -125,7 +125,7 @@ fn encodable_substructure(cx: @ExtCtxt, span: Span, for (i, f) in fields.iter().enumerate() { let (name, val) = match *f { (Some(id), e, _) => (cx.str_of(id), e), - (None, e, _) => (fmt!("_field%u", i).to_managed(), e) + (None, e, _) => (format!("_field{}", i).to_managed(), e) }; let enc = cx.expr_method_call(span, val, encode, ~[blkencoder]); let lambda = cx.lambda_expr_1(span, enc, blkarg); diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 646b65d080b47..f5e45eec7e036 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -487,7 +487,7 @@ impl<'self> MethodDef<'self> { for (i, ty) in self.args.iter().enumerate() { let ast_ty = ty.to_ty(cx, span, type_ident, generics); - let ident = cx.ident_of(fmt!("__arg_%u", i)); + let ident = cx.ident_of(format!("__arg_{}", i)); arg_tys.push((ident, ast_ty)); let arg_expr = cx.expr_ident(span, ident); @@ -582,7 +582,8 @@ impl<'self> MethodDef<'self> { for i in range(0u, self_args.len()) { let (pat, ident_expr) = create_struct_pattern(cx, span, type_ident, struct_def, - fmt!("__self_%u", i), ast::MutImmutable); + format!("__self_{}", i), + ast::MutImmutable); patterns.push(pat); raw_fields.push(ident_expr); } @@ -767,7 +768,7 @@ impl<'self> MethodDef<'self> { let current_match_str = if match_count == 0 { ~"__self" } else { - fmt!("__arg_%u", match_count) + format!("__arg_{}", match_count) }; let mut arms = ~[]; @@ -948,7 +949,7 @@ fn create_struct_pattern(cx: @ExtCtxt, } }; let path = cx.path_ident(span, - cx.ident_of(fmt!("%s_%u", prefix, i))); + cx.ident_of(format!("{}_{}", prefix, i))); paths.push(path.clone()); ident_expr.push((opt_id, cx.expr_path(path))); } @@ -993,7 +994,7 @@ fn create_enum_variant_pattern(cx: @ExtCtxt, let mut ident_expr = ~[]; for i in range(0u, variant_args.len()) { let path = cx.path_ident(span, - cx.ident_of(fmt!("%s_%u", prefix, i))); + cx.ident_of(format!("{}_{}", prefix, i))); paths.push(path.clone()); ident_expr.push((None, cx.expr_path(path))); diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index dfd4f79cd9e3e..a428c6704f964 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -101,8 +101,8 @@ pub fn expand_meta_deriving(cx: @ExtCtxt, "Default" => expand!(default::expand_deriving_default), ref tname => { - cx.span_err(titem.span, fmt!("unknown \ - `deriving` trait: `%s`", *tname)); + cx.span_err(titem.span, format!("unknown \ + `deriving` trait: `{}`", *tname)); in_items } } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index e97af9cbfb143..63a45b06e1644 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -43,7 +43,7 @@ pub fn expand_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) let var = expr_to_str(cx, exprs[0], "expected string literal"); let msg = match exprs.len() { - 1 => fmt!("Environment variable %s not defined", var).to_managed(), + 1 => format!("Environment variable {} not defined", var).to_managed(), 2 => expr_to_str(cx, exprs[1], "expected string literal"), _ => cx.span_fatal(sp, "env! takes 1 or 2 arguments") }; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 697df52513d8f..e8307bf578698 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -51,7 +51,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, if (pth.segments.len() > 1u) { cx.span_fatal( pth.span, - fmt!("expected macro name without module \ + format!("expected macro name without module \ separators")); } let extname = &pth.segments[0].identifier; @@ -61,7 +61,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, None => { cx.span_fatal( pth.span, - fmt!("macro undefined: '%s'", extnamestr)) + format!("macro undefined: '{}'", extnamestr)) } Some(@SE(NormalTT(expandfun, exp_span))) => { cx.bt_push(ExpnInfo { @@ -92,8 +92,8 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, _ => { cx.span_fatal( pth.span, - fmt!( - "non-expr macro in expr pos: %s", + format!( + "non-expr macro in expr pos: {}", extnamestr ) ) @@ -119,7 +119,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, _ => { cx.span_fatal( pth.span, - fmt!("'%s' is not a tt-style macro", extnamestr) + format!("'{}' is not a tt-style macro", extnamestr) ) } } @@ -353,13 +353,13 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv, let fm = fresh_mark(); let expanded = match (*extsbox).find(&extname.name) { None => cx.span_fatal(pth.span, - fmt!("macro undefined: '%s!'", extnamestr)), + format!("macro undefined: '{}!'", extnamestr)), Some(@SE(NormalTT(expander, span))) => { if it.ident.name != parse::token::special_idents::invalid.name { cx.span_fatal(pth.span, - fmt!("macro %s! expects no ident argument, \ - given '%s'", extnamestr, + format!("macro {}! expects no ident argument, \ + given '{}'", extnamestr, ident_to_str(&it.ident))); } cx.bt_push(ExpnInfo { @@ -377,7 +377,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv, Some(@SE(IdentTT(expander, span))) => { if it.ident.name == parse::token::special_idents::invalid.name { cx.span_fatal(pth.span, - fmt!("macro %s! expects an ident argument", + format!("macro {}! expects an ident argument", extnamestr)); } cx.bt_push(ExpnInfo { @@ -393,7 +393,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv, expander.expand(cx, it.span, it.ident, marked_tts, marked_ctxt) } _ => cx.span_fatal( - it.span, fmt!("%s! is not legal in item position", extnamestr)) + it.span, format!("{}! is not legal in item position", extnamestr)) }; let maybe_it = match expanded { @@ -402,7 +402,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv, .and_then(|i| fld.fold_item(i)) } MRExpr(_) => { - cx.span_fatal(pth.span, fmt!("expr macro in item position: %s", extnamestr)) + cx.span_fatal(pth.span, format!("expr macro in item position: {}", extnamestr)) } MRAny(any_macro) => { any_macro.make_item() @@ -429,8 +429,8 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) { match t { &@BlockInfo(BlockInfo {macros_escape:false,_}) => true, &@BlockInfo(BlockInfo {_}) => false, - _ => fail!(fmt!("special identifier %? was bound to a non-BlockInfo", - special_block_name)) + _ => fail2!("special identifier {:?} was bound to a non-BlockInfo", + special_block_name) } }; exts.insert_into_frame(name,transformer,intern(special_block_name), @@ -463,7 +463,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, let extnamestr = ident_to_str(extname); let fully_expanded: @ast::Stmt = match (*extsbox).find(&extname.name) { None => { - cx.span_fatal(pth.span, fmt!("macro undefined: '%s'", extnamestr)) + cx.span_fatal(pth.span, format!("macro undefined: '{}'", extnamestr)) } Some(@SE(NormalTT(expandfun, exp_span))) => { @@ -496,7 +496,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, MRAny(any_macro) => any_macro.make_stmt(), _ => cx.span_fatal( pth.span, - fmt!("non-stmt macro in stmt pos: %s", extnamestr)) + format!("non-stmt macro in stmt pos: {}", extnamestr)) }; let marked_after = mark_stmt(expanded,fm); @@ -521,7 +521,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, _ => { cx.span_fatal(pth.span, - fmt!("'%s' is not a tt-style macro", extnamestr)) + format!("'{}' is not a tt-style macro", extnamestr)) } }; @@ -741,7 +741,7 @@ pub fn expand_block_elts(exts: SyntaxEnv, b: &Block, fld: &MacroExpander) fn mustbesome(val : Option) -> T { match val { Some(v) => v, - None => fail!("rename_fold returned None") + None => fail2!("rename_fold returned None") } } @@ -749,8 +749,8 @@ fn mustbesome(val : Option) -> T { fn get_block_info(exts : SyntaxEnv) -> BlockInfo { match exts.find_in_topmost_frame(&intern(special_block_name)) { Some(@BlockInfo(bi)) => bi, - _ => fail!(fmt!("special identifier %? was bound to a non-BlockInfo", - @" block")) + _ => fail2!("special identifier {:?} was bound to a non-BlockInfo", + @" block") } } @@ -782,7 +782,7 @@ pub fn renames_to_fold(renames: @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold { fn apply_pending_renames(folder : @ast_fold, stmt : ast::Stmt) -> @ast::Stmt { match folder.fold_stmt(&stmt) { Some(s) => s, - None => fail!(fmt!("renaming of stmt produced None")) + None => fail2!("renaming of stmt produced None") } } @@ -813,7 +813,7 @@ pub fn std_macros() -> @str { mod fmt_extension { #[macro_escape]; - macro_rules! fmt(($($arg:tt)*) => (oldfmt!($($arg)*))) + macro_rules! fmt(($($arg:tt)*) => (oldformat!($($arg)*))) macro_rules! log( ($lvl:expr, $arg:expr) => ({ @@ -821,7 +821,7 @@ pub fn std_macros() -> @str { if lvl <= __log_level() { format_args!(|args| { ::std::logging::log(lvl, args) - }, \"{}\", fmt!(\"%?\", $arg)) + }, \"{}\", format!(\"{:?}\", $arg)) } }); ($lvl:expr, $($arg:expr),+) => ({ @@ -829,7 +829,7 @@ pub fn std_macros() -> @str { if lvl <= __log_level() { format_args!(|args| { ::std::logging::log(lvl, args) - }, \"{}\", fmt!($($arg),+)) + }, \"{}\", format!($($arg),+)) } }) ) @@ -842,13 +842,13 @@ pub fn std_macros() -> @str { macro_rules! fail( () => ( - fail!(\"explicit failure\") + fail2!(\"explicit failure\") ); ($msg:expr) => ( ::std::sys::FailWithCause::fail_with($msg, file!(), line!()) ); ($( $arg:expr ),+) => ( - ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!()) + ::std::sys::FailWithCause::fail_with(format!( $($arg),+ ), file!(), line!()) ) ) } @@ -896,7 +896,7 @@ pub fn std_macros() -> @str { }; ($cond:expr, $( $arg:expr ),+) => { if !$cond { - ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!()) + ::std::sys::FailWithCause::fail_with(format!( $($arg),+ ), file!(), line!()) } } ) @@ -1164,7 +1164,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, ~[], parse_sess) { Some(item) => item, - None => fail!("expected core macros to parse correctly") + None => fail2!("expected core macros to parse correctly") }; let injector = @Injector { @@ -1422,16 +1422,16 @@ mod test { use util::parser_testing::{string_to_pat, string_to_tts, strs_to_idents}; use visit; - // make sure that fail! is present + // make sure that fail2! is present #[test] fn fail_exists_test () { - let src = @"fn main() { fail!(\"something appropriately gloomy\");}"; + let src = @"fn main() { fail2!(\"something appropriately gloomy\");}"; let sess = parse::new_parse_sess(None); let crate_ast = parse::parse_crate_from_source_str( @"", src, ~[],sess); let crate_ast = inject_std_macros(sess, ~[], crate_ast); - // don't bother with striping, doesn't affect fail!. + // don't bother with striping, doesn't affect fail2!. expand_crate(sess,~[],crate_ast); } @@ -1489,7 +1489,7 @@ mod test { cfg,~[],sess); match item_ast { Some(_) => (), // success - None => fail!("expected this to parse") + None => fail2!("expected this to parse") } } @@ -1528,7 +1528,7 @@ mod test { let marked_once_ctxt = match marked_once[0] { ast::tt_tok(_,token::IDENT(id,_)) => id.ctxt, - _ => fail!(fmt!("unexpected shape for marked tts: %?",marked_once[0])) + _ => fail2!(format!("unexpected shape for marked tts: {:?}",marked_once[0])) }; assert_eq!(mtwt_marksof(marked_once_ctxt,invalid_name),~[fm]); let remarked = mtwt_cancel_outer_mark(marked_once,marked_once_ctxt); @@ -1536,7 +1536,7 @@ mod test { match remarked[0] { ast::tt_tok(_,token::IDENT(id,_)) => assert_eq!(mtwt_marksof(id.ctxt,invalid_name),~[]), - _ => fail!(fmt!("unexpected shape for marked tts: %?",remarked[0])) + _ => fail2!(format!("unexpected shape for marked tts: {:?}",remarked[0])) } } @@ -1583,7 +1583,7 @@ mod test { //fn expand_and_resolve(crate_str: @str) -> ast::crate { //let expanded_ast = expand_crate_str(crate_str); - // std::io::println(fmt!("expanded: %?\n",expanded_ast)); + // std::io::println(format!("expanded: {:?}\n",expanded_ast)); //mtwt_resolve_crate(expanded_ast) //} //fn expand_and_resolve_and_pretty_print (crate_str : @str) -> ~str { @@ -1693,8 +1693,8 @@ mod test { invalid_name); if (!(varref_name==binding_name)){ std::io::println("uh oh, should match but doesn't:"); - std::io::println(fmt!("varref: %?",varref)); - std::io::println(fmt!("binding: %?", bindings[binding_idx])); + std::io::println(format!("varref: {:?}",varref)); + std::io::println(format!("binding: {:?}", bindings[binding_idx])); ast_util::display_sctable(get_sctable()); } assert_eq!(varref_name,binding_name); @@ -1712,12 +1712,12 @@ mod test { println!("text of test case: \"{}\"", teststr); println!(""); println!("uh oh, matches but shouldn't:"); - std::io::println(fmt!("varref: %?",varref)); + std::io::println(format!("varref: {:?}",varref)); // good lord, you can't make a path with 0 segments, can you? println!("varref's first segment's uint: {}, and string: \"{}\"", varref.segments[0].identifier.name, ident_to_str(&varref.segments[0].identifier)); - std::io::println(fmt!("binding: %?", bindings[binding_idx])); + std::io::println(format!("binding: {:?}", bindings[binding_idx])); ast_util::display_sctable(get_sctable()); } assert!(!fail); @@ -1727,7 +1727,7 @@ mod test { } #[test] fn fmt_in_macro_used_inside_module_macro() { - let crate_str = @"macro_rules! fmt_wrap(($b:expr)=>(fmt!(\"left: %?\", $b))) + let crate_str = @"macro_rules! fmt_wrap(($b:expr)=>($b.to_str())) macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}})) foo_module!() "; @@ -1739,7 +1739,7 @@ foo_module!() bindings.iter().filter(|b|{@"xx" == (ident_to_str(*b))}).collect(); let cxbind = match cxbinds { [b] => b, - _ => fail!("expected just one binding for ext_cx") + _ => fail2!("expected just one binding for ext_cx") }; let resolved_binding = mtwt_resolve(*cxbind); // find all the xx varrefs: @@ -1751,15 +1751,16 @@ foo_module!() }).enumerate() { if (mtwt_resolve(v.segments[0].identifier) != resolved_binding) { std::io::println("uh oh, xx binding didn't match xx varref:"); - std::io::println(fmt!("this is xx varref # %?",idx)); - std::io::println(fmt!("binding: %?",cxbind)); - std::io::println(fmt!("resolves to: %?",resolved_binding)); - std::io::println(fmt!("varref: %?",v.segments[0].identifier)); - std::io::println(fmt!("resolves to: %?",mtwt_resolve(v.segments[0].identifier))); + std::io::println(format!("this is xx varref \\# {:?}",idx)); + std::io::println(format!("binding: {:?}",cxbind)); + std::io::println(format!("resolves to: {:?}",resolved_binding)); + std::io::println(format!("varref: {:?}",v.segments[0].identifier)); + std::io::println(format!("resolves to: {:?}", + mtwt_resolve(v.segments[0].identifier))); let table = get_sctable(); std::io::println("SC table:"); for (idx,val) in table.table.iter().enumerate() { - std::io::println(fmt!("%4u : %?",idx,val)); + std::io::println(format!("{:4u} : {:?}",idx,val)); } } assert_eq!(mtwt_resolve(v.segments[0].identifier),resolved_binding); diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index d48fa03c0ef25..cd364e7ad64a7 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -34,7 +34,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) expr_to_str(cx, args[0], "first argument to fmt! must be a string literal."); let fmtspan = args[0].span; - debug!("Format string: %s", fmt); + debug2!("Format string: {}", fmt); fn parse_fmt_err_(cx: @ExtCtxt, sp: Span, msg: &str) -> ! { cx.span_fatal(sp, msg); } @@ -198,53 +198,53 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, cx.expr_mut_addr_of(arg.span, buf)); } fn log_conv(c: &Conv) { - debug!("Building conversion:"); + debug2!("Building conversion:"); match c.param { - Some(p) => { debug!("param: %s", p.to_str()); } - _ => debug!("param: none") + Some(p) => { debug2!("param: {}", p.to_str()); } + _ => debug2!("param: none") } for f in c.flags.iter() { match *f { - FlagLeftJustify => debug!("flag: left justify"), - FlagLeftZeroPad => debug!("flag: left zero pad"), - FlagSpaceForSign => debug!("flag: left space pad"), - FlagSignAlways => debug!("flag: sign always"), - FlagAlternate => debug!("flag: alternate") + FlagLeftJustify => debug2!("flag: left justify"), + FlagLeftZeroPad => debug2!("flag: left zero pad"), + FlagSpaceForSign => debug2!("flag: left space pad"), + FlagSignAlways => debug2!("flag: sign always"), + FlagAlternate => debug2!("flag: alternate") } } match c.width { CountIs(i) => - debug!("width: count is %s", i.to_str()), + debug2!("width: count is {}", i.to_str()), CountIsParam(i) => - debug!("width: count is param %s", i.to_str()), - CountIsNextParam => debug!("width: count is next param"), - CountImplied => debug!("width: count is implied") + debug2!("width: count is param {}", i.to_str()), + CountIsNextParam => debug2!("width: count is next param"), + CountImplied => debug2!("width: count is implied") } match c.precision { CountIs(i) => - debug!("prec: count is %s", i.to_str()), + debug2!("prec: count is {}", i.to_str()), CountIsParam(i) => - debug!("prec: count is param %s", i.to_str()), - CountIsNextParam => debug!("prec: count is next param"), - CountImplied => debug!("prec: count is implied") + debug2!("prec: count is param {}", i.to_str()), + CountIsNextParam => debug2!("prec: count is next param"), + CountImplied => debug2!("prec: count is implied") } match c.ty { - TyBool => debug!("type: bool"), - TyStr => debug!("type: str"), - TyChar => debug!("type: char"), + TyBool => debug2!("type: bool"), + TyStr => debug2!("type: str"), + TyChar => debug2!("type: char"), TyInt(s) => match s { - Signed => debug!("type: signed"), - Unsigned => debug!("type: unsigned") + Signed => debug2!("type: signed"), + Unsigned => debug2!("type: unsigned") }, - TyBits => debug!("type: bits"), + TyBits => debug2!("type: bits"), TyHex(cs) => match cs { - CaseUpper => debug!("type: uhex"), - CaseLower => debug!("type: lhex"), + CaseUpper => debug2!("type: uhex"), + CaseLower => debug2!("type: lhex"), }, - TyOctal => debug!("type: octal"), - TyFloat => debug!("type: float"), - TyPointer => debug!("type: pointer"), - TyPoly => debug!("type: poly") + TyOctal => debug2!("type: octal"), + TyFloat => debug2!("type: float"), + TyPointer => debug2!("type: pointer"), + TyPoly => debug2!("type: poly") } } @@ -319,7 +319,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, let expected_nargs = n + 1u; // n conversions + the fmt string if expected_nargs < nargs { cx.span_fatal - (sp, fmt!("too many arguments to fmt!. found %u, expected %u", + (sp, format!("too many arguments to fmt!. found {}, expected {}", nargs, expected_nargs)); } diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index ef3879f56aec9..a9e5318db4042 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -51,7 +51,7 @@ struct Context { impl Context { /// Parses the arguments from the given list of tokens, returning None if - /// there's a parse error so we can continue parsing other fmt! expressions. + /// there's a parse error so we can continue parsing other format! expressions. fn parse_args(&mut self, sp: Span, tts: &[ast::token_tree]) -> (@ast::Expr, Option<@ast::Expr>) { let p = rsparse::new_parser_from_tts(self.ecx.parse_sess(), @@ -92,8 +92,8 @@ impl Context { } _ => { self.ecx.span_err(*p.span, - fmt!("expected ident for named \ - argument, but found `%s`", + format!("expected ident for named \ + argument, but found `{}`", p.this_token_to_str())); return (extra, None); } @@ -104,8 +104,8 @@ impl Context { match self.names.find(&name) { None => {} Some(prev) => { - self.ecx.span_err(e.span, fmt!("duplicate argument \ - named `%s`", name)); + self.ecx.span_err(e.span, format!("duplicate argument \ + named `{}`", name)); self.ecx.parse_sess.span_diagnostic.span_note( prev.span, "previously here"); loop @@ -207,13 +207,13 @@ impl Context { match arm.selector { Left(name) => { self.ecx.span_err(self.fmtsp, - fmt!("duplicate selector \ - `%?`", name)); + format!("duplicate selector \ + `{:?}`", name)); } Right(idx) => { self.ecx.span_err(self.fmtsp, - fmt!("duplicate selector \ - `=%u`", idx)); + format!("duplicate selector \ + `={}`", idx)); } } } @@ -227,7 +227,7 @@ impl Context { for arm in arms.iter() { if !seen_cases.insert(arm.selector) { self.ecx.span_err(self.fmtsp, - fmt!("duplicate selector `%s`", + format!("duplicate selector `{}`", arm.selector)); } else if arm.selector == "" { self.ecx.span_err(self.fmtsp, @@ -245,8 +245,8 @@ impl Context { match arg { Left(arg) => { if arg < 0 || self.args.len() <= arg { - let msg = fmt!("invalid reference to argument `%u` (there \ - are %u arguments)", arg, self.args.len()); + let msg = format!("invalid reference to argument `{}` (there \ + are {} arguments)", arg, self.args.len()); self.ecx.span_err(self.fmtsp, msg); return; } @@ -260,7 +260,7 @@ impl Context { let span = match self.names.find(&name) { Some(e) => e.span, None => { - let msg = fmt!("there is no argument named `%s`", name); + let msg = format!("there is no argument named `{}`", name); self.ecx.span_err(self.fmtsp, msg); return; } @@ -298,20 +298,20 @@ impl Context { match (cur, ty) { (Known(cur), Known(ty)) => { self.ecx.span_err(sp, - fmt!("argument redeclared with type `%s` when \ - it was previously `%s`", ty, cur)); + format!("argument redeclared with type `{}` when \ + it was previously `{}`", ty, cur)); } (Known(cur), _) => { self.ecx.span_err(sp, - fmt!("argument used to format with `%s` was \ - attempted to not be used for formatting", - cur)); + format!("argument used to format with `{}` was \ + attempted to not be used for formatting", + cur)); } (_, Known(ty)) => { self.ecx.span_err(sp, - fmt!("argument previously used as a format \ - argument attempted to be used as `%s`", - ty)); + format!("argument previously used as a format \ + argument attempted to be used as `{}`", + ty)); } (_, _) => { self.ecx.span_err(sp, "argument declared with multiple formats"); @@ -405,7 +405,7 @@ impl Context { }).collect(); let (lr, selarg) = match arm.selector { Left(t) => { - let p = ctpath(fmt!("%?", t)); + let p = ctpath(format!("{:?}", t)); let p = self.ecx.path_global(sp, p); (self.ecx.ident_of("Left"), self.ecx.expr_path(p)) @@ -444,7 +444,7 @@ impl Context { ~[] ), None); let st = ast::item_static(ty, ast::MutImmutable, method); - let static_name = self.ecx.ident_of(fmt!("__static_method_%u", + let static_name = self.ecx.ident_of(format!("__static_method_{}", self.method_statics.len())); // Flag these statics as `address_insignificant` so LLVM can // merge duplicate globals as much as possible (which we're @@ -538,7 +538,7 @@ impl Context { } } - /// Actually builds the expression which the ifmt! block will be expanded + /// Actually builds the expression which the iformat! block will be expanded /// to fn to_expr(&self, extra: @ast::Expr) -> @ast::Expr { let mut lets = ~[]; @@ -584,13 +584,13 @@ impl Context { // foo(bar(&1)) // the lifetime of `1` doesn't outlast the call to `bar`, so it's not // vald for the call to `foo`. To work around this all arguments to the - // fmt! string are shoved into locals. Furthermore, we shove the address + // format! string are shoved into locals. Furthermore, we shove the address // of each variable because we don't want to move out of the arguments // passed to this function. for (i, &e) in self.args.iter().enumerate() { if self.arg_types[i].is_none() { loop } // error already generated - let name = self.ecx.ident_of(fmt!("__arg%u", i)); + let name = self.ecx.ident_of(format!("__arg{}", i)); let e = self.ecx.expr_addr_of(e.span, e); lets.push(self.ecx.stmt_let(e.span, false, name, e)); locals.push(self.format_arg(e.span, Left(i), @@ -599,7 +599,7 @@ impl Context { for (&name, &e) in self.names.iter() { if !self.name_types.contains_key(&name) { loop } - let lname = self.ecx.ident_of(fmt!("__arg%s", name)); + let lname = self.ecx.ident_of(format!("__arg{}", name)); let e = self.ecx.expr_addr_of(e.span, e); lets.push(self.ecx.stmt_let(e.span, false, lname, e)); names[*self.name_positions.get(&name)] = @@ -662,8 +662,8 @@ impl Context { "x" => "LowerHex", "X" => "UpperHex", _ => { - self.ecx.span_err(sp, fmt!("unknown format trait \ - `%s`", tyname)); + self.ecx.span_err(sp, format!("unknown format trait \ + `{}`", tyname)); "Dummy" } } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 6527b083cc1b6..24a5f9d5e3c87 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -255,8 +255,8 @@ pub mod rt { match res { Some(ast) => ast, None => { - error!("Parse error with ```\n%s\n```", s); - fail!() + error2!("Parse error with ```\n{}\n```", s); + fail2!() } } } @@ -484,7 +484,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { ~[mk_ident(cx, sp, ident)]); } - INTERPOLATED(_) => fail!("quote! with interpolated token"), + INTERPOLATED(_) => fail2!("quote! with interpolated token"), _ => () } @@ -522,7 +522,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { DOLLAR => "DOLLAR", UNDERSCORE => "UNDERSCORE", EOF => "EOF", - _ => fail!() + _ => fail2!() }; cx.expr_ident(sp, id_ext(name)) } @@ -547,7 +547,7 @@ fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree) } ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts), - ast::tt_seq(*) => fail!("tt_seq in quote!"), + ast::tt_seq(*) => fail2!("tt_seq in quote!"), ast::tt_nonterminal(sp, ident) => { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index aa4183837e3b3..7db64feb80985 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -122,7 +122,7 @@ pub struct MatcherPos { pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos { match *mpu { matcher_pos_up(Some(ref mp)) => (*mp).clone(), - _ => fail!() + _ => fail2!() } } @@ -384,14 +384,14 @@ pub fn parse( let nts = bb_eis.map(|ei| { match ei.elts[ei.idx].node { match_nonterminal(ref bind,ref name,_) => { - fmt!("%s ('%s')", ident_to_str(name), + format!("{} ('{}')", ident_to_str(name), ident_to_str(bind)) } - _ => fail!() + _ => fail2!() } }).connect(" or "); - return error(sp, fmt!( + return error(sp, format!( "Local ambiguity: multiple parsing options: \ - built-in NTs %s or %u other options.", + built-in NTs {} or {} other options.", nts, next_eis.len())); } else if (bb_eis.len() == 0u && next_eis.len() == 0u) { return failure(sp, ~"No rules expected the token: " @@ -412,7 +412,7 @@ pub fn parse( parse_nt(&rust_parser, ident_to_str(name)))); ei.idx += 1u; } - _ => fail!() + _ => fail2!() } cur_eis.push(ei); diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 8a858f3d9858f..f8d48d00db918 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -117,7 +117,7 @@ fn lookup_cur_matched(r: &mut TtReader, name: Ident) -> @named_match { match r.interpolations.find_copy(&name) { Some(s) => lookup_cur_matched_by_matched(r, s), None => { - r.sp_diag.span_fatal(r.cur_span, fmt!("unknown macro variable `%s`", + r.sp_diag.span_fatal(r.cur_span, format!("unknown macro variable `{}`", ident_to_str(&name))); } } @@ -142,9 +142,9 @@ fn lockstep_iter_size(t: &token_tree, r: &mut TtReader) -> lis { lis_constraint(r_len, ref r_id) => { let l_n = ident_to_str(l_id); let r_n = ident_to_str(r_id); - lis_contradiction(fmt!("Inconsistent lockstep iteration: \ - '%s' has %u items, but '%s' has %u", - l_n, l_len, r_n, r_len)) + lis_contradiction(format!("Inconsistent lockstep iteration: \ + '{}' has {} items, but '{}' has {}", + l_n, l_len, r_n, r_len)) } } } @@ -294,7 +294,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { matched_seq(*) => { r.sp_diag.span_fatal( r.cur_span, /* blame the macro writer */ - fmt!("variable '%s' is still repeating at this depth", + format!("variable '{}' is still repeating at this depth", ident_to_str(&ident))); } } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index b823ff726ac29..909f5e5c4434a 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -892,7 +892,7 @@ mod test { let a_val = $a; let b_val = $b; if !(pred_val(a_val,b_val)) { - fail!("expected args satisfying %s, got %? and %?", + fail2!("expected args satisfying {}, got {:?} and {:?}", $predname, a_val, b_val); } } diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 46940d2d4daed..ca93cbaea39e0 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -66,7 +66,7 @@ impl OptVec { pub fn get<'a>(&'a self, i: uint) -> &'a T { match *self { - Empty => fail!("Invalid index %u", i), + Empty => fail2!("Invalid index {}", i), Vec(ref v) => &v[i] } } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 1bc334f1140b9..dba2f0b941717 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -32,7 +32,7 @@ impl parser_attr for Parser { fn parse_outer_attributes(&self) -> ~[ast::Attribute] { let mut attrs: ~[ast::Attribute] = ~[]; loop { - debug!("parse_outer_attributes: self.token=%?", + debug2!("parse_outer_attributes: self.token={:?}", self.token); match *self.token { token::INTERPOLATED(token::nt_attr(*)) => { @@ -67,7 +67,7 @@ impl parser_attr for Parser { // if permit_inner is true, then a trailing `;` indicates an inner // attribute fn parse_attribute(&self, permit_inner: bool) -> ast::Attribute { - debug!("parse_attributes: permit_inner=%? self.token=%?", + debug2!("parse_attributes: permit_inner={:?} self.token={:?}", permit_inner, self.token); let (span, value) = match *self.token { INTERPOLATED(token::nt_attr(attr)) => { @@ -85,8 +85,8 @@ impl parser_attr for Parser { (mk_sp(lo, hi), meta_item) } _ => { - self.fatal(fmt!("expected `#` but found `%s`", - self.this_token_to_str())); + self.fatal(format!("expected `\\#` but found `{}`", + self.this_token_to_str())); } }; let style = if permit_inner && *self.token == token::SEMI { diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 88c9fc3e0f792..f163bec7d4eef 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -134,7 +134,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { return lines.connect("\n"); } - fail!("not a doc-comment: %s", comment); + fail2!("not a doc-comment: {}", comment); } fn read_to_eol(rdr: @mut StringReader) -> ~str { @@ -161,7 +161,7 @@ fn consume_non_eol_whitespace(rdr: @mut StringReader) { } fn push_blank_line_comment(rdr: @mut StringReader, comments: &mut ~[cmnt]) { - debug!(">>> blank-line comment"); + debug2!(">>> blank-line comment"); let v: ~[~str] = ~[]; comments.push(cmnt {style: blank_line, lines: v, pos: rdr.last_pos}); } @@ -179,9 +179,9 @@ fn consume_whitespace_counting_blank_lines(rdr: @mut StringReader, fn read_shebang_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug!(">>> shebang comment"); + debug2!(">>> shebang comment"); let p = rdr.last_pos; - debug!("<<< shebang comment"); + debug2!("<<< shebang comment"); comments.push(cmnt { style: if code_to_the_left { trailing } else { isolated }, lines: ~[read_one_line_comment(rdr)], @@ -191,19 +191,19 @@ fn read_shebang_comment(rdr: @mut StringReader, code_to_the_left: bool, fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug!(">>> line comments"); + debug2!(">>> line comments"); let p = rdr.last_pos; let mut lines: ~[~str] = ~[]; while rdr.curr == '/' && nextch(rdr) == '/' { let line = read_one_line_comment(rdr); - debug!("%s", line); + debug2!("{}", line); if is_doc_comment(line) { // doc-comments are not put in comments break; } lines.push(line); consume_non_eol_whitespace(rdr); } - debug!("<<< line comments"); + debug2!("<<< line comments"); if !lines.is_empty() { comments.push(cmnt { style: if code_to_the_left { trailing } else { isolated }, @@ -242,14 +242,14 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str], } None => s, }; - debug!("pushing line: %s", s1); + debug2!("pushing line: {}", s1); lines.push(s1); } fn read_block_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug!(">>> block comment"); + debug2!(">>> block comment"); let p = rdr.last_pos; let mut lines: ~[~str] = ~[]; let col: CharPos = rdr.col; @@ -275,7 +275,7 @@ fn read_block_comment(rdr: @mut StringReader, } else { let mut level: int = 1; while level > 0 { - debug!("=== block comment level %d", level); + debug2!("=== block comment level {}", level); if is_eof(rdr) { (rdr as @mut reader).fatal(~"unterminated block comment"); } @@ -311,7 +311,7 @@ fn read_block_comment(rdr: @mut StringReader, if !is_eof(rdr) && rdr.curr != '\n' && lines.len() == 1u { style = mixed; } - debug!("<<< block comment"); + debug2!("<<< block comment"); comments.push(cmnt {style: style, lines: lines, pos: p}); } @@ -324,15 +324,15 @@ fn peeking_at_comment(rdr: @mut StringReader) -> bool { fn consume_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug!(">>> consume comment"); + debug2!(">>> consume comment"); if rdr.curr == '/' && nextch(rdr) == '/' { read_line_comments(rdr, code_to_the_left, comments); } else if rdr.curr == '/' && nextch(rdr) == '*' { read_block_comment(rdr, code_to_the_left, comments); } else if rdr.curr == '#' && nextch(rdr) == '!' { read_shebang_comment(rdr, code_to_the_left, comments); - } else { fail!(); } - debug!("<<< consume comment"); + } else { fail2!(); } + debug2!("<<< consume comment"); } #[deriving(Clone)] @@ -378,11 +378,11 @@ pub fn gather_comments_and_literals(span_diagnostic: let TokenAndSpan {tok: tok, sp: sp} = rdr.peek(); if token::is_lit(&tok) { do with_str_from(rdr, bstart) |s| { - debug!("tok lit: %s", s); + debug2!("tok lit: {}", s); literals.push(lit {lit: s.to_owned(), pos: sp.lo}); } } else { - debug!("tok: %s", token::to_str(get_ident_interner(), &tok)); + debug2!("tok: {}", token::to_str(get_ident_interner(), &tok)); } first_read = false; } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 09adcc66ea535..640c7c220e5e2 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -133,7 +133,7 @@ impl reader for TtReader { fn is_eof(@mut self) -> bool { self.cur_tok == token::EOF } fn next_token(@mut self) -> TokenAndSpan { let r = tt_next_token(self); - debug!("TtReader: r=%?", r); + debug2!("TtReader: r={:?}", r); return r; } fn fatal(@mut self, m: ~str) -> ! { @@ -261,7 +261,7 @@ fn hex_digit_val(c: char) -> int { if in_range(c, '0', '9') { return (c as int) - ('0' as int); } if in_range(c, 'a', 'f') { return (c as int) - ('a' as int) + 10; } if in_range(c, 'A', 'F') { return (c as int) - ('A' as int) + 10; } - fail!(); + fail2!(); } fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; } @@ -569,8 +569,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token { ~"int literal is too large") }; - debug!("lexing %s as an unsuffixed integer literal", - num_str); + debug2!("lexing {} as an unsuffixed integer literal", num_str); return token::LIT_INT_UNSUFFIXED(parsed as i64); } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index a492a2283e3a3..67bcab319562e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -416,18 +416,18 @@ mod test { _ => assert_eq!("wrong 4","correct") }, _ => { - error!("failing value 3: %?",first_set); + error2!("failing value 3: {:?}",first_set); assert_eq!("wrong 3","correct") } }, _ => { - error!("failing value 2: %?",delim_elts); + error2!("failing value 2: {:?}",delim_elts); assert_eq!("wrong","correct"); } }, _ => { - error!("failing value: %?",tts); + error2!("failing value: {:?}",tts); assert_eq!("wrong 1","correct"); } } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 66774cb275bdd..adf0c208da4df 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -261,10 +261,10 @@ impl ParserObsoleteMethods for Parser { kind: ObsoleteSyntax, kind_str: &str, desc: &str) { - self.span_err(sp, fmt!("obsolete syntax: %s", kind_str)); + self.span_err(sp, format!("obsolete syntax: {}", kind_str)); if !self.obsolete_set.contains(&kind) { - self.sess.span_diagnostic.handler().note(fmt!("%s", desc)); + self.sess.span_diagnostic.handler().note(format!("{}", desc)); self.obsolete_set.insert(kind); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5a68e32a5332c..4dd09cbcbd2f9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -362,8 +362,8 @@ impl Parser { pub fn unexpected_last(&self, t: &token::Token) -> ! { self.span_fatal( *self.last_span, - fmt!( - "unexpected token: `%s`", + format!( + "unexpected token: `{}`", self.token_to_str(t) ) ); @@ -371,8 +371,8 @@ impl Parser { pub fn unexpected(&self) -> ! { self.fatal( - fmt!( - "unexpected token: `%s`", + format!( + "unexpected token: `{}`", self.this_token_to_str() ) ); @@ -385,8 +385,8 @@ impl Parser { self.bump(); } else { self.fatal( - fmt!( - "expected `%s` but found `%s`", + format!( + "expected `{}` but found `{}`", self.token_to_str(t), self.this_token_to_str() ) @@ -414,9 +414,9 @@ impl Parser { let actual = self.this_token_to_str(); self.fatal( if expected.len() != 1 { - fmt!("expected one of `%s` but found `%s`", expect, actual) + format!("expected one of `{}` but found `{}`", expect, actual) } else { - fmt!("expected `%s` but found `%s`", expect, actual) + format!("expected `{}` but found `{}`", expect, actual) } ) } @@ -444,7 +444,7 @@ impl Parser { // followed by some token from the set edible + inedible. Recover // from anticipated input errors, discarding erroneous characters. pub fn commit_expr(&self, e: @Expr, edible: &[token::Token], inedible: &[token::Token]) { - debug!("commit_expr %?", e); + debug2!("commit_expr {:?}", e); match e.node { ExprPath(*) => { // might be unit-struct construction; check for recoverableinput error. @@ -464,7 +464,7 @@ impl Parser { // followed by some token from the set edible + inedible. Check // for recoverable input errors, discarding erroneous characters. pub fn commit_stmt(&self, s: @Stmt, edible: &[token::Token], inedible: &[token::Token]) { - debug!("commit_stmt %?", s); + debug2!("commit_stmt {:?}", s); let _s = s; // unused, but future checks might want to inspect `s`. if self.last_token.map_default(false, |t|is_ident_or_path(*t)) { let expected = vec::append(edible.to_owned(), inedible); @@ -490,8 +490,8 @@ impl Parser { } _ => { self.fatal( - fmt!( - "expected ident, found `%s`", + format!( + "expected ident, found `{}`", self.this_token_to_str() ) ); @@ -536,8 +536,8 @@ impl Parser { pub fn expect_keyword(&self, kw: keywords::Keyword) { if !self.eat_keyword(kw) { self.fatal( - fmt!( - "expected `%s`, found `%s`", + format!( + "expected `{}`, found `{}`", self.id_to_str(kw.to_ident()).to_str(), self.this_token_to_str() ) @@ -549,14 +549,14 @@ impl Parser { pub fn check_strict_keywords(&self) { if token::is_strict_keyword(self.token) { self.span_err(*self.last_span, - fmt!("found `%s` in ident position", self.this_token_to_str())); + format!("found `{}` in ident position", self.this_token_to_str())); } } // signal an error if the current token is a reserved keyword pub fn check_reserved_keywords(&self) { if token::is_reserved_keyword(self.token) { - self.fatal(fmt!("`%s` is a reserved keyword", self.this_token_to_str())); + self.fatal(format!("`{}` is a reserved keyword", self.this_token_to_str())); } } @@ -571,7 +571,7 @@ impl Parser { self.span.lo + BytePos(1u), self.span.hi ), - _ => self.fatal(fmt!("expected `%s`, found `%s`", + _ => self.fatal(format!("expected `{}`, found `{}`", self.token_to_str(&token::GT), self.this_token_to_str())) } @@ -938,13 +938,13 @@ impl Parser { }; let hi = p.last_span.hi; - debug!("parse_trait_methods(): trait method signature ends in \ - `%s`", + debug2!("parse_trait_methods(): trait method signature ends in \ + `{}`", self.this_token_to_str()); match *p.token { token::SEMI => { p.bump(); - debug!("parse_trait_methods(): parsing required method"); + debug2!("parse_trait_methods(): parsing required method"); // NB: at the moment, visibility annotations on required // methods are ignored; this could change. if vis != ast::inherited { @@ -963,7 +963,7 @@ impl Parser { }) } token::LBRACE => { - debug!("parse_trait_methods(): parsing provided method"); + debug2!("parse_trait_methods(): parsing provided method"); let (inner_attrs, body) = p.parse_inner_attrs_and_block(); let attrs = vec::append(attrs, inner_attrs); @@ -984,8 +984,8 @@ impl Parser { _ => { p.fatal( - fmt!( - "expected `;` or `{` but found `%s`", + format!( + "expected `;` or `\\{` but found `{}`", self.this_token_to_str() ) ); @@ -1153,8 +1153,7 @@ impl Parser { } = self.parse_path(LifetimeAndTypesAndBounds); ty_path(path, bounds, ast::DUMMY_NODE_ID) } else { - self.fatal(fmt!("expected type, found token %?", - *self.token)); + self.fatal(format!("expected type, found token {:?}", *self.token)); }; let sp = mk_sp(lo, self.last_span.hi); @@ -1245,7 +1244,7 @@ impl Parser { _ => 0 }; - debug!("parser is_named_argument offset:%u", offset); + debug2!("parser is_named_argument offset:{}", offset); if offset == 0 { is_plain_ident_or_underscore(&*self.token) @@ -1261,7 +1260,7 @@ impl Parser { pub fn parse_arg_general(&self, require_name: bool) -> arg { let is_mutbl = self.eat_keyword(keywords::Mut); let pat = if require_name || self.is_named_argument() { - debug!("parse_arg_general parse_pat (require_name:%?)", + debug2!("parse_arg_general parse_pat (require_name:{:?})", require_name); self.parse_arg_mode(); let pat = self.parse_pat(); @@ -1273,7 +1272,7 @@ impl Parser { self.expect(&token::COLON); pat } else { - debug!("parse_arg_general ident_to_pat"); + debug2!("parse_arg_general ident_to_pat"); ast_util::ident_to_pat(ast::DUMMY_NODE_ID, *self.last_span, special_idents::invalid) @@ -1581,7 +1580,7 @@ impl Parser { } _ => { - self.fatal(fmt!("Expected a lifetime name")); + self.fatal(format!("Expected a lifetime name")); } } } @@ -1614,7 +1613,7 @@ impl Parser { token::GT => { return res; } token::BINOP(token::SHR) => { return res; } _ => { - self.fatal(fmt!("expected `,` or `>` after lifetime name, got: %?", + self.fatal(format!("expected `,` or `>` after lifetime name, got: {:?}", *self.token)); } } @@ -2067,8 +2066,8 @@ impl Parser { token::RPAREN | token::RBRACE | token::RBRACKET => { p.fatal( - fmt!( - "incorrect close delimiter: `%s`", + format!( + "incorrect close delimiter: `{}`", p.this_token_to_str() ) ); @@ -2561,10 +2560,10 @@ impl Parser { // There may be other types of expressions that can // represent the callee in `for` and `do` expressions // but they aren't represented by tests - debug!("sugary call on %?", e.node); + debug2!("sugary call on {:?}", e.node); self.span_fatal( e.span, - fmt!("`%s` must be followed by a block call", keyword)); + format!("`{}` must be followed by a block call", keyword)); } } } @@ -2759,8 +2758,8 @@ impl Parser { self.bump(); if *self.token != token::RBRACE { self.fatal( - fmt!( - "expected `}`, found `%s`", + format!( + "expected `\\}`, found `{}`", self.this_token_to_str() ) ); @@ -3543,8 +3542,8 @@ impl Parser { fn expect_self_ident(&self) { if !self.is_self_ident() { self.fatal( - fmt!( - "expected `self` but found `%s`", + format!( + "expected `self` but found `{}`", self.this_token_to_str() ) ); @@ -3682,8 +3681,8 @@ impl Parser { } _ => { self.fatal( - fmt!( - "expected `,` or `)`, found `%s`", + format!( + "expected `,` or `)`, found `{}`", self.this_token_to_str() ) ); @@ -3920,7 +3919,7 @@ impl Parser { } } if fields.len() == 0 { - self.fatal(fmt!("Unit-like struct definition should be written as `struct %s;`", + self.fatal(format!("Unit-like struct definition should be written as `struct {};`", get_ident_interner().get(class_name.name))); } self.bump(); @@ -3949,9 +3948,9 @@ impl Parser { fields = ~[]; } else { self.fatal( - fmt!( - "expected `{`, `(`, or `;` after struct name \ - but found `%s`", + format!( + "expected `\\{`, `(`, or `;` after struct name \ + but found `{}`", self.this_token_to_str() ) ); @@ -3995,7 +3994,7 @@ impl Parser { token::RBRACE => {} _ => { self.span_fatal(*self.span, - fmt!("expected `,`, or '}' but found `%s`", + format!("expected `,`, or '\\}' but found `{}`", self.this_token_to_str())); } } @@ -4064,7 +4063,7 @@ impl Parser { attrs = attrs_remaining + attrs; first = false; } - debug!("parse_mod_items: parse_item_or_view_item(attrs=%?)", + debug2!("parse_mod_items: parse_item_or_view_item(attrs={:?})", attrs); match self.parse_item_or_view_item(attrs, true /* macros allowed */) { @@ -4075,7 +4074,7 @@ impl Parser { the module"); } _ => { - self.fatal(fmt!("expected item but found `%s`", + self.fatal(format!("expected item but found `{}`", self.this_token_to_str())); } } @@ -4167,11 +4166,11 @@ impl Parser { (true, false) => default_path, (false, true) => secondary_path, (false, false) => { - self.span_fatal(id_sp, fmt!("file not found for module `%s`", mod_name)); + self.span_fatal(id_sp, format!("file not found for module `{}`", mod_name)); } (true, true) => { self.span_fatal(id_sp, - fmt!("file for module `%s` found at both %s and %s", + format!("file for module `{}` found at both {} and {}", mod_name, default_path_str, secondary_path_str)); } } @@ -4323,7 +4322,7 @@ impl Parser { self.expect_keyword(keywords::Mod); } else if *self.token != token::LBRACE { self.span_fatal(*self.span, - fmt!("expected `{` or `mod` but found `%s`", + format!("expected `\\{` or `mod` but found `{}`", self.this_token_to_str())); } @@ -4340,8 +4339,8 @@ impl Parser { _ => { if must_be_named_mod { self.span_fatal(*self.span, - fmt!("expected foreign module name but \ - found `%s`", + format!("expected foreign module name but \ + found `{}`", self.this_token_to_str())); } @@ -4566,7 +4565,7 @@ impl Parser { if abis.contains(abi) { self.span_err( *self.span, - fmt!("ABI `%s` appears twice", + format!("ABI `{}` appears twice", word)); } else { abis.add(abi); @@ -4576,9 +4575,9 @@ impl Parser { None => { self.span_err( *self.span, - fmt!("illegal ABI: \ - expected one of [%s], \ - found `%s`", + format!("illegal ABI: \ + expected one of [{}], \ + found `{}`", abi::all_names().connect(", "), word)); } @@ -4853,7 +4852,7 @@ impl Parser { let first_ident = self.parse_ident(); let mut path = ~[first_ident]; - debug!("parsed view_path: %s", self.id_to_str(first_ident)); + debug2!("parsed view_path: {}", self.id_to_str(first_ident)); match *self.token { token::EQ => { // x = foo::bar @@ -5061,7 +5060,7 @@ impl Parser { break; } iovi_foreign_item(_) => { - fail!(); + fail2!(); } } attrs = self.parse_outer_attributes(); @@ -5084,7 +5083,7 @@ impl Parser { items.push(item) } iovi_foreign_item(_) => { - fail!(); + fail2!(); } } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index eec4a81b2cfeb..d0faf917688d7 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -193,11 +193,11 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str { } body } - LIT_STR(ref s) => { fmt!("\"%s\"", ident_to_str(s).escape_default()) } + LIT_STR(ref s) => { format!("\"{}\"", ident_to_str(s).escape_default()) } /* Name components */ IDENT(s, _) => input.get(s.name).to_owned(), - LIFETIME(s) => fmt!("'%s", input.get(s.name)), + LIFETIME(s) => format!("'{}", input.get(s.name)), UNDERSCORE => ~"_", /* Other */ @@ -214,8 +214,8 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str { nt_block(*) => ~"block", nt_stmt(*) => ~"statement", nt_pat(*) => ~"pattern", - nt_attr(*) => fail!("should have been handled"), - nt_expr(*) => fail!("should have been handled above"), + nt_attr(*) => fail2!("should have been handled"), + nt_expr(*) => fail2!("should have been handled above"), nt_ty(*) => ~"type", nt_ident(*) => ~"identifier", nt_path(*) => ~"path", @@ -269,7 +269,7 @@ pub fn flip_delimiter(t: &token::Token) -> token::Token { RPAREN => LPAREN, RBRACE => LBRACE, RBRACKET => LBRACKET, - _ => fail!() + _ => fail2!() } } @@ -553,7 +553,7 @@ pub fn fresh_name(src : &ast::Ident) -> Name { // good error messages and uses of struct names in ambiguous could-be-binding // locations. Also definitely destroys the guarantee given above about ptr_eq. /*let num = rand::rng().gen_uint_range(0,0xffff); - gensym(fmt!("%s_%u",ident_to_str(src),num))*/ + gensym(format!("{}_{}",ident_to_str(src),num))*/ } // it looks like there oughta be a str_ptr_eq fn, but no one bothered to implement it? diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 615f33013736f..58d73ad687c49 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -111,7 +111,7 @@ impl token { pub fn tok_str(t: token) -> ~str { match t { - STRING(s, len) => return fmt!("STR(%s,%d)", s, len), + STRING(s, len) => return format!("STR({},{})", s, len), BREAK(_) => return ~"BREAK", BEGIN(_) => return ~"BEGIN", END => return ~"END", @@ -131,7 +131,7 @@ pub fn buf_str(toks: ~[token], szs: ~[int], left: uint, right: uint, if i != left { s.push_str(", "); } - s.push_str(fmt!("%d=%s", szs[i], tok_str(toks[i]))); + s.push_str(format!("{}={}", szs[i], tok_str(toks[i]))); i += 1u; i %= n; } @@ -152,7 +152,7 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { // Yes 3, it makes the ring buffers big enough to never // fall behind. let n: uint = 3 * linewidth; - debug!("mk_printer %u", linewidth); + debug2!("mk_printer {}", linewidth); let token: ~[token] = vec::from_elem(n, EOF); let size: ~[int] = vec::from_elem(n, 0); let scan_stack: ~[uint] = vec::from_elem(n, 0u); @@ -288,7 +288,7 @@ impl Printer { self.token[self.right] = t; } pub fn pretty_print(&mut self, t: token) { - debug!("pp ~[%u,%u]", self.left, self.right); + debug2!("pp ~[{},{}]", self.left, self.right); match t { EOF => { if !self.scan_stack_empty { @@ -305,7 +305,7 @@ impl Printer { self.left = 0u; self.right = 0u; } else { self.advance_right(); } - debug!("pp BEGIN(%d)/buffer ~[%u,%u]", + debug2!("pp BEGIN({})/buffer ~[{},{}]", b.offset, self.left, self.right); self.token[self.right] = t; self.size[self.right] = -self.right_total; @@ -313,10 +313,10 @@ impl Printer { } END => { if self.scan_stack_empty { - debug!("pp END/print ~[%u,%u]", self.left, self.right); + debug2!("pp END/print ~[{},{}]", self.left, self.right); self.print(t, 0); } else { - debug!("pp END/buffer ~[%u,%u]", self.left, self.right); + debug2!("pp END/buffer ~[{},{}]", self.left, self.right); self.advance_right(); self.token[self.right] = t; self.size[self.right] = -1; @@ -330,7 +330,7 @@ impl Printer { self.left = 0u; self.right = 0u; } else { self.advance_right(); } - debug!("pp BREAK(%d)/buffer ~[%u,%u]", + debug2!("pp BREAK({})/buffer ~[{},{}]", b.offset, self.left, self.right); self.check_stack(0); self.scan_push(self.right); @@ -340,11 +340,11 @@ impl Printer { } STRING(s, len) => { if self.scan_stack_empty { - debug!("pp STRING('%s')/print ~[%u,%u]", + debug2!("pp STRING('{}')/print ~[{},{}]", s, self.left, self.right); self.print(t, len); } else { - debug!("pp STRING('%s')/buffer ~[%u,%u]", + debug2!("pp STRING('{}')/buffer ~[{},{}]", s, self.left, self.right); self.advance_right(); self.token[self.right] = t; @@ -356,14 +356,14 @@ impl Printer { } } pub fn check_stream(&mut self) { - debug!("check_stream ~[%u, %u] with left_total=%d, right_total=%d", + debug2!("check_stream ~[{}, {}] with left_total={}, right_total={}", self.left, self.right, self.left_total, self.right_total); if self.right_total - self.left_total > self.space { - debug!("scan window is %d, longer than space on line (%d)", + debug2!("scan window is {}, longer than space on line ({})", self.right_total - self.left_total, self.space); if !self.scan_stack_empty { if self.left == self.scan_stack[self.bottom] { - debug!("setting %u to infinity and popping", self.left); + debug2!("setting {} to infinity and popping", self.left); self.size[self.scan_pop_bottom()] = size_infinity; } } @@ -372,7 +372,7 @@ impl Printer { } } pub fn scan_push(&mut self, x: uint) { - debug!("scan_push %u", x); + debug2!("scan_push {}", x); if self.scan_stack_empty { self.scan_stack_empty = false; } else { @@ -408,7 +408,7 @@ impl Printer { assert!((self.right != self.left)); } pub fn advance_left(&mut self, x: token, L: int) { - debug!("advnce_left ~[%u,%u], sizeof(%u)=%d", self.left, self.right, + debug2!("advnce_left ~[{},{}], sizeof({})={}", self.left, self.right, self.left, L); if L >= 0 { self.print(x, L); @@ -451,13 +451,13 @@ impl Printer { } } pub fn print_newline(&mut self, amount: int) { - debug!("NEWLINE %d", amount); + debug2!("NEWLINE {}", amount); (*self.out).write_str("\n"); self.pending_indentation = 0; self.indent(amount); } pub fn indent(&mut self, amount: int) { - debug!("INDENT %d", amount); + debug2!("INDENT {}", amount); self.pending_indentation += amount; } pub fn get_top(&mut self) -> print_stack_elt { @@ -480,9 +480,9 @@ impl Printer { (*self.out).write_str(s); } pub fn print(&mut self, x: token, L: int) { - debug!("print %s %d (remaining line space=%d)", tok_str(x), L, + debug2!("print {} {} (remaining line space={})", tok_str(x), L, self.space); - debug!("%s", buf_str(self.token.clone(), + debug2!("{}", buf_str(self.token.clone(), self.size.clone(), self.left, self.right, @@ -491,13 +491,13 @@ impl Printer { BEGIN(b) => { if L > self.space { let col = self.margin - self.space + b.offset; - debug!("print BEGIN -> push broken block at col %d", col); + debug2!("print BEGIN -> push broken block at col {}", col); self.print_stack.push(print_stack_elt { offset: col, pbreak: broken(b.breaks) }); } else { - debug!("print BEGIN -> push fitting block"); + debug2!("print BEGIN -> push fitting block"); self.print_stack.push(print_stack_elt { offset: 0, pbreak: fits @@ -505,7 +505,7 @@ impl Printer { } } END => { - debug!("print END -> pop END"); + debug2!("print END -> pop END"); let print_stack = &mut *self.print_stack; assert!((print_stack.len() != 0u)); print_stack.pop(); @@ -514,24 +514,24 @@ impl Printer { let top = self.get_top(); match top.pbreak { fits => { - debug!("print BREAK(%d) in fitting block", b.blank_space); + debug2!("print BREAK({}) in fitting block", b.blank_space); self.space -= b.blank_space; self.indent(b.blank_space); } broken(consistent) => { - debug!("print BREAK(%d+%d) in consistent block", + debug2!("print BREAK({}+{}) in consistent block", top.offset, b.offset); self.print_newline(top.offset + b.offset); self.space = self.margin - (top.offset + b.offset); } broken(inconsistent) => { if L > self.space { - debug!("print BREAK(%d+%d) w/ newline in inconsistent", + debug2!("print BREAK({}+{}) w/ newline in inconsistent", top.offset, b.offset); self.print_newline(top.offset + b.offset); self.space = self.margin - (top.offset + b.offset); } else { - debug!("print BREAK(%d) w/o newline in inconsistent", + debug2!("print BREAK({}) w/o newline in inconsistent", b.blank_space); self.indent(b.blank_space); self.space -= b.blank_space; @@ -540,7 +540,7 @@ impl Printer { } } STRING(s, len) => { - debug!("print STRING(%s)", s); + debug2!("print STRING({})", s); assert_eq!(L, len); // assert!(L <= space); self.space -= len; @@ -548,7 +548,7 @@ impl Printer { } EOF => { // EOF should never get here. - fail!(); + fail2!(); } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index dee8d710a73ad..bc1a472120742 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -453,10 +453,10 @@ pub fn print_type(s: @ps, ty: &ast::Ty) { word(s.s, ")"); } ast::ty_mac(_) => { - fail!("print_type doesn't know how to print a ty_mac"); + fail2!("print_type doesn't know how to print a ty_mac"); } ast::ty_infer => { - fail!("print_type shouldn't see a ty_infer"); + fail2!("print_type shouldn't see a ty_infer"); } } @@ -709,7 +709,7 @@ pub fn print_struct(s: @ps, popen(s); do commasep(s, inconsistent, struct_def.fields) |s, field| { match field.node.kind { - ast::named_field(*) => fail!("unexpected named field"), + ast::named_field(*) => fail2!("unexpected named field"), ast::unnamed_field => { maybe_print_comment(s, field.span.lo); print_type(s, &field.node.ty); @@ -728,7 +728,7 @@ pub fn print_struct(s: @ps, for field in struct_def.fields.iter() { match field.node.kind { - ast::unnamed_field => fail!("unexpected unnamed field"), + ast::unnamed_field => fail2!("unexpected unnamed field"), ast::named_field(ident, visibility) => { hardbreak_if_not_bol(s); maybe_print_comment(s, field.span.lo); @@ -1017,7 +1017,7 @@ pub fn print_if(s: @ps, test: &ast::Expr, blk: &ast::Block, } // BLEAH, constraints would be great here _ => { - fail!("print_if saw if with weird alternative"); + fail2!("print_if saw if with weird alternative"); } } } @@ -1042,7 +1042,7 @@ pub fn print_mac(s: @ps, m: &ast::mac) { pub fn print_vstore(s: @ps, t: ast::Vstore) { match t { - ast::VstoreFixed(Some(i)) => word(s.s, fmt!("%u", i)), + ast::VstoreFixed(Some(i)) => word(s.s, format!("{}", i)), ast::VstoreFixed(None) => word(s.s, "_"), ast::VstoreUniq => word(s.s, "~"), ast::VstoreBox => word(s.s, "@"), @@ -1319,7 +1319,7 @@ pub fn print_expr(s: @ps, expr: &ast::Expr) { } end(s); // close enclosing cbox } - None => fail!() + None => fail2!() } } else { // the block will close the pattern's ibox @@ -2299,7 +2299,7 @@ mod test { fn string_check (given : &T, expected: &T) { if !(given == expected) { - fail!("given %?, expected %?", given, expected); + fail2!("given {:?}, expected {:?}", given, expected); } } From 1b80558be38226eb50e6f6d574d7f6ae7e727346 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 22:38:08 -0700 Subject: [PATCH 05/16] rustc: Remove usage of fmt! --- src/librustc/back/link.rs | 42 +- src/librustc/back/rpath.rs | 22 +- src/librustc/driver/driver.rs | 21 +- src/librustc/driver/session.rs | 2 +- src/librustc/front/test.rs | 12 +- src/librustc/lib/llvm.rs | 14 +- src/librustc/metadata/creader.rs | 20 +- src/librustc/metadata/csearch.rs | 10 +- src/librustc/metadata/cstore.rs | 6 +- src/librustc/metadata/decoder.rs | 54 +-- src/librustc/metadata/encoder.rs | 56 +-- src/librustc/metadata/filesearch.rs | 18 +- src/librustc/metadata/loader.rs | 30 +- src/librustc/metadata/tydecode.rs | 38 +- src/librustc/metadata/tyencode.rs | 12 +- src/librustc/middle/astencode.rs | 36 +- src/librustc/middle/borrowck/check_loans.rs | 58 +-- .../borrowck/gather_loans/gather_moves.rs | 6 +- .../middle/borrowck/gather_loans/lifetime.rs | 20 +- .../middle/borrowck/gather_loans/mod.rs | 28 +- src/librustc/middle/borrowck/mod.rs | 48 +- src/librustc/middle/borrowck/move_data.rs | 10 +- src/librustc/middle/cfg/construct.rs | 6 +- src/librustc/middle/check_const.rs | 4 +- src/librustc/middle/check_match.rs | 34 +- src/librustc/middle/dataflow.rs | 70 +-- src/librustc/middle/effect.rs | 10 +- src/librustc/middle/freevars.rs | 4 +- src/librustc/middle/graph.rs | 4 +- src/librustc/middle/kind.rs | 46 +- src/librustc/middle/lang_items.rs | 4 +- src/librustc/middle/lint.rs | 30 +- src/librustc/middle/liveness.rs | 78 ++-- src/librustc/middle/mem_categorization.rs | 30 +- src/librustc/middle/moves.rs | 24 +- src/librustc/middle/privacy.rs | 38 +- src/librustc/middle/reachable.rs | 12 +- src/librustc/middle/region.rs | 46 +- src/librustc/middle/resolve.rs | 416 +++++++++--------- src/librustc/middle/stack_check.rs | 10 +- src/librustc/middle/subst.rs | 4 +- src/librustc/middle/trans/_match.rs | 54 +-- src/librustc/middle/trans/adt.rs | 6 +- src/librustc/middle/trans/asm.rs | 6 +- src/librustc/middle/trans/base.rs | 84 ++-- src/librustc/middle/trans/build.rs | 4 +- src/librustc/middle/trans/builder.rs | 14 +- src/librustc/middle/trans/cabi_arm.rs | 4 +- src/librustc/middle/trans/cabi_mips.rs | 4 +- src/librustc/middle/trans/cabi_x86_64.rs | 8 +- src/librustc/middle/trans/callee.rs | 42 +- src/librustc/middle/trans/closure.rs | 14 +- src/librustc/middle/trans/common.rs | 36 +- src/librustc/middle/trans/consts.rs | 16 +- src/librustc/middle/trans/context.rs | 2 +- src/librustc/middle/trans/controlflow.rs | 4 +- src/librustc/middle/trans/datum.rs | 18 +- src/librustc/middle/trans/debuginfo.rs | 74 ++-- src/librustc/middle/trans/expr.rs | 88 ++-- src/librustc/middle/trans/foreign.rs | 80 ++-- src/librustc/middle/trans/glue.rs | 27 +- src/librustc/middle/trans/inline.rs | 4 +- src/librustc/middle/trans/intrinsic.rs | 10 +- src/librustc/middle/trans/llrepr.rs | 2 +- src/librustc/middle/trans/meth.rs | 44 +- src/librustc/middle/trans/monomorphize.rs | 38 +- src/librustc/middle/trans/reflect.rs | 10 +- src/librustc/middle/trans/tvec.rs | 20 +- src/librustc/middle/trans/type_.rs | 2 +- src/librustc/middle/trans/type_of.rs | 8 +- src/librustc/middle/trans/write_guard.rs | 10 +- src/librustc/middle/ty.rs | 166 +++---- src/librustc/middle/typeck/astconv.rs | 27 +- src/librustc/middle/typeck/check/_match.rs | 34 +- src/librustc/middle/typeck/check/method.rs | 74 ++-- src/librustc/middle/typeck/check/mod.rs | 175 ++++---- src/librustc/middle/typeck/check/regionck.rs | 72 +-- .../middle/typeck/check/regionmanip.rs | 22 +- src/librustc/middle/typeck/check/vtable.rs | 88 ++-- src/librustc/middle/typeck/check/writeback.rs | 28 +- src/librustc/middle/typeck/coherence.rs | 28 +- src/librustc/middle/typeck/collect.rs | 66 +-- src/librustc/middle/typeck/infer/coercion.rs | 20 +- src/librustc/middle/typeck/infer/combine.rs | 14 +- .../middle/typeck/infer/error_reporting.rs | 22 +- src/librustc/middle/typeck/infer/glb.rs | 12 +- src/librustc/middle/typeck/infer/lattice.rs | 26 +- src/librustc/middle/typeck/infer/lub.rs | 18 +- src/librustc/middle/typeck/infer/mod.rs | 114 ++--- .../typeck/infer/region_inference/mod.rs | 92 ++-- src/librustc/middle/typeck/infer/resolve.rs | 8 +- src/librustc/middle/typeck/infer/sub.rs | 14 +- src/librustc/middle/typeck/infer/test.rs | 22 +- src/librustc/middle/typeck/infer/to_str.rs | 10 +- src/librustc/middle/typeck/infer/unify.rs | 10 +- src/librustc/middle/typeck/mod.rs | 18 +- src/librustc/middle/typeck/rscope.rs | 2 +- src/librustc/rustc.rs | 4 +- src/librustc/util/common.rs | 10 +- src/librustc/util/ppaux.rs | 120 ++--- 100 files changed, 1743 insertions(+), 1739 deletions(-) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index ee7fbed9e9f11..8be8a433ef833 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -131,13 +131,13 @@ pub mod jit { for cratepath in r.iter() { let path = cratepath.to_str(); - debug!("linking: %s", path); + debug2!("linking: {}", path); do path.with_c_str |buf_t| { if !llvm::LLVMRustLoadCrate(manager, buf_t) { llvm_err(sess, ~"Could not link"); } - debug!("linked: %s", path); + debug2!("linked: {}", path); } } @@ -303,7 +303,7 @@ pub mod write { for pass in sess.opts.custom_passes.iter() { do pass.with_c_str |s| { if !llvm::LLVMRustAddPass(mpm, s) { - sess.warn(fmt!("Unknown pass %s, ignoring", *pass)); + sess.warn(format!("Unknown pass {}, ignoring", *pass)); } } } @@ -381,9 +381,9 @@ pub mod write { let prog = run::process_output(cc_prog, cc_args); if prog.status != 0 { - sess.err(fmt!("building with `%s` failed with code %d", + sess.err(format!("building with `{}` failed with code {}", cc_prog, prog.status)); - sess.note(fmt!("%s arguments: %s", + sess.note(format!("{} arguments: {}", cc_prog, cc_args.connect(" "))); sess.note(str::from_utf8(prog.error + prog.output)); sess.abort_if_errors(); @@ -554,7 +554,7 @@ pub fn build_link_meta(sess: Session, dep_hashes: ~[@str], pkg_id: Option<@str>) -> @str { fn len_and_str(s: &str) -> ~str { - fmt!("%u_%s", s.len(), s) + format!("{}_{}", s.len(), s) } fn len_and_str_lit(l: ast::lit) -> ~str { @@ -599,7 +599,7 @@ pub fn build_link_meta(sess: Session, fn warn_missing(sess: Session, name: &str, default: &str) { if !*sess.building_library { return; } - sess.warn(fmt!("missing crate link meta `%s`, using `%s` as default", + sess.warn(format!("missing crate link meta `{}`, using `{}` as default", name, default)); } @@ -612,7 +612,7 @@ pub fn build_link_meta(sess: Session, // filestem that returned an @str let name = session::expect(sess, output.filestem(), - || fmt!("output file name `%s` doesn't\ + || format!("output file name `{}` doesn't\ appear to have a stem", output.to_str())).to_managed(); if name.is_empty() { @@ -762,7 +762,7 @@ pub fn mangle(sess: Session, ss: path, let push = |s: &str| { let sani = sanitize(s); - n.push_str(fmt!("%u%s", sani.len(), sani)); + n.push_str(format!("{}{}", sani.len(), sani)); }; // First, connect each component with pairs. @@ -874,7 +874,7 @@ pub fn output_dll_filename(os: session::Os, lm: LinkMeta) -> ~str { session::OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX), session::OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX), }; - fmt!("%s%s-%s-%s%s", dll_prefix, lm.name, lm.extras_hash, lm.vers, dll_suffix) + format!("{}{}-{}-{}{}", dll_prefix, lm.name, lm.extras_hash, lm.vers, dll_suffix) } pub fn get_cc_prog(sess: Session) -> ~str { @@ -890,7 +890,7 @@ pub fn get_cc_prog(sess: Session) -> ~str { session::OsAndroid => match &sess.opts.android_cross_path { &Some(ref path) => { - fmt!("%s/bin/arm-linux-androideabi-gcc", *path) + format!("{}/bin/arm-linux-androideabi-gcc", *path) } &None => { sess.fatal("need Android NDK path for linking \ @@ -915,29 +915,29 @@ pub fn link_binary(sess: Session, let output = if *sess.building_library { let long_libname = output_dll_filename(sess.targ_cfg.os, lm); - debug!("link_meta.name: %s", lm.name); - debug!("long_libname: %s", long_libname); - debug!("out_filename: %s", out_filename.to_str()); - debug!("dirname(out_filename): %s", out_filename.dir_path().to_str()); + debug2!("link_meta.name: {}", lm.name); + debug2!("long_libname: {}", long_libname); + debug2!("out_filename: {}", out_filename.to_str()); + debug2!("dirname(out_filename): {}", out_filename.dir_path().to_str()); out_filename.dir_path().push(long_libname) } else { out_filename.clone() }; - debug!("output: %s", output.to_str()); + debug2!("output: {}", output.to_str()); let cc_args = link_args(sess, obj_filename, out_filename, lm); - debug!("%s link args: %s", cc_prog, cc_args.connect(" ")); + debug2!("{} link args: {}", cc_prog, cc_args.connect(" ")); if (sess.opts.debugging_opts & session::print_link_args) != 0 { - io::println(fmt!("%s link args: %s", cc_prog, cc_args.connect(" "))); + io::println(format!("{} link args: {}", cc_prog, cc_args.connect(" "))); } // We run 'cc' here let prog = run::process_output(cc_prog, cc_args); if 0 != prog.status { - sess.err(fmt!("linking with `%s` failed with code %d", + sess.err(format!("linking with `{}` failed with code {}", cc_prog, prog.status)); - sess.note(fmt!("%s arguments: %s", + sess.note(format!("{} arguments: {}", cc_prog, cc_args.connect(" "))); sess.note(str::from_utf8(prog.error + prog.output)); sess.abort_if_errors(); @@ -951,7 +951,7 @@ pub fn link_binary(sess: Session, // Remove the temporary object file if we aren't saving temps if !sess.opts.save_temps { if ! os::remove_file(obj_filename) { - sess.warn(fmt!("failed to delete object file `%s`", + sess.warn(format!("failed to delete object file `{}`", obj_filename.to_str())); } } diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index fa111a0161577..60289e0ebe5a1 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -29,7 +29,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) return ~[]; } - debug!("preparing the RPATH!"); + debug2!("preparing the RPATH!"); let sysroot = sess.filesearch.sysroot(); let output = out_filename; @@ -49,7 +49,7 @@ fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path { } pub fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] { - rpaths.iter().map(|rpath| fmt!("-Wl,-rpath,%s",rpath.to_str())).collect() + rpaths.iter().map(|rpath| format!("-Wl,-rpath,{}",rpath.to_str())).collect() } fn get_rpaths(os: session::Os, @@ -57,13 +57,13 @@ fn get_rpaths(os: session::Os, output: &Path, libs: &[Path], target_triple: &str) -> ~[Path] { - debug!("sysroot: %s", sysroot.to_str()); - debug!("output: %s", output.to_str()); - debug!("libs:"); + debug2!("sysroot: {}", sysroot.to_str()); + debug2!("output: {}", output.to_str()); + debug2!("libs:"); for libpath in libs.iter() { - debug!(" %s", libpath.to_str()); + debug2!(" {}", libpath.to_str()); } - debug!("target_triple: %s", target_triple); + debug2!("target_triple: {}", target_triple); // Use relative paths to the libraries. Binaries can be moved // as long as they maintain the relative relationship to the @@ -78,9 +78,9 @@ fn get_rpaths(os: session::Os, let fallback_rpaths = ~[get_install_prefix_rpath(target_triple)]; fn log_rpaths(desc: &str, rpaths: &[Path]) { - debug!("%s rpaths:", desc); + debug2!("{} rpaths:", desc); for rpath in rpaths.iter() { - debug!(" %s", rpath.to_str()); + debug2!(" {}", rpath.to_str()); } } @@ -172,7 +172,7 @@ mod test { let res = get_install_prefix_rpath("triple"); let d = Path(env!("CFG_PREFIX")) .push_rel(&Path("lib/rustc/triple/lib")); - debug!("test_prefix_path: %s vs. %s", + debug2!("test_prefix_path: {} vs. {}", res.to_str(), d.to_str()); assert!(res.to_str().ends_with(d.to_str())); @@ -233,7 +233,7 @@ mod test { #[test] fn test_get_absolute_rpath() { let res = get_absolute_rpath(&Path("lib/libstd.so")); - debug!("test_get_absolute_rpath: %s vs. %s", + debug2!("test_get_absolute_rpath: {} vs. {}", res.to_str(), os::make_absolute(&Path("lib")).to_str()); diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 5fe1a5f723352..76f48577fe672 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -386,7 +386,7 @@ pub fn phase_6_link_output(sess: Session, pub fn stop_after_phase_3(sess: Session) -> bool { if sess.opts.no_trans { - debug!("invoked with --no-trans, returning early from compile_input"); + debug2!("invoked with --no-trans, returning early from compile_input"); return true; } return false; @@ -394,7 +394,7 @@ pub fn stop_after_phase_3(sess: Session) -> bool { pub fn stop_after_phase_1(sess: Session) -> bool { if sess.opts.parse_only { - debug!("invoked with --parse-only, returning early from compile_input"); + debug2!("invoked with --parse-only, returning early from compile_input"); return true; } return false; @@ -402,17 +402,17 @@ pub fn stop_after_phase_1(sess: Session) -> bool { pub fn stop_after_phase_5(sess: Session) -> bool { if sess.opts.output_type != link::output_type_exe { - debug!("not building executable, returning early from compile_input"); + debug2!("not building executable, returning early from compile_input"); return true; } if sess.opts.is_static && *sess.building_library { - debug!("building static library, returning early from compile_input"); + debug2!("building static library, returning early from compile_input"); return true; } if sess.opts.jit { - debug!("running JIT, returning early from compile_input"); + debug2!("running JIT, returning early from compile_input"); return true; } return false; @@ -670,7 +670,7 @@ pub fn build_session_options(binary: @str, let lint_name = lint_name.replace("-", "_"); match lint_dict.find_equiv(&lint_name) { None => { - early_error(demitter, fmt!("unknown %s flag: %s", + early_error(demitter, format!("unknown {} flag: {}", level_name, lint_name)); } Some(lint) => { @@ -690,7 +690,7 @@ pub fn build_session_options(binary: @str, if name == debug_flag { this_bit = bit; break; } } if this_bit == 0u { - early_error(demitter, fmt!("unknown debug flag: %s", *debug_flag)) + early_error(demitter, format!("unknown debug flag: {}", *debug_flag)) } debugging_opts |= this_bit; } @@ -1033,7 +1033,7 @@ pub fn build_output_filenames(input: &input, pub fn early_error(emitter: @diagnostic::Emitter, msg: ~str) -> ! { emitter.emit(None, msg, diagnostic::fatal); - fail!(); + fail2!(); } pub fn list_metadata(sess: Session, path: &Path, out: @io::Writer) { @@ -1058,7 +1058,7 @@ mod test { let matches = &match getopts([~"--test"], optgroups()) { Ok(m) => m, - Err(f) => fail!("test_switch_implies_cfg_test: %s", f.to_err_msg()) + Err(f) => fail2!("test_switch_implies_cfg_test: {}", f.to_err_msg()) }; let sessopts = build_session_options( @"rustc", @@ -1079,7 +1079,8 @@ mod test { &match getopts([~"--test", ~"--cfg=test"], optgroups()) { Ok(m) => m, Err(f) => { - fail!("test_switch_implies_cfg_test_unless_cfg_test: %s", f.to_err_msg()); + fail2!("test_switch_implies_cfg_test_unless_cfg_test: {}", + f.to_err_msg()); } }; let sessopts = build_session_options( diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 19e866c70a3fe..5998f590a334f 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -296,7 +296,7 @@ impl Session_ { // This exists to help with refactoring to eliminate impossible // cases later on pub fn impossible_case(&self, sp: Span, msg: &str) -> ! { - self.span_bug(sp, fmt!("Impossible case reached: %s", msg)); + self.span_bug(sp, format!("Impossible case reached: {}", msg)); } pub fn verbose(&self) -> bool { self.debugging_opt(verbose) } pub fn time_passes(&self) -> bool { self.debugging_opt(time_passes) } diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 254116bd50773..e4904863a94bc 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -78,7 +78,7 @@ impl fold::ast_fold for TestHarnessGenerator { fn fold_item(&self, i: @ast::item) -> Option<@ast::item> { self.cx.path.push(i.ident); - debug!("current path: %s", + debug2!("current path: {}", ast_util::path_name_i(self.cx.path.clone())); if is_test_fn(self.cx, i) || is_bench_fn(i) { @@ -91,7 +91,7 @@ impl fold::ast_fold for TestHarnessGenerator { tests"); } _ => { - debug!("this is a test function"); + debug2!("this is a test function"); let test = Test { span: i.span, path: self.cx.path.clone(), @@ -100,7 +100,7 @@ impl fold::ast_fold for TestHarnessGenerator { should_fail: should_fail(i) }; self.cx.testfns.push(test); - // debug!("have %u test/bench functions", + // debug2!("have {} test/bench functions", // cx.testfns.len()); } } @@ -327,7 +327,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item { span: dummy_sp(), }; - debug!("Synthetic test module:\n%s\n", + debug2!("Synthetic test module:\n{}\n", pprust::item_to_str(@item.clone(), cx.sess.intr())); return @item; @@ -381,7 +381,7 @@ fn is_extra(crate: &ast::Crate) -> bool { } fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr { - debug!("building test vector from %u tests", cx.testfns.len()); + debug2!("building test vector from {} tests", cx.testfns.len()); let mut descs = ~[]; for test in cx.testfns.iter() { descs.push(mk_test_desc_and_fn_rec(cx, test)); @@ -404,7 +404,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr { let span = test.span; let path = test.path.clone(); - debug!("encoding %s", ast_util::path_name_i(path)); + debug2!("encoding {}", ast_util::path_name_i(path)); let name_lit: ast::lit = nospan(ast::lit_str(ast_util::path_name_i(path).to_managed())); diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 49798288d40d0..0ef98d96568a3 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -2270,7 +2270,7 @@ impl TypeNames { Metadata => ~"Metadata", X86_MMX => ~"X86_MMAX", Integer => { - fmt!("i%d", llvm::LLVMGetIntTypeWidth(ty.to_ref()) as int) + format!("i{}", llvm::LLVMGetIntTypeWidth(ty.to_ref()) as int) } Function => { let out_ty = ty.return_type(); @@ -2278,25 +2278,25 @@ impl TypeNames { let args = args.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", "); let out_ty = self.type_to_str_depth(out_ty, depth-1); - fmt!("fn(%s) -> %s", args, out_ty) + format!("fn({}) -> {}", args, out_ty) } Struct => { let tys = ty.field_types(); let tys = tys.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", "); - fmt!("{%s}", tys) + format!("\\{{}\\}", tys) } Array => { let el_ty = ty.element_type(); let el_ty = self.type_to_str_depth(el_ty, depth-1); let len = ty.array_length(); - fmt!("[%s x %u]", el_ty, len) + format!("[{} x {}]", el_ty, len) } Pointer => { let el_ty = ty.element_type(); let el_ty = self.type_to_str_depth(el_ty, depth-1); - fmt!("*%s", el_ty) + format!("*{}", el_ty) } - _ => fail!("Unknown Type Kind (%u)", kind as uint) + _ => fail2!("Unknown Type Kind ({})", kind as uint) } } } @@ -2307,7 +2307,7 @@ impl TypeNames { pub fn types_to_str(&self, tys: &[Type]) -> ~str { let strs = tys.map(|t| self.type_to_str(*t)); - fmt!("[%s]", strs.connect(",")) + format!("[{}]", strs.connect(",")) } pub fn val_to_str(&self, val: ValueRef) -> ~str { diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 3b563e47426a3..c41e1d78f6486 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -74,11 +74,11 @@ struct cache_entry { } fn dump_crates(crate_cache: &[cache_entry]) { - debug!("resolved crates:"); + debug2!("resolved crates:"); for entry in crate_cache.iter() { - debug!("cnum: %?", entry.cnum); - debug!("span: %?", entry.span); - debug!("hash: %?", entry.hash); + debug2!("cnum: {:?}", entry.cnum); + debug2!("span: {:?}", entry.span); + debug2!("hash: {:?}", entry.hash); } } @@ -97,7 +97,7 @@ fn warn_if_multiple_versions(e: @mut Env, if matches.len() != 1u { diag.handler().warn( - fmt!("using multiple versions of crate `%s`", name)); + format!("using multiple versions of crate `{}`", name)); for match_ in matches.iter() { diag.span_note(match_.span, "used here"); let attrs = ~[ @@ -154,7 +154,7 @@ fn visit_view_item(e: @mut Env, i: &ast::view_item) { } } }; - debug!("resolving extern mod stmt. ident: %?, meta: %?", + debug2!("resolving extern mod stmt. ident: {:?}, meta: {:?}", ident, meta_items); let cnum = resolve_crate(e, ident, @@ -317,7 +317,7 @@ fn resolve_crate(e: @mut Env, // Go through the crate metadata and load any crates that it references fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map { - debug!("resolving deps of external crate"); + debug2!("resolving deps of external crate"); // The map from crate numbers in the crate we're resolving to local crate // numbers let mut cnum_map = HashMap::new(); @@ -326,18 +326,18 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map { let extrn_cnum = dep.cnum; let cname_str = token::ident_to_str(&dep.name); let cmetas = metas_with(dep.vers, @"vers", ~[]); - debug!("resolving dep crate %s ver: %s hash: %s", + debug2!("resolving dep crate {} ver: {} hash: {}", cname_str, dep.vers, dep.hash); match existing_match(e, metas_with_ident(cname_str, cmetas.clone()), dep.hash) { Some(local_cnum) => { - debug!("already have it"); + debug2!("already have it"); // We've already seen this crate cnum_map.insert(extrn_cnum, local_cnum); } None => { - debug!("need to load it"); + debug2!("need to load it"); // This is a new one so we've got to load it // FIXME (#2404): Need better error reporting than just a bogus // span. diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 841142ee62fe8..6def597b89fb3 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -210,17 +210,17 @@ pub fn get_field_type(tcx: ty::ctxt, class_id: ast::DefId, let cstore = tcx.cstore; let cdata = cstore::get_crate_data(cstore, class_id.crate); let all_items = reader::get_doc(reader::Doc(cdata.data), tag_items); - debug!("Looking up %?", class_id); + debug2!("Looking up {:?}", class_id); let class_doc = expect(tcx.diag, decoder::maybe_find_item(class_id.node, all_items), - || fmt!("get_field_type: class ID %? not found", + || format!("get_field_type: class ID {:?} not found", class_id) ); - debug!("looking up %? : %?", def, class_doc); + debug2!("looking up {:?} : {:?}", def, class_doc); let the_field = expect(tcx.diag, decoder::maybe_find_item(def.node, class_doc), - || fmt!("get_field_type: in class %?, field ID %? not found", + || format!("get_field_type: in class {:?}, field ID {:?} not found", class_id, def) ); - debug!("got field data %?", the_field); + debug2!("got field data {:?}", the_field); let ty = decoder::item_type(def, the_field, tcx, cdata); ty::ty_param_bounds_and_ty { generics: ty::Generics {type_param_defs: @~[], diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index a5f541412ded9..03af7c98b8774 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -152,7 +152,7 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[@str] { let cdata = cstore::get_crate_data(cstore, cnum); let hash = decoder::get_crate_hash(cdata.data); let vers = decoder::get_crate_vers(cdata.data); - debug!("Add hash[%s]: %s %s", cdata.name, vers, hash); + debug2!("Add hash[{}]: {} {}", cdata.name, vers, hash); result.push(crate_hash { name: cdata.name, vers: vers, @@ -164,9 +164,9 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[@str] { (a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash) }; - debug!("sorted:"); + debug2!("sorted:"); for x in sorted.iter() { - debug!(" hash[%s]: %s", x.name, x.hash); + debug2!(" hash[{}]: {}", x.name, x.hash); } sorted.map(|ch| ch.hash) diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 69b3c79d1a9aa..5c6a7c4f3b7c7 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -89,7 +89,7 @@ pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option { fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc { match maybe_find_item(item_id, items) { - None => fail!("lookup_item: id not found: %d", item_id), + None => fail2!("lookup_item: id not found: {}", item_id), Some(d) => d } } @@ -148,7 +148,7 @@ fn item_family(item: ebml::Doc) -> Family { 'g' => PublicField, 'j' => PrivateField, 'N' => InheritedField, - c => fail!("unexpected family char: %c", c) + c => fail2!("unexpected family char: {}", c) } } @@ -160,7 +160,7 @@ fn item_visibility(item: ebml::Doc) -> ast::visibility { 'y' => ast::public, 'n' => ast::private, 'i' => ast::inherited, - _ => fail!("unknown visibility character") + _ => fail2!("unknown visibility character") } } } @@ -494,8 +494,8 @@ pub enum DefLike { pub fn def_like_to_def(def_like: DefLike) -> ast::Def { match def_like { DlDef(def) => return def, - DlImpl(*) => fail!("found impl in def_like_to_def"), - DlField => fail!("found field in def_like_to_def") + DlImpl(*) => fail2!("found impl in def_like_to_def"), + DlField => fail2!("found field in def_like_to_def") } } @@ -550,14 +550,14 @@ impl<'self> EachItemContext<'self> { let def_like = item_to_def_like(doc, def_id, self.cdata.cnum); match def_like { DlDef(def) => { - debug!("(iterating over each item of a module) processing \ - `%s` (def %?)", + debug2!("(iterating over each item of a module) processing \ + `{}` (def {:?})", *self.path_builder, def); } _ => { - debug!("(iterating over each item of a module) processing \ - `%s` (%d:%d)", + debug2!("(iterating over each item of a module) processing \ + `{}` ({}:{})", *self.path_builder, def_id.crate, def_id.node); @@ -631,8 +631,8 @@ impl<'self> EachItemContext<'self> { reader::get_doc(root, tag_items) }; - debug!("(iterating over each item of a module) looking up item \ - %d:%d in `%s`, crate %d", + debug2!("(iterating over each item of a module) looking up item \ + {}:{} in `{}`, crate {}", child_def_id.crate, child_def_id.node, *self.path_builder, @@ -644,8 +644,8 @@ impl<'self> EachItemContext<'self> { Some(child_item_doc) => { // Push the name. let child_name = item_name(self.intr, child_item_doc); - debug!("(iterating over each item of a module) pushing \ - name `%s` onto `%s`", + debug2!("(iterating over each item of a module) pushing \ + name `{}` onto `{}`", token::ident_to_str(&child_name), *self.path_builder); let old_len = @@ -682,9 +682,9 @@ impl<'self> EachItemContext<'self> { let name = name_doc.as_str_slice(); // Push the name. - debug!("(iterating over each item of a module) pushing \ - reexported name `%s` onto `%s` (crate %d, orig %d, \ - in crate %d)", + debug2!("(iterating over each item of a module) pushing \ + reexported name `{}` onto `{}` (crate {}, orig {}, \ + in crate {})", name, *self.path_builder, def_id.crate, @@ -899,7 +899,7 @@ pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt, id: ast::NodeId, decode_inlined_item: decode_inlined_item) -> csearch::found_ast { - debug!("Looking up item: %d", id); + debug2!("Looking up item: {}", id); let item_doc = lookup_item(id, cdata.data); let path = { let item_path = item_path(item_doc); @@ -964,7 +964,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ { match ch as char { 'i' => ast::MutImmutable, 'm' => ast::MutMutable, - _ => fail!("unknown mutability character: `%c`", ch as char), + _ => fail2!("unknown mutability character: `{}`", ch as char), } } @@ -982,7 +982,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ { return ast::sty_region(None, get_mutability(string[1])); } _ => { - fail!("unknown self type code: `%c`", explicit_self_kind as char); + fail2!("unknown self type code: `{}`", explicit_self_kind as char); } } } @@ -1163,7 +1163,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner, match item_family(impl_method_doc) { StaticMethod => purity = ast::impure_fn, UnsafeStaticMethod => purity = ast::unsafe_fn, - _ => fail!() + _ => fail2!() } static_impl_methods.push(StaticMethodInfo { @@ -1199,7 +1199,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility { PublicField => ast::public, PrivateField => ast::private, InheritedField => ast::inherited, - _ => fail!() + _ => fail2!() } } @@ -1265,7 +1265,7 @@ fn describe_def(items: ebml::Doc, id: ast::DefId) -> ~str { if id.crate != ast::LOCAL_CRATE { return ~"external"; } let it = match maybe_find_item(id.node, items) { Some(it) => it, - None => fail!("describe_def: item not found %?", id) + None => fail2!("describe_def: item not found {:?}", id) }; return item_family_to_str(item_family(it)); } @@ -1355,17 +1355,17 @@ fn list_meta_items(intr: @ident_interner, out: @io::Writer) { let r = get_meta_items(meta_items); for mi in r.iter() { - out.write_str(fmt!("%s\n", pprust::meta_item_to_str(*mi, intr))); + out.write_str(format!("{}\n", pprust::meta_item_to_str(*mi, intr))); } } fn list_crate_attributes(intr: @ident_interner, md: ebml::Doc, hash: &str, out: @io::Writer) { - out.write_str(fmt!("=Crate Attributes (%s)=\n", hash)); + out.write_str(format!("=Crate Attributes ({})=\n", hash)); let r = get_attributes(md); for attr in r.iter() { - out.write_str(fmt!("%s\n", pprust::attribute_to_str(attr, intr))); + out.write_str(format!("{}\n", pprust::attribute_to_str(attr, intr))); } out.write_str("\n\n"); @@ -1409,7 +1409,7 @@ fn list_crate_deps(data: @~[u8], out: @io::Writer) { let r = get_crate_deps(data); for dep in r.iter() { out.write_str( - fmt!("%d %s-%s-%s\n", + format!("{} {}-{}-{}\n", dep.cnum, token::ident_to_str(&dep.name), dep.hash, dep.vers)); } @@ -1452,7 +1452,7 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId { match cdata.cnum_map.find(&did.crate) { option::Some(&n) => ast::DefId { crate: n, node: did.node }, - option::None => fail!("didn't find a crate in the cnum_map") + option::None => fail2!("didn't find a crate in the cnum_map") } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index f84d9764714c4..ff59376aa37f2 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -185,7 +185,7 @@ fn encode_family(ebml_w: &mut writer::Encoder, c: char) { } pub fn def_to_str(did: DefId) -> ~str { - fmt!("%d:%d", did.crate, did.node) + format!("{}:{}", did.crate, did.node) } fn encode_ty_type_param_defs(ebml_w: &mut writer::Encoder, @@ -284,12 +284,12 @@ fn encode_symbol(ecx: &EncodeContext, ebml_w.start_tag(tag_items_data_item_symbol); match ecx.item_symbols.find(&id) { Some(x) => { - debug!("encode_symbol(id=%?, str=%s)", id, *x); + debug2!("encode_symbol(id={:?}, str={})", id, *x); ebml_w.writer.write(x.as_bytes()); } None => { ecx.diag.handler().bug( - fmt!("encode_symbol: id not found %d", id)); + format!("encode_symbol: id not found {}", id)); } } ebml_w.end_tag(); @@ -339,7 +339,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext, path: &[ast_map::path_elt], index: @mut ~[entry], generics: &ast::Generics) { - debug!("encode_enum_variant_info(id=%?)", id); + debug2!("encode_enum_variant_info(id={:?})", id); let mut disr_val = 0; let mut i = 0; @@ -425,14 +425,14 @@ fn encode_reexported_static_method(ecx: &EncodeContext, exp: &middle::resolve::Export2, method_def_id: DefId, method_ident: Ident) { - debug!("(encode reexported static method) %s::%s", + debug2!("(encode reexported static method) {}::{}", exp.name, ecx.tcx.sess.str_of(method_ident)); ebml_w.start_tag(tag_items_data_item_reexport); ebml_w.start_tag(tag_items_data_item_reexport_def_id); ebml_w.wr_str(def_to_str(method_def_id)); ebml_w.end_tag(); ebml_w.start_tag(tag_items_data_item_reexport_name); - ebml_w.wr_str(fmt!("%s::%s", exp.name, ecx.tcx.sess.str_of(method_ident))); + ebml_w.wr_str(format!("{}::{}", exp.name, ecx.tcx.sess.str_of(method_ident))); ebml_w.end_tag(); ebml_w.end_tag(); } @@ -498,14 +498,14 @@ fn encode_reexported_static_methods(ecx: &EncodeContext, if mod_path != *path || exp.name != original_name { if !encode_reexported_static_base_methods(ecx, ebml_w, exp) { if encode_reexported_static_trait_methods(ecx, ebml_w, exp) { - debug!(fmt!("(encode reexported static methods) %s \ - [trait]", - original_name)); + debug2!("(encode reexported static methods) {} \ + [trait]", + original_name); } } else { - debug!(fmt!("(encode reexported static methods) %s [base]", - original_name)); + debug2!("(encode reexported static methods) {} [base]", + original_name); } } } @@ -552,13 +552,13 @@ fn encode_reexports(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, id: NodeId, path: &[ast_map::path_elt]) { - debug!("(encoding info for module) encoding reexports for %d", id); + debug2!("(encoding info for module) encoding reexports for {}", id); match ecx.reexports2.find(&id) { Some(ref exports) => { - debug!("(encoding info for module) found reexports for %d", id); + debug2!("(encoding info for module) found reexports for {}", id); for exp in exports.iter() { - debug!("(encoding info for module) reexport '%s' (%d/%d) for \ - %d", + debug2!("(encoding info for module) reexport '{}' ({}/{}) for \ + {}", exp.name, exp.def_id.crate, exp.def_id.node, @@ -575,7 +575,7 @@ fn encode_reexports(ecx: &EncodeContext, } } None => { - debug!("(encoding info for module) found no reexports for %d", + debug2!("(encoding info for module) found no reexports for {}", id); } } @@ -592,7 +592,7 @@ fn encode_info_for_mod(ecx: &EncodeContext, encode_def_id(ebml_w, local_def(id)); encode_family(ebml_w, 'm'); encode_name(ecx, ebml_w, name); - debug!("(encoding info for module) encoding info for module ID %d", id); + debug2!("(encoding info for module) encoding info for module ID {}", id); // Encode info about all the module children. for item in md.items.iter() { @@ -610,8 +610,8 @@ fn encode_info_for_mod(ecx: &EncodeContext, match item.node { item_impl(*) => { let (ident, did) = (item.ident, item.id); - debug!("(encoding info for module) ... encoding impl %s \ - (%?/%?)", + debug2!("(encoding info for module) ... encoding impl {} \ + ({:?}/{:?})", ecx.tcx.sess.str_of(ident), did, ast_map::node_id_to_str(ecx.tcx.items, did, token::get_ident_interner())); @@ -628,7 +628,7 @@ fn encode_info_for_mod(ecx: &EncodeContext, // Encode the reexports of this module, if this module is public. if vis == public { - debug!("(encoding info for module) encoding reexports for %d", id); + debug2!("(encoding info for module) encoding reexports for {}", id); encode_reexports(ecx, ebml_w, id, path); } @@ -730,7 +730,7 @@ fn encode_info_for_struct(ecx: &EncodeContext, index.push(entry {val: id as i64, pos: ebml_w.writer.tell()}); global_index.push(entry {val: id as i64, pos: ebml_w.writer.tell()}); ebml_w.start_tag(tag_items_data_item); - debug!("encode_info_for_struct: doing %s %d", + debug2!("encode_info_for_struct: doing {} {}", tcx.sess.str_of(nm), id); encode_struct_field_family(ebml_w, vis); encode_name(ecx, ebml_w, nm); @@ -794,7 +794,7 @@ fn encode_info_for_method(ecx: &EncodeContext, parent_id: NodeId, ast_method_opt: Option<@method>) { - debug!("encode_info_for_method: %? %s", m.def_id, + debug2!("encode_info_for_method: {:?} {}", m.def_id, ecx.tcx.sess.str_of(m.ident)); ebml_w.start_tag(tag_items_data_item); @@ -834,7 +834,7 @@ fn purity_static_method_family(p: purity) -> char { match p { unsafe_fn => 'U', impure_fn => 'F', - _ => fail!("extern fn can't be static") + _ => fail2!("extern fn can't be static") } } @@ -893,7 +893,7 @@ fn encode_info_for_item(ecx: &EncodeContext, } let add_to_index: &fn() = || add_to_index_(item, ebml_w, index); - debug!("encoding info for item at %s", + debug2!("encoding info for item at {}", ecx.tcx.sess.codemap.span_to_str(item.span)); let def_id = local_def(item.id); @@ -1220,7 +1220,7 @@ fn encode_info_for_item(ecx: &EncodeContext, // Encode inherent implementations for this trait. encode_inherent_implementations(ecx, ebml_w, def_id); } - item_mac(*) => fail!("item macros unimplemented") + item_mac(*) => fail2!("item macros unimplemented") } } @@ -1279,7 +1279,7 @@ fn my_visit_item(i:@item, items: ast_map::map, ebml_w:&writer::Encoder, }; encode_info_for_item(ecx, &mut ebml_w, i, index, *pt, vis); } - _ => fail!("bad item") + _ => fail2!("bad item") } } @@ -1287,7 +1287,7 @@ fn my_visit_foreign_item(ni:@foreign_item, items: ast_map::map, ebml_w:&writer:: ecx_ptr:*int, index: @mut ~[entry]) { match items.get_copy(&ni.id) { ast_map::node_foreign_item(_, abi, _, pt) => { - debug!("writing foreign item %s::%s", + debug2!("writing foreign item {}::{}", ast_map::path_to_str( *pt, token::get_ident_interner()), @@ -1304,7 +1304,7 @@ fn my_visit_foreign_item(ni:@foreign_item, items: ast_map::map, ebml_w:&writer:: abi); } // case for separate item and foreign-item tables - _ => fail!("bad foreign item") + _ => fail2!("bad foreign item") } } diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index c719146c99995..6761445b74e22 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -53,7 +53,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>, let mut visited_dirs = HashSet::new(); let mut found = false; - debug!("filesearch: searching additional lib search paths [%?]", + debug2!("filesearch: searching additional lib search paths [{:?}]", self.addl_lib_search_paths.len()); for path in self.addl_lib_search_paths.iter() { match f(path) { @@ -63,7 +63,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>, visited_dirs.insert(path.to_str()); } - debug!("filesearch: searching target lib path"); + debug2!("filesearch: searching target lib path"); let tlib_path = make_target_lib_path(self.sysroot, self.target_triple); if !visited_dirs.contains(&tlib_path.to_str()) { @@ -78,7 +78,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>, let rustpath = rust_path(); for path in rustpath.iter() { let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple); - debug!("is %s in visited_dirs? %?", tlib_path.to_str(), + debug2!("is {} in visited_dirs? {:?}", tlib_path.to_str(), visited_dirs.contains(&tlib_path.to_str())); if !visited_dirs.contains(&tlib_path.to_str()) { @@ -104,7 +104,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>, } let sysroot = get_sysroot(maybe_sysroot); - debug!("using sysroot = %s", sysroot.to_str()); + debug2!("using sysroot = {}", sysroot.to_str()); @FileSearchImpl { sysroot: sysroot, addl_lib_search_paths: addl_lib_search_paths, @@ -114,19 +114,19 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>, pub fn search(filesearch: @FileSearch, pick: pick) { do filesearch.for_each_lib_search_path() |lib_search_path| { - debug!("searching %s", lib_search_path.to_str()); + debug2!("searching {}", lib_search_path.to_str()); let r = os::list_dir_path(lib_search_path); let mut rslt = FileDoesntMatch; for path in r.iter() { - debug!("testing %s", path.to_str()); + debug2!("testing {}", path.to_str()); let maybe_picked = pick(path); match maybe_picked { FileMatches => { - debug!("picked %s", path.to_str()); + debug2!("picked {}", path.to_str()); rslt = FileMatches; } FileDoesntMatch => { - debug!("rejected %s", path.to_str()); + debug2!("rejected {}", path.to_str()); } } } @@ -153,7 +153,7 @@ fn make_rustpkg_target_lib_path(dir: &Path, pub fn get_or_default_sysroot() -> Path { match os::self_exe_path() { option::Some(ref p) => (*p).pop(), - option::None => fail!("can't determine value for sysroot") + option::None => fail2!("can't determine value for sysroot") } } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index b5ba9bb5648a2..4d69a2ffce85d 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -59,7 +59,7 @@ pub fn load_library_crate(cx: &Context) -> (~str, @~[u8]) { Some(t) => t, None => { cx.diag.span_fatal(cx.span, - fmt!("can't find crate for `%s`", + format!("can't find crate for `{}`", cx.ident)); } } @@ -90,7 +90,7 @@ fn find_library_crate_aux( ) -> Option<(~str, @~[u8])> { let crate_name = crate_name_from_metas(cx.metas); // want: crate_name.dir_part() + prefix + crate_name.file_part + "-" - let prefix = fmt!("%s%s-", prefix, crate_name); + let prefix = format!("{}{}-", prefix, crate_name); let mut matches = ~[]; filesearch::search(filesearch, |path| -> FileMatch { let path_str = path.filename(); @@ -98,20 +98,20 @@ fn find_library_crate_aux( None => FileDoesntMatch, Some(path_str) => if path_str.starts_with(prefix) && path_str.ends_with(suffix) { - debug!("%s is a candidate", path.to_str()); + debug2!("{} is a candidate", path.to_str()); match get_metadata_section(cx.os, path) { Some(cvec) => if !crate_matches(cvec, cx.metas, cx.hash) { - debug!("skipping %s, metadata doesn't match", + debug2!("skipping {}, metadata doesn't match", path.to_str()); FileDoesntMatch } else { - debug!("found %s with matching metadata", path.to_str()); + debug2!("found {} with matching metadata", path.to_str()); matches.push((path.to_str(), cvec)); FileMatches }, _ => { - debug!("could not load metadata for %s", path.to_str()); + debug2!("could not load metadata for {}", path.to_str()); FileDoesntMatch } } @@ -127,12 +127,12 @@ fn find_library_crate_aux( 1 => Some(matches[0]), _ => { cx.diag.span_err( - cx.span, fmt!("multiple matching crates for `%s`", crate_name)); + cx.span, format!("multiple matching crates for `{}`", crate_name)); cx.diag.handler().note("candidates:"); for pair in matches.iter() { let ident = pair.first(); let data = pair.second(); - cx.diag.handler().note(fmt!("path: %s", ident)); + cx.diag.handler().note(format!("path: {}", ident)); let attrs = decoder::get_crate_attributes(data); note_linkage_attrs(cx.intr, cx.diag, attrs); } @@ -149,7 +149,7 @@ pub fn crate_name_from_metas(metas: &[@ast::MetaItem]) -> @str { _ => {} } } - fail!("expected to find the crate name") + fail2!("expected to find the crate name") } pub fn package_id_from_metas(metas: &[@ast::MetaItem]) -> Option<@str> { @@ -167,7 +167,7 @@ pub fn note_linkage_attrs(intr: @ident_interner, attrs: ~[ast::Attribute]) { let r = attr::find_linkage_metas(attrs); for mi in r.iter() { - diag.handler().note(fmt!("meta: %s", pprust::meta_item_to_str(*mi,intr))); + diag.handler().note(format!("meta: {}", pprust::meta_item_to_str(*mi,intr))); } } @@ -188,7 +188,7 @@ pub fn metadata_matches(extern_metas: &[@ast::MetaItem], // extern_metas: metas we read from the crate // local_metas: metas we're looking for - debug!("matching %u metadata requirements against %u items", + debug2!("matching {} metadata requirements against {} items", local_metas.len(), extern_metas.len()); do local_metas.iter().all |needed| { @@ -211,14 +211,14 @@ fn get_metadata_section(os: Os, while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False { let name_buf = llvm::LLVMGetSectionName(si.llsi); let name = str::raw::from_c_str(name_buf); - debug!("get_metadata_section: name %s", name); + debug2!("get_metadata_section: name {}", name); if read_meta_section_name(os) == name { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi) as uint; let mut found = None; let cvbuf: *u8 = cast::transmute(cbuf); let vlen = encoder::metadata_encoding_version.len(); - debug!("checking %u bytes of metadata-version stamp", + debug2!("checking {} bytes of metadata-version stamp", vlen); let minsz = num::min(vlen, csz); let mut version_ok = false; @@ -229,7 +229,7 @@ fn get_metadata_section(os: Os, if !version_ok { return None; } let cvbuf1 = ptr::offset(cvbuf, vlen as int); - debug!("inflating %u bytes of compressed metadata", + debug2!("inflating {} bytes of compressed metadata", csz - vlen); do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| { let inflated = flate::inflate_bytes(bytes); @@ -273,7 +273,7 @@ pub fn list_file_metadata(intr: @ident_interner, match get_metadata_section(os, path) { option::Some(bytes) => decoder::list_crate_metadata(intr, bytes, out), option::None => { - out.write_str(fmt!("could not find metadata in %s.\n", path.to_str())) + out.write_str(format!("could not find metadata in {}.\n", path.to_str())) } } } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index b94a43e07a198..b44051ef56058 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -80,10 +80,10 @@ fn scan(st: &mut PState, is_last: &fn(char) -> bool, op: &fn(&[u8]) -> R) -> R { let start_pos = st.pos; - debug!("scan: '%c' (start)", st.data[st.pos] as char); + debug2!("scan: '{}' (start)", st.data[st.pos] as char); while !is_last(st.data[st.pos] as char) { st.pos += 1; - debug!("scan: '%c'", st.data[st.pos] as char); + debug2!("scan: '{}'", st.data[st.pos] as char); } let end_pos = st.pos; st.pos += 1; @@ -161,7 +161,7 @@ fn parse_sigil(st: &mut PState) -> ast::Sigil { '@' => ast::ManagedSigil, '~' => ast::OwnedSigil, '&' => ast::BorrowedSigil, - c => st.tcx.sess.bug(fmt!("parse_sigil(): bad input '%c'", c)) + c => st.tcx.sess.bug(format!("parse_sigil(): bad input '{}'", c)) } } @@ -179,7 +179,7 @@ fn parse_vstore(st: &mut PState) -> ty::vstore { '~' => ty::vstore_uniq, '@' => ty::vstore_box, '&' => ty::vstore_slice(parse_region(st)), - c => st.tcx.sess.bug(fmt!("parse_vstore(): bad input '%c'", c)) + c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c)) } } @@ -188,7 +188,7 @@ fn parse_trait_store(st: &mut PState) -> ty::TraitStore { '~' => ty::UniqTraitStore, '@' => ty::BoxTraitStore, '&' => ty::RegionTraitStore(parse_region(st)), - c => st.tcx.sess.bug(fmt!("parse_trait_store(): bad input '%c'", c)) + c => st.tcx.sess.bug(format!("parse_trait_store(): bad input '{}'", c)) } } @@ -221,7 +221,7 @@ fn parse_region_substs(st: &mut PState) -> ty::RegionSubsts { assert_eq!(next(st), '.'); ty::NonerasedRegions(regions) } - _ => fail!("parse_bound_region: bad input") + _ => fail2!("parse_bound_region: bad input") } } @@ -239,7 +239,7 @@ fn parse_bound_region(st: &mut PState) -> ty::bound_region { assert_eq!(next(st), '|'); ty::br_cap_avoid(id, @parse_bound_region(st)) }, - _ => fail!("parse_bound_region: bad input") + _ => fail2!("parse_bound_region: bad input") } } @@ -268,7 +268,7 @@ fn parse_region(st: &mut PState) -> ty::Region { 'e' => { ty::re_static } - _ => fail!("parse_region: bad input") + _ => fail2!("parse_region: bad input") } } @@ -276,7 +276,7 @@ fn parse_opt(st: &mut PState, f: &fn(&mut PState) -> T) -> Option { match next(st) { 'n' => None, 's' => Some(f(st)), - _ => fail!("parse_opt: bad input") + _ => fail2!("parse_opt: bad input") } } @@ -317,7 +317,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t { 'D' => return ty::mk_mach_int(ast::ty_i64), 'f' => return ty::mk_mach_float(ast::ty_f32), 'F' => return ty::mk_mach_float(ast::ty_f64), - _ => fail!("parse_ty: bad numeric type") + _ => fail2!("parse_ty: bad numeric type") } } 'c' => return ty::mk_char(), @@ -340,7 +340,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t { } 'p' => { let did = parse_def(st, TypeParameter, conv); - debug!("parsed ty_param: did=%?", did); + debug2!("parsed ty_param: did={:?}", did); return ty::mk_param(st.tcx, parse_uint(st), did); } 's' => { @@ -417,7 +417,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t { assert_eq!(next(st), ']'); return ty::mk_struct(st.tcx, did, substs); } - c => { error!("unexpected char in type string: %c", c); fail!();} + c => { error2!("unexpected char in type string: {}", c); fail2!();} } } @@ -467,7 +467,7 @@ fn parse_purity(c: char) -> purity { 'u' => unsafe_fn, 'i' => impure_fn, 'c' => extern_fn, - _ => fail!("parse_purity: bad purity %c", c) + _ => fail2!("parse_purity: bad purity {}", c) } } @@ -488,7 +488,7 @@ fn parse_onceness(c: char) -> ast::Onceness { match c { 'o' => ast::Once, 'm' => ast::Many, - _ => fail!("parse_onceness: bad onceness") + _ => fail2!("parse_onceness: bad onceness") } } @@ -539,8 +539,8 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId { let len = buf.len(); while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; } if colon_idx == len { - error!("didn't find ':' when parsing def id"); - fail!(); + error2!("didn't find ':' when parsing def id"); + fail2!(); } let crate_part = buf.slice(0u, colon_idx); @@ -548,12 +548,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId { let crate_num = match uint::parse_bytes(crate_part, 10u) { Some(cn) => cn as int, - None => fail!("internal error: parse_def_id: crate number expected, but found %?", + None => fail2!("internal error: parse_def_id: crate number expected, but found {:?}", crate_part) }; let def_num = match uint::parse_bytes(def_part, 10u) { Some(dn) => dn as int, - None => fail!("internal error: parse_def_id: id expected, but found %?", + None => fail2!("internal error: parse_def_id: id expected, but found {:?}", def_part) }; ast::DefId { crate: crate_num, node: def_num } @@ -599,7 +599,7 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds { return param_bounds; } _ => { - fail!("parse_bounds: bad bounds") + fail2!("parse_bounds: bad bounds") } } } diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 417a6dae7bea0..09c776a9fab5d 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -86,7 +86,7 @@ pub fn enc_ty(w: @io::Writer, cx: @ctxt, t: ty::t) { let abbrev_len = 3u + estimate_sz(pos) + estimate_sz(len); if abbrev_len < len { // I.e. it's actually an abbreviation. - let s = fmt!("#%x:%x#", pos, len).to_managed(); + let s = format!("\\#{:x}:{:x}\\#", pos, len).to_managed(); let a = ty_abbrev { pos: pos, len: len, s: s }; abbrevs.insert(t, a); } @@ -336,18 +336,18 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: &ty::sty) { } ty::ty_opaque_box => w.write_char('B'), ty::ty_struct(def, ref substs) => { - debug!("~~~~ %s", "a["); + debug2!("~~~~ {}", "a["); w.write_str(&"a["); let s = (cx.ds)(def); - debug!("~~~~ %s", s); + debug2!("~~~~ {}", s); w.write_str(s); - debug!("~~~~ %s", "|"); + debug2!("~~~~ {}", "|"); w.write_char('|'); enc_substs(w, cx, substs); - debug!("~~~~ %s", "]"); + debug2!("~~~~ {}", "]"); w.write_char(']'); } - ty::ty_err => fail!("Shouldn't encode error type") + ty::ty_err => fail2!("Shouldn't encode error type") } } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 683fbba09cc52..902f90eb7cd5c 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -84,7 +84,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext, path: &[ast_map::path_elt], ii: ast::inlined_item, maps: Maps) { - debug!("> Encoding inlined item: %s::%s (%u)", + debug2!("> Encoding inlined item: {}::{} ({})", ast_map::path_to_str(path, token::get_ident_interner()), ecx.tcx.sess.str_of(ii.ident()), ebml_w.writer.tell()); @@ -97,7 +97,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext, encode_side_tables_for_ii(ecx, maps, ebml_w, &ii); ebml_w.end_tag(); - debug!("< Encoded inlined fn: %s::%s (%u)", + debug2!("< Encoded inlined fn: {}::{} ({})", ast_map::path_to_str(path, token::get_ident_interner()), ecx.tcx.sess.str_of(ii.ident()), ebml_w.writer.tell()); @@ -117,7 +117,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata, match par_doc.opt_child(c::tag_ast) { None => None, Some(ast_doc) => { - debug!("> Decoding inlined fn: %s::?", + debug2!("> Decoding inlined fn: {}::?", ast_map::path_to_str(path, token::get_ident_interner())); let mut ast_dsr = reader::Decoder(ast_doc); let from_id_range = Decodable::decode(&mut ast_dsr); @@ -129,8 +129,8 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata, }; let raw_ii = decode_ast(ast_doc); let ii = renumber_ast(xcx, raw_ii); - debug!("Fn named: %s", tcx.sess.str_of(ii.ident())); - debug!("< Decoded inlined fn: %s::%s", + debug2!("Fn named: {}", tcx.sess.str_of(ii.ident())); + debug2!("< Decoded inlined fn: {}::{}", ast_map::path_to_str(path, token::get_ident_interner()), tcx.sess.str_of(ii.ident())); ast_map::map_decoded_item(tcx.sess.diagnostic(), @@ -140,7 +140,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata, decode_side_tables(xcx, ast_doc); match ii { ast::ii_item(i) => { - debug!(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<", + debug2!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<", syntax::print::pprust::item_to_str(i, tcx.sess.intr())); } _ => { } @@ -305,7 +305,7 @@ impl fold::ast_fold for NestedItemsDropper { node: ast::DeclItem(_), span: _ }, _) => None, - ast::StmtMac(*) => fail!("unexpanded macro in astencode") + ast::StmtMac(*) => fail2!("unexpanded macro in astencode") } }.collect(); let blk_sans_items = ast::Block { @@ -741,7 +741,7 @@ impl vtable_decoder_helpers for reader::Decoder { ) } // hard to avoid - user input - _ => fail!("bad enum variant") + _ => fail2!("bad enum variant") } } } @@ -896,7 +896,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext, id: ast::NodeId) { let tcx = ecx.tcx; - debug!("Encoding side tables for id %d", id); + debug2!("Encoding side tables for id {}", id); { let r = tcx.def_map.find(&id); @@ -1091,7 +1091,7 @@ impl ebml_decoder_decoder_helpers for reader::Decoder { xcx.dcx.tcx, |s, a| this.convert_def_id(xcx, s, a)); - debug!("read_ty(%s) = %s", + debug2!("read_ty({}) = {}", type_string(doc), ty_to_str(xcx.dcx.tcx, ty)); @@ -1176,7 +1176,7 @@ impl ebml_decoder_decoder_helpers for reader::Decoder { NominalType | TypeWithId => xcx.tr_def_id(did), TypeParameter => xcx.tr_intern_def_id(did) }; - debug!("convert_def_id(source=%?, did=%?)=%?", source, did, r); + debug2!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r); return r; } } @@ -1189,14 +1189,14 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext, let id0 = entry_doc.get(c::tag_table_id as uint).as_int(); let id = xcx.tr_id(id0); - debug!(">> Side table document with tag 0x%x \ - found for id %d (orig %d)", + debug2!(">> Side table document with tag 0x{:x} \ + found for id {} (orig {})", tag, id, id0); match c::astencode_tag::from_uint(tag) { None => { xcx.dcx.tcx.sess.bug( - fmt!("unknown tag found in side tables: %x", tag)); + format!("unknown tag found in side tables: {:x}", tag)); } Some(value) => { let val_doc = entry_doc.get(c::tag_table_val as uint); @@ -1210,7 +1210,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext, } c::tag_table_node_type => { let ty = val_dsr.read_ty(xcx); - debug!("inserting ty for node %?: %s", + debug2!("inserting ty for node {:?}: {}", id, ty_to_str(dcx.tcx, ty)); dcx.tcx.node_types.insert(id as uint, ty); } @@ -1257,13 +1257,13 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext, } _ => { xcx.dcx.tcx.sess.bug( - fmt!("unknown tag found in side tables: %x", tag)); + format!("unknown tag found in side tables: {:x}", tag)); } } } } - debug!(">< Side table doc loaded"); + debug2!(">< Side table doc loaded"); true }; } @@ -1381,6 +1381,6 @@ fn test_simplification() { == pprust::item_to_str(item_exp, token::get_ident_interner())); } - _ => fail!() + _ => fail2!() } } diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index e8e658abc3745..5334bf7cc1de4 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -65,7 +65,7 @@ pub fn check_loans(bccx: &BorrowckCtxt, move_data: move_data::FlowedMoveData, all_loans: &[Loan], body: &ast::Block) { - debug!("check_loans(body id=%?)", body.id); + debug2!("check_loans(body id={:?})", body.id); let mut clcx = CheckLoanCtxt { bccx: bccx, @@ -94,12 +94,12 @@ impl<'self> CheckLoanCtxt<'self> { MoveWhileBorrowed(loan_path, loan_span) => { self.bccx.span_err( cap_var.span, - fmt!("cannot move `%s` into closure \ + format!("cannot move `{}` into closure \ because it is borrowed", self.bccx.loan_path_to_str(move_path))); self.bccx.span_note( loan_span, - fmt!("borrow of `%s` occurs here", + format!("borrow of `{}` occurs here", self.bccx.loan_path_to_str(loan_path))); } } @@ -197,10 +197,10 @@ impl<'self> CheckLoanCtxt<'self> { //! issued when we enter `scope_id` (for example, we do not //! permit two `&mut` borrows of the same variable). - debug!("check_for_conflicting_loans(scope_id=%?)", scope_id); + debug2!("check_for_conflicting_loans(scope_id={:?})", scope_id); let new_loan_indices = self.loans_generated_by(scope_id); - debug!("new_loan_indices = %?", new_loan_indices); + debug2!("new_loan_indices = {:?}", new_loan_indices); do self.each_issued_loan(scope_id) |issued_loan| { for &new_loan_index in new_loan_indices.iter() { @@ -225,7 +225,7 @@ impl<'self> CheckLoanCtxt<'self> { //! Checks whether `old_loan` and `new_loan` can safely be issued //! simultaneously. - debug!("report_error_if_loans_conflict(old_loan=%s, new_loan=%s)", + debug2!("report_error_if_loans_conflict(old_loan={}, new_loan={})", old_loan.repr(self.tcx()), new_loan.repr(self.tcx())); @@ -249,8 +249,8 @@ impl<'self> CheckLoanCtxt<'self> { //! Checks whether the restrictions introduced by `loan1` would //! prohibit `loan2`. Returns false if an error is reported. - debug!("report_error_if_loan_conflicts_with_restriction(\ - loan1=%s, loan2=%s)", + debug2!("report_error_if_loan_conflicts_with_restriction(\ + loan1={}, loan2={})", loan1.repr(self.tcx()), loan2.repr(self.tcx())); @@ -260,7 +260,7 @@ impl<'self> CheckLoanCtxt<'self> { ImmutableMutability => RESTR_ALIAS | RESTR_FREEZE, ConstMutability => RESTR_ALIAS, }; - debug!("illegal_if=%?", illegal_if); + debug2!("illegal_if={:?}", illegal_if); for restr in loan1.restrictions.iter() { if !restr.set.intersects(illegal_if) { loop; } @@ -270,12 +270,12 @@ impl<'self> CheckLoanCtxt<'self> { (MutableMutability, MutableMutability) => { self.bccx.span_err( new_loan.span, - fmt!("cannot borrow `%s` as mutable \ + format!("cannot borrow `{}` as mutable \ more than once at a time", self.bccx.loan_path_to_str(new_loan.loan_path))); self.bccx.span_note( old_loan.span, - fmt!("second borrow of `%s` as mutable occurs here", + format!("second borrow of `{}` as mutable occurs here", self.bccx.loan_path_to_str(new_loan.loan_path))); return false; } @@ -283,14 +283,14 @@ impl<'self> CheckLoanCtxt<'self> { _ => { self.bccx.span_err( new_loan.span, - fmt!("cannot borrow `%s` as %s because \ - it is also borrowed as %s", + format!("cannot borrow `{}` as {} because \ + it is also borrowed as {}", self.bccx.loan_path_to_str(new_loan.loan_path), self.bccx.mut_to_str(new_loan.mutbl), self.bccx.mut_to_str(old_loan.mutbl))); self.bccx.span_note( old_loan.span, - fmt!("second borrow of `%s` occurs here", + format!("second borrow of `{}` occurs here", self.bccx.loan_path_to_str(new_loan.loan_path))); return false; } @@ -317,7 +317,7 @@ impl<'self> CheckLoanCtxt<'self> { * is using a moved/uninitialized value */ - debug!("check_if_path_is_moved(id=%?, use_kind=%?, lp=%s)", + debug2!("check_if_path_is_moved(id={:?}, use_kind={:?}, lp={})", id, use_kind, lp.repr(self.bccx.tcx)); do self.move_data.each_move_of(id, lp) |move, moved_lp| { self.bccx.report_use_of_moved_value( @@ -338,7 +338,7 @@ impl<'self> CheckLoanCtxt<'self> { Some(&adj) => self.bccx.cat_expr_autoderefd(expr, adj) }; - debug!("check_assignment(cmt=%s)", cmt.repr(self.tcx())); + debug2!("check_assignment(cmt={})", cmt.repr(self.tcx())); // Mutable values can be assigned, as long as they obey loans // and aliasing restrictions: @@ -372,7 +372,7 @@ impl<'self> CheckLoanCtxt<'self> { // Otherwise, just a plain error. self.bccx.span_err( expr.span, - fmt!("cannot assign to %s %s", + format!("cannot assign to {} {}", cmt.mutbl.to_user_str(), self.bccx.cmt_to_str(cmt))); return; @@ -387,7 +387,7 @@ impl<'self> CheckLoanCtxt<'self> { let mut cmt = cmt; loop { - debug!("mark_writes_through_upvars_as_used_mut(cmt=%s)", + debug2!("mark_writes_through_upvars_as_used_mut(cmt={})", cmt.repr(this.tcx())); match cmt.cat { mc::cat_local(id) | @@ -435,7 +435,7 @@ impl<'self> CheckLoanCtxt<'self> { //! Safety checks related to writes to aliasable, mutable locations let guarantor = cmt.guarantor(); - debug!("check_for_aliasable_mutable_writes(cmt=%s, guarantor=%s)", + debug2!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})", cmt.repr(this.tcx()), guarantor.repr(this.tcx())); match guarantor.cat { mc::cat_deref(b, _, mc::region_ptr(MutMutable, _)) => { @@ -451,7 +451,7 @@ impl<'self> CheckLoanCtxt<'self> { id: guarantor.id, derefs: deref_count }; - debug!("Inserting write guard at %?", key); + debug2!("Inserting write guard at {:?}", key); this.bccx.write_guard_map.insert(key); } @@ -646,11 +646,11 @@ impl<'self> CheckLoanCtxt<'self> { loan: &Loan) { self.bccx.span_err( expr.span, - fmt!("cannot assign to `%s` because it is borrowed", + format!("cannot assign to `{}` because it is borrowed", self.bccx.loan_path_to_str(loan_path))); self.bccx.span_note( loan.span, - fmt!("borrow of `%s` occurs here", + format!("borrow of `{}` occurs here", self.bccx.loan_path_to_str(loan_path))); } @@ -674,12 +674,12 @@ impl<'self> CheckLoanCtxt<'self> { MoveWhileBorrowed(loan_path, loan_span) => { self.bccx.span_err( span, - fmt!("cannot move out of `%s` \ + format!("cannot move out of `{}` \ because it is borrowed", self.bccx.loan_path_to_str(move_path))); self.bccx.span_note( loan_span, - fmt!("borrow of `%s` occurs here", + format!("borrow of `{}` occurs here", self.bccx.loan_path_to_str(loan_path))); } } @@ -690,7 +690,7 @@ impl<'self> CheckLoanCtxt<'self> { pub fn analyze_move_out_from(&self, expr_id: ast::NodeId, move_path: @LoanPath) -> MoveError { - debug!("analyze_move_out_from(expr_id=%?, move_path=%s)", + debug2!("analyze_move_out_from(expr_id={:?}, move_path={})", expr_id, move_path.repr(self.tcx())); // FIXME(#4384) inadequare if/when we permit `move a.b` @@ -772,12 +772,12 @@ fn check_loans_in_fn<'a>(this: &mut CheckLoanCtxt<'a>, MoveWhileBorrowed(loan_path, loan_span) => { this.bccx.span_err( cap_var.span, - fmt!("cannot move `%s` into closure \ + format!("cannot move `{}` into closure \ because it is borrowed", this.bccx.loan_path_to_str(move_path))); this.bccx.span_note( loan_span, - fmt!("borrow of `%s` occurs here", + format!("borrow of `{}` occurs here", this.bccx.loan_path_to_str(loan_path))); } } @@ -794,7 +794,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>, expr: @ast::Expr) { visit::walk_expr(this, expr, ()); - debug!("check_loans_in_expr(expr=%s)", + debug2!("check_loans_in_expr(expr={})", expr.repr(this.tcx())); this.check_for_conflicting_loans(expr.id); @@ -805,7 +805,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>, ast::ExprPath(*) => { if !this.move_data.is_assignee(expr.id) { let cmt = this.bccx.cat_expr_unadjusted(expr); - debug!("path cmt=%s", cmt.repr(this.tcx())); + debug2!("path cmt={}", cmt.repr(this.tcx())); let r = opt_loan_path(cmt); for &lp in r.iter() { this.check_if_path_is_moved(expr.id, expr.span, MovedInUse, lp); diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs index 549a7fe195c88..a6db028a4919b 100644 --- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs @@ -105,7 +105,7 @@ fn check_is_legal_to_move_from(bccx: &BorrowckCtxt, mc::cat_deref(_, _, mc::unsafe_ptr(*)) => { bccx.span_err( cmt0.span, - fmt!("cannot move out of %s", + format!("cannot move out of {}", bccx.cmt_to_str(cmt))); false } @@ -120,7 +120,7 @@ fn check_is_legal_to_move_from(bccx: &BorrowckCtxt, }; bccx.span_err( cmt0.span, - fmt!("cannot move out of %s%s", bccx.cmt_to_str(cmt), once_hint)); + format!("cannot move out of {}{}", bccx.cmt_to_str(cmt), once_hint)); false } @@ -158,7 +158,7 @@ fn check_is_legal_to_move_from(bccx: &BorrowckCtxt, if ty::has_dtor(bccx.tcx, did) { bccx.span_err( cmt0.span, - fmt!("cannot move out of type `%s`, \ + format!("cannot move out of type `{}`, \ which defines the `Drop` trait", b.ty.user_string(bccx.tcx))); false diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs index 2d71eef4de9c1..485004a642cfb 100644 --- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs +++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs @@ -27,7 +27,7 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt, cmt: mc::cmt, loan_region: ty::Region, loan_mutbl: LoanMutability) { - debug!("guarantee_lifetime(cmt=%s, loan_region=%s)", + debug2!("guarantee_lifetime(cmt={}, loan_region={})", cmt.repr(bccx.tcx), loan_region.repr(bccx.tcx)); let ctxt = GuaranteeLifetimeContext {bccx: bccx, item_scope_id: item_scope_id, @@ -101,7 +101,7 @@ impl<'self> GuaranteeLifetimeContext<'self> { // L-Deref-Managed-Mut-Compiler-Root self.check_root(cmt, base, derefs, ptr_mutbl, discr_scope); } else { - debug!("omitting root, base=%s, base_scope=%?", + debug2!("omitting root, base={}, base_scope={:?}", base.repr(self.tcx()), base_scope); } } @@ -189,8 +189,8 @@ impl<'self> GuaranteeLifetimeContext<'self> { derefs: uint, ptr_mutbl: ast::Mutability, discr_scope: Option) { - debug!("check_root(cmt_deref=%s, cmt_base=%s, derefs=%?, ptr_mutbl=%?, \ - discr_scope=%?)", + debug2!("check_root(cmt_deref={}, cmt_base={}, derefs={:?}, ptr_mutbl={:?}, \ + discr_scope={:?})", cmt_deref.repr(self.tcx()), cmt_base.repr(self.tcx()), derefs, @@ -213,7 +213,7 @@ impl<'self> GuaranteeLifetimeContext<'self> { // the check above should fail for anything is not re_scope self.bccx.tcx.sess.span_bug( cmt_base.span, - fmt!("Cannot issue root for scope region: %?", + format!("Cannot issue root for scope region: {:?}", self.loan_region)); } }; @@ -247,7 +247,7 @@ impl<'self> GuaranteeLifetimeContext<'self> { // FIXME(#3511) grow to the nearest cleanup scope---this can // cause observable errors if freezing! if !self.bccx.tcx.region_maps.is_cleanup_scope(root_scope) { - debug!("%? is not a cleanup scope, adjusting", root_scope); + debug2!("{:?} is not a cleanup scope, adjusting", root_scope); let cleanup_scope = self.bccx.tcx.region_maps.cleanup_scope(root_scope); @@ -255,8 +255,8 @@ impl<'self> GuaranteeLifetimeContext<'self> { if opt_dyna.is_some() { self.tcx().sess.span_warn( self.span, - fmt!("Dynamic freeze scope artifically extended \ - (see Issue #6248)")); + format!("Dynamic freeze scope artifically extended \ + (see Issue \\#6248)")); note_and_explain_region( self.bccx.tcx, "managed value only needs to be frozen for ", @@ -277,7 +277,7 @@ impl<'self> GuaranteeLifetimeContext<'self> { let root_info = RootInfo {scope: root_scope, freeze: opt_dyna}; self.bccx.root_map.insert(rm_key, root_info); - debug!("root_key: %? root_info: %?", rm_key, root_info); + debug2!("root_key: {:?} root_info: {:?}", rm_key, root_info); } fn check_scope(&self, max_scope: ty::Region) { @@ -310,7 +310,7 @@ impl<'self> GuaranteeLifetimeContext<'self> { r @ mc::cat_discr(*) => { self.tcx().sess.span_bug( cmt.span, - fmt!("illegal guarantor category: %?", r)); + format!("illegal guarantor category: {:?}", r)); } } } diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index 4c52634144688..b3980c2e045b9 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -136,7 +136,7 @@ fn gather_loans_in_fn(this: &mut GatherLoanCtxt, id: ast::NodeId) { match fk { &visit::fk_item_fn(*) | &visit::fk_method(*) => { - fail!("cannot occur, due to visit_item override"); + fail2!("cannot occur, due to visit_item override"); } // Visit closures as part of the containing item. @@ -196,7 +196,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt, let bccx = this.bccx; let tcx = bccx.tcx; - debug!("gather_loans_in_expr(expr=%?/%s)", + debug2!("gather_loans_in_expr(expr={:?}/{})", ex.id, pprust::expr_to_str(ex, tcx.sess.intr())); this.id_range.add(ex.id); @@ -330,20 +330,20 @@ impl<'self> GatherLoanCtxt<'self> { pub fn guarantee_adjustments(&mut self, expr: @ast::Expr, adjustment: &ty::AutoAdjustment) { - debug!("guarantee_adjustments(expr=%s, adjustment=%?)", + debug2!("guarantee_adjustments(expr={}, adjustment={:?})", expr.repr(self.tcx()), adjustment); let _i = indenter(); match *adjustment { ty::AutoAddEnv(*) => { - debug!("autoaddenv -- no autoref"); + debug2!("autoaddenv -- no autoref"); return; } ty::AutoDerefRef( ty::AutoDerefRef { autoref: None, _ }) => { - debug!("no autoref"); + debug2!("no autoref"); return; } @@ -355,7 +355,7 @@ impl<'self> GatherLoanCtxt<'self> { tcx: self.tcx(), method_map: self.bccx.method_map}; let cmt = mcx.cat_expr_autoderefd(expr, autoderefs); - debug!("after autoderef, cmt=%s", cmt.repr(self.tcx())); + debug2!("after autoderef, cmt={}", cmt.repr(self.tcx())); match *autoref { ty::AutoPtr(r, m) => { @@ -412,8 +412,8 @@ impl<'self> GatherLoanCtxt<'self> { cmt: mc::cmt, req_mutbl: LoanMutability, loan_region: ty::Region) { - debug!("guarantee_valid(borrow_id=%?, cmt=%s, \ - req_mutbl=%?, loan_region=%?)", + debug2!("guarantee_valid(borrow_id={:?}, cmt={}, \ + req_mutbl={:?}, loan_region={:?})", borrow_id, cmt.repr(self.tcx()), req_mutbl, @@ -470,16 +470,16 @@ impl<'self> GatherLoanCtxt<'self> { ty::re_infer(*) => { self.tcx().sess.span_bug( cmt.span, - fmt!("Invalid borrow lifetime: %?", loan_region)); + format!("Invalid borrow lifetime: {:?}", loan_region)); } }; - debug!("loan_scope = %?", loan_scope); + debug2!("loan_scope = {:?}", loan_scope); let gen_scope = self.compute_gen_scope(borrow_id, loan_scope); - debug!("gen_scope = %?", gen_scope); + debug2!("gen_scope = {:?}", gen_scope); let kill_scope = self.compute_kill_scope(loan_scope, loan_path); - debug!("kill_scope = %?", kill_scope); + debug2!("kill_scope = {:?}", kill_scope); if req_mutbl == MutableMutability { self.mark_loan_path_as_mutated(loan_path); @@ -499,7 +499,7 @@ impl<'self> GatherLoanCtxt<'self> { } }; - debug!("guarantee_valid(borrow_id=%?), loan=%s", + debug2!("guarantee_valid(borrow_id={:?}), loan={}", borrow_id, loan.repr(self.tcx())); // let loan_path = loan.loan_path; @@ -785,7 +785,7 @@ impl<'self> GatherLoanCtxt<'self> { _ => { self.tcx().sess.span_bug( pat.span, - fmt!("Type of slice pattern is not a slice")); + format!("Type of slice pattern is not a slice")); } } } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 8b9dc40777a88..f2bfc6fb4ec2e 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -117,7 +117,7 @@ pub fn check_crate( fn make_stat(bccx: &mut BorrowckCtxt, stat: uint) -> ~str { let stat_f = stat as float; let total = bccx.stats.guaranteed_paths as float; - fmt!("%u (%.0f%%)", stat , stat_f * 100f / total) + format!("{} ({:.0f}%)", stat , stat_f * 100f / total) } } @@ -135,7 +135,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt, &visit::fk_item_fn(*) | &visit::fk_method(*) => { - debug!("borrowck_fn(id=%?)", id); + debug2!("borrowck_fn(id={:?})", id); // Check the body of fn items. let (id_range, all_loans, move_data) = @@ -561,7 +561,7 @@ impl BorrowckCtxt { move_data::Declared => { self.tcx.sess.span_err( use_span, - fmt!("%s of possibly uninitialized value: `%s`", + format!("{} of possibly uninitialized value: `{}`", verb, self.loan_path_to_str(lp))); } @@ -569,7 +569,7 @@ impl BorrowckCtxt { let partially = if lp == moved_lp {""} else {"partially "}; self.tcx.sess.span_err( use_span, - fmt!("%s of %smoved value: `%s`", + format!("{} of {}moved value: `{}`", verb, partially, self.loan_path_to_str(lp))); @@ -585,7 +585,7 @@ impl BorrowckCtxt { "moved by default (use `copy` to override)"); self.tcx.sess.span_note( expr.span, - fmt!("`%s` moved here because it has type `%s`, which is %s", + format!("`{}` moved here because it has type `{}`, which is {}", self.loan_path_to_str(moved_lp), expr_ty.user_string(self.tcx), suggestion)); } @@ -594,7 +594,7 @@ impl BorrowckCtxt { let pat_ty = ty::node_id_to_type(self.tcx, pat.id); self.tcx.sess.span_note( pat.span, - fmt!("`%s` moved here because it has type `%s`, \ + format!("`{}` moved here because it has type `{}`, \ which is moved by default (use `ref` to override)", self.loan_path_to_str(moved_lp), pat_ty.user_string(self.tcx))); @@ -607,8 +607,8 @@ impl BorrowckCtxt { capture that instead to override)"); self.tcx.sess.span_note( expr.span, - fmt!("`%s` moved into closure environment here because it \ - has type `%s`, which is %s", + format!("`{}` moved into closure environment here because it \ + has type `{}`, which is {}", self.loan_path_to_str(moved_lp), expr_ty.user_string(self.tcx), suggestion)); } @@ -634,11 +634,11 @@ impl BorrowckCtxt { &move_data::Assignment) { self.tcx.sess.span_err( span, - fmt!("re-assignment of immutable variable `%s`", + format!("re-assignment of immutable variable `{}`", self.loan_path_to_str(lp))); self.tcx.sess.span_note( assign.span, - fmt!("prior assignment occurs here")); + format!("prior assignment occurs here")); } pub fn span_err(&self, s: Span, m: &str) { @@ -652,23 +652,23 @@ impl BorrowckCtxt { pub fn bckerr_to_str(&self, err: BckError) -> ~str { match err.code { err_mutbl(lk) => { - fmt!("cannot borrow %s %s as %s", + format!("cannot borrow {} {} as {}", err.cmt.mutbl.to_user_str(), self.cmt_to_str(err.cmt), self.mut_to_str(lk)) } err_out_of_root_scope(*) => { - fmt!("cannot root managed value long enough") + format!("cannot root managed value long enough") } err_out_of_scope(*) => { - fmt!("borrowed value does not live long enough") + format!("borrowed value does not live long enough") } err_freeze_aliasable_const => { // Means that the user borrowed a ~T or enum value // residing in &const or @const pointer. Terrible // error message, but then &const and @const are // supposed to be going away. - fmt!("unsafe borrow of aliasable, const value") + format!("unsafe borrow of aliasable, const value") } } } @@ -686,19 +686,19 @@ impl BorrowckCtxt { mc::AliasableOther => { self.tcx.sess.span_err( span, - fmt!("%s in an aliasable location", prefix)); + format!("{} in an aliasable location", prefix)); } mc::AliasableManaged(ast::MutMutable) => { // FIXME(#6269) reborrow @mut to &mut self.tcx.sess.span_err( span, - fmt!("%s in a `@mut` pointer; \ + format!("{} in a `@mut` pointer; \ try borrowing as `&mut` first", prefix)); } mc::AliasableManaged(m) => { self.tcx.sess.span_err( span, - fmt!("%s in a `@%s` pointer; \ + format!("{} in a `@{}` pointer; \ try an `@mut` instead", prefix, self.mut_to_keyword(m))); @@ -706,7 +706,7 @@ impl BorrowckCtxt { mc::AliasableBorrowed(m) => { self.tcx.sess.span_err( span, - fmt!("%s in a `&%s` pointer; \ + format!("{} in a `&{}` pointer; \ try an `&mut` instead", prefix, self.mut_to_keyword(m))); @@ -774,7 +774,7 @@ impl BorrowckCtxt { } r => { self.tcx.sess.bug( - fmt!("Loan path LpVar(%?) maps to %?, not local", + format!("Loan path LpVar({:?}) maps to {:?}, not local", id, r)); } } @@ -849,7 +849,7 @@ impl DataFlowOperator for LoanDataFlowOperator { impl Repr for Loan { fn repr(&self, tcx: ty::ctxt) -> ~str { - fmt!("Loan_%?(%s, %?, %?-%?, %s)", + format!("Loan_{:?}({}, {:?}, {:?}-{:?}, {})", self.index, self.loan_path.repr(tcx), self.mutbl, @@ -861,7 +861,7 @@ impl Repr for Loan { impl Repr for Restriction { fn repr(&self, tcx: ty::ctxt) -> ~str { - fmt!("Restriction(%s, %x)", + format!("Restriction({}, {:x})", self.loan_path.repr(tcx), self.set.bits as uint) } @@ -871,15 +871,15 @@ impl Repr for LoanPath { fn repr(&self, tcx: ty::ctxt) -> ~str { match self { &LpVar(id) => { - fmt!("$(%?)", id) + format!("$({:?})", id) } &LpExtend(lp, _, LpDeref(_)) => { - fmt!("%s.*", lp.repr(tcx)) + format!("{}.*", lp.repr(tcx)) } &LpExtend(lp, _, LpInterior(ref interior)) => { - fmt!("%s.%s", lp.repr(tcx), interior.repr(tcx)) + format!("{}.{}", lp.repr(tcx), interior.repr(tcx)) } } } diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index d7423fddd76a0..239254e82dd52 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -244,7 +244,7 @@ impl MoveData { } }; - debug!("move_path(lp=%s, index=%?)", + debug2!("move_path(lp={}, index={:?})", lp.repr(tcx), index); @@ -304,7 +304,7 @@ impl MoveData { * location `id` with kind `kind`. */ - debug!("add_move(lp=%s, id=%?, kind=%?)", + debug2!("add_move(lp={}, id={:?}, kind={:?})", lp.repr(tcx), id, kind); @@ -334,7 +334,7 @@ impl MoveData { * location `id` with the given `span`. */ - debug!("add_assignment(lp=%s, assign_id=%?, assignee_id=%?", + debug2!("add_assignment(lp={}, assign_id={:?}, assignee_id={:?}", lp.repr(tcx), assign_id, assignee_id); let path_index = self.move_path(tcx, lp); @@ -348,12 +348,12 @@ impl MoveData { }; if self.is_var_path(path_index) { - debug!("add_assignment[var](lp=%s, assignment=%u, path_index=%?)", + debug2!("add_assignment[var](lp={}, assignment={}, path_index={:?})", lp.repr(tcx), self.var_assignments.len(), path_index); self.var_assignments.push(assignment); } else { - debug!("add_assignment[path](lp=%s, path_index=%?)", + debug2!("add_assignment[path](lp={}, path_index={:?})", lp.repr(tcx), path_index); self.path_assignments.push(assignment); diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index 2a224b9fd32c5..9e92bd3829c5d 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -239,7 +239,7 @@ impl CFGBuilder { expr_exit } - ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ast::ExprLoop(ref body, _) => { // @@ -504,13 +504,13 @@ impl CFGBuilder { } self.tcx.sess.span_bug( expr.span, - fmt!("No loop scope for id %?", loop_id)); + format!("No loop scope for id {:?}", loop_id)); } r => { self.tcx.sess.span_bug( expr.span, - fmt!("Bad entry `%?` in def_map for label", r)); + format!("Bad entry `{:?}` in def_map for label", r)); } } } diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 3a50306bb8766..30cf827cb72cf 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -153,7 +153,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor, Some(&DefStruct(_)) => { } Some(&def) => { - debug!("(checking const) found bad def: %?", def); + debug2!("(checking const) found bad def: {:?}", def); sess.span_err( e.span, "paths in constants may only refer to \ @@ -266,7 +266,7 @@ impl Visitor<()> for CheckItemRecursionVisitor { ast_map::node_item(it, _) => { self.visit_item(it, ()); } - _ => fail!("const not bound to an item") + _ => fail2!("const not bound to an item") }, _ => () }, diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index a726644c15a79..8befb42f300e2 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -86,8 +86,8 @@ pub fn check_expr(v: &mut CheckMatchVisitor, if (*arms).is_empty() { if !type_is_empty(cx.tcx, pat_ty) { // We know the type is inhabited, so this must be wrong - cx.tcx.sess.span_err(ex.span, fmt!("non-exhaustive patterns: \ - type %s is non-empty", + cx.tcx.sess.span_err(ex.span, format!("non-exhaustive patterns: \ + type {} is non-empty", ty_to_str(cx.tcx, pat_ty))); } // If the type *is* empty, it's vacuously exhaustive @@ -180,20 +180,20 @@ pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) { ty::ty_enum(id, _) => { let vid = match *ctor { variant(id) => id, - _ => fail!("check_exhaustive: non-variant ctor"), + _ => fail2!("check_exhaustive: non-variant ctor"), }; let variants = ty::enum_variants(cx.tcx, id); match variants.iter().find(|v| v.id == vid) { Some(v) => Some(cx.tcx.sess.str_of(v.name)), None => { - fail!("check_exhaustive: bad variant in ctor") + fail2!("check_exhaustive: bad variant in ctor") } } } ty::ty_unboxed_vec(*) | ty::ty_evec(*) => { match *ctor { - vec(n) => Some(fmt!("vectors of length %u", n).to_managed()), + vec(n) => Some(format!("vectors of length {}", n).to_managed()), _ => None } } @@ -202,7 +202,7 @@ pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) { } }; let msg = ~"non-exhaustive patterns" + match ext { - Some(ref s) => fmt!(": %s not covered", *s), + Some(ref s) => format!(": {} not covered", *s), None => ~"" }; cx.tcx.sess.span_err(sp, msg); @@ -408,7 +408,7 @@ pub fn missing_ctor(cx: &MatchCheckCtxt, return Some(variant(v.id)); } } - fail!(); + fail2!(); } else { None } } ty::ty_nil => None, @@ -420,7 +420,7 @@ pub fn missing_ctor(cx: &MatchCheckCtxt, None => (), Some(val(const_bool(true))) => true_found = true, Some(val(const_bool(false))) => false_found = true, - _ => fail!("impossible case") + _ => fail2!("impossible case") } } if true_found && false_found { None } @@ -510,10 +510,10 @@ pub fn ctor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint { ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) => 1u, ty::ty_enum(eid, _) => { let id = match *ctor { variant(id) => id, - _ => fail!("impossible case") }; + _ => fail2!("impossible case") }; match ty::enum_variants(cx.tcx, eid).iter().find(|v| v.id == id ) { Some(v) => v.args.len(), - None => fail!("impossible case") + None => fail2!("impossible case") } } ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(), @@ -584,7 +584,7 @@ pub fn specialize(cx: &MatchCheckCtxt, } } single => true, - _ => fail!("type error") + _ => fail2!("type error") }; if match_ { Some(r.tail().to_owned()) @@ -631,7 +631,7 @@ pub fn specialize(cx: &MatchCheckCtxt, } } single => true, - _ => fail!("type error") + _ => fail2!("type error") }; if match_ { Some(r.tail().to_owned()) @@ -693,7 +693,7 @@ pub fn specialize(cx: &MatchCheckCtxt, _ => { cx.tcx.sess.span_bug( pat_span, - fmt!("struct pattern resolved to %s, \ + format!("struct pattern resolved to {}, \ not a struct", ty_to_str(cx.tcx, left_ty))); } @@ -739,7 +739,7 @@ pub fn specialize(cx: &MatchCheckCtxt, } } single => true, - _ => fail!("type error") + _ => fail2!("type error") }; if match_ { Some(r.tail().to_owned()) } else { None } } @@ -748,7 +748,7 @@ pub fn specialize(cx: &MatchCheckCtxt, val(ref v) => (*v, *v), range(ref lo, ref hi) => (*lo, *hi), single => return Some(r.tail().to_owned()), - _ => fail!("type error") + _ => fail2!("type error") }; let v_lo = eval_const_expr(cx.tcx, lo); let v_hi = eval_const_expr(cx.tcx, hi); @@ -929,8 +929,8 @@ pub fn check_legality_of_move_bindings(cx: &MatchCheckCtxt, _ => { cx.tcx.sess.span_bug( p.span, - fmt!("Binding pattern %d is \ - not an identifier: %?", + format!("Binding pattern {} is \ + not an identifier: {:?}", p.id, p.node)); } } diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 0e4d2bcd9103f..b9355d3266377 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -103,20 +103,20 @@ impl pprust::pp_ann for DataFlowContext { let gens = self.gens.slice(start, end); let gens_str = if gens.iter().any(|&u| u != 0) { - fmt!(" gen: %s", bits_to_str(gens)) + format!(" gen: {}", bits_to_str(gens)) } else { ~"" }; let kills = self.kills.slice(start, end); let kills_str = if kills.iter().any(|&u| u != 0) { - fmt!(" kill: %s", bits_to_str(kills)) + format!(" kill: {}", bits_to_str(kills)) } else { ~"" }; - let comment_str = fmt!("id %d: %s%s%s", - id, entry_str, gens_str, kills_str); + let comment_str = format!("id {}: {}{}{}", + id, entry_str, gens_str, kills_str); pprust::synth_comment(ps, comment_str); pp::space(ps.s); } @@ -131,7 +131,7 @@ impl DataFlowContext { bits_per_id: uint) -> DataFlowContext { let words_per_id = (bits_per_id + uint::bits - 1) / uint::bits; - debug!("DataFlowContext::new(id_range=%?, bits_per_id=%?, words_per_id=%?)", + debug2!("DataFlowContext::new(id_range={:?}, bits_per_id={:?}, words_per_id={:?})", id_range, bits_per_id, words_per_id); let gens = ~[]; @@ -154,7 +154,7 @@ impl DataFlowContext { pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) { //! Indicates that `id` generates `bit` - debug!("add_gen(id=%?, bit=%?)", id, bit); + debug2!("add_gen(id={:?}, bit={:?})", id, bit); let (start, end) = self.compute_id_range(id); { let gens = self.gens.mut_slice(start, end); @@ -165,7 +165,7 @@ impl DataFlowContext { pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) { //! Indicates that `id` kills `bit` - debug!("add_kill(id=%?, bit=%?)", id, bit); + debug2!("add_kill(id={:?}, bit={:?})", id, bit); let (start, end) = self.compute_id_range(id); { let kills = self.kills.mut_slice(start, end); @@ -176,7 +176,7 @@ impl DataFlowContext { fn apply_gen_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) { //! Applies the gen and kill sets for `id` to `bits` - debug!("apply_gen_kill(id=%?, bits=%s) [before]", + debug2!("apply_gen_kill(id={:?}, bits={}) [before]", id, mut_bits_to_str(bits)); let (start, end) = self.compute_id_range(id); let gens = self.gens.slice(start, end); @@ -184,17 +184,17 @@ impl DataFlowContext { let kills = self.kills.slice(start, end); bitwise(bits, kills, |a, b| a & !b); - debug!("apply_gen_kill(id=%?, bits=%s) [after]", + debug2!("apply_gen_kill(id={:?}, bits={}) [after]", id, mut_bits_to_str(bits)); } fn apply_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) { - debug!("apply_kill(id=%?, bits=%s) [before]", + debug2!("apply_kill(id={:?}, bits={}) [before]", id, mut_bits_to_str(bits)); let (start, end) = self.compute_id_range(id); let kills = self.kills.slice(start, end); bitwise(bits, kills, |a, b| a & !b); - debug!("apply_kill(id=%?, bits=%s) [after]", + debug2!("apply_kill(id={:?}, bits={}) [after]", id, mut_bits_to_str(bits)); } @@ -242,7 +242,7 @@ impl DataFlowContext { } let (start, end) = self.compute_id_range_frozen(id); let on_entry = self.on_entry.slice(start, end); - debug!("each_bit_on_entry_frozen(id=%?, on_entry=%s)", + debug2!("each_bit_on_entry_frozen(id={:?}, on_entry={})", id, bits_to_str(on_entry)); self.each_bit(on_entry, f) } @@ -255,7 +255,7 @@ impl DataFlowContext { let (start, end) = self.compute_id_range(id); let on_entry = self.on_entry.slice(start, end); - debug!("each_bit_on_entry(id=%?, on_entry=%s)", + debug2!("each_bit_on_entry(id={:?}, on_entry={})", id, bits_to_str(on_entry)); self.each_bit(on_entry, f) } @@ -267,7 +267,7 @@ impl DataFlowContext { let (start, end) = self.compute_id_range(id); let gens = self.gens.slice(start, end); - debug!("each_gen_bit(id=%?, gens=%s)", + debug2!("each_gen_bit(id={:?}, gens={})", id, bits_to_str(gens)); self.each_bit(gens, f) } @@ -281,7 +281,7 @@ impl DataFlowContext { } let (start, end) = self.compute_id_range_frozen(id); let gens = self.gens.slice(start, end); - debug!("each_gen_bit(id=%?, gens=%s)", + debug2!("each_gen_bit(id={:?}, gens={})", id, bits_to_str(gens)); self.each_bit(gens, f) } @@ -346,8 +346,8 @@ impl DataFlowContext { } } - debug!("Dataflow result:"); - debug!("%s", { + debug2!("Dataflow result:"); + debug2!("{}", { let this = @(*self).clone(); this.pretty_print_to(io::stderr(), blk); "" @@ -374,7 +374,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { blk: &ast::Block, in_out: &mut [uint], loop_scopes: &mut ~[LoopScope]) { - debug!("DataFlowContext::walk_block(blk.id=%?, in_out=%s)", + debug2!("DataFlowContext::walk_block(blk.id={:?}, in_out={})", blk.id, bits_to_str(reslice(in_out))); self.merge_with_entry_set(blk.id, in_out); @@ -425,7 +425,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { expr: &ast::Expr, in_out: &mut [uint], loop_scopes: &mut ~[LoopScope]) { - debug!("DataFlowContext::walk_expr(expr=%s, in_out=%s)", + debug2!("DataFlowContext::walk_expr(expr={}, in_out={})", expr.repr(self.dfcx.tcx), bits_to_str(reslice(in_out))); self.merge_with_entry_set(expr.id, in_out); @@ -569,7 +569,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { copy_bits(new_loop_scope.break_bits, in_out); } - ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ast::ExprLoop(ref blk, _) => { // @@ -756,7 +756,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { let tcx = self.tcx(); let region_maps = tcx.region_maps; - debug!("pop_scopes(from_expr=%s, to_scope=%?, in_out=%s)", + debug2!("pop_scopes(from_expr={}, to_scope={:?}, in_out={})", from_expr.repr(tcx), to_scope.loop_id, bits_to_str(reslice(in_out))); @@ -769,7 +769,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { None => { tcx.sess.span_bug( from_expr.span, - fmt!("pop_scopes(from_expr=%s, to_scope=%?) \ + format!("pop_scopes(from_expr={}, to_scope={:?}) \ to_scope does not enclose from_expr", from_expr.repr(tcx), to_scope.loop_id)); } @@ -784,7 +784,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { self.pop_scopes(from_expr, to_scope, in_out); self.dfcx.apply_kill(from_expr.id, in_out); join_bits(&self.dfcx.oper, reslice(in_out), to_scope.break_bits); - debug!("break_from_to(from_expr=%s, to_scope=%?) final break_bits=%s", + debug2!("break_from_to(from_expr={}, to_scope={:?}) final break_bits={}", from_expr.repr(self.tcx()), to_scope.loop_id, bits_to_str(reslice(in_out))); @@ -833,11 +833,11 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { pat: @ast::Pat, in_out: &mut [uint], _loop_scopes: &mut ~[LoopScope]) { - debug!("DataFlowContext::walk_pat(pat=%s, in_out=%s)", + debug2!("DataFlowContext::walk_pat(pat={}, in_out={})", pat.repr(self.dfcx.tcx), bits_to_str(reslice(in_out))); do ast_util::walk_pat(pat) |p| { - debug!(" p.id=%? in_out=%s", p.id, bits_to_str(reslice(in_out))); + debug2!(" p.id={:?} in_out={}", p.id, bits_to_str(reslice(in_out))); self.merge_with_entry_set(p.id, in_out); self.dfcx.apply_gen_kill(p.id, in_out); true @@ -882,7 +882,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { None => { self.tcx().sess.span_bug( expr.span, - fmt!("No loop scope for id %?", loop_id)); + format!("No loop scope for id {:?}", loop_id)); } } } @@ -890,7 +890,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { r => { self.tcx().sess.span_bug( expr.span, - fmt!("Bad entry `%?` in def_map for label", r)); + format!("Bad entry `{:?}` in def_map for label", r)); } } } @@ -909,7 +909,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { } fn add_to_entry_set(&mut self, id: ast::NodeId, pred_bits: &[uint]) { - debug!("add_to_entry_set(id=%?, pred_bits=%s)", + debug2!("add_to_entry_set(id={:?}, pred_bits={})", id, bits_to_str(pred_bits)); let (start, end) = self.dfcx.compute_id_range(id); let changed = { // FIXME(#5074) awkward construction @@ -917,7 +917,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { join_bits(&self.dfcx.oper, pred_bits, on_entry) }; if changed { - debug!("changed entry set for %? to %s", + debug2!("changed entry set for {:?} to {}", id, bits_to_str(self.dfcx.on_entry.slice(start, end))); self.changed = true; } @@ -926,7 +926,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { fn merge_with_entry_set(&mut self, id: ast::NodeId, pred_bits: &mut [uint]) { - debug!("merge_with_entry_set(id=%?, pred_bits=%s)", + debug2!("merge_with_entry_set(id={:?}, pred_bits={})", id, mut_bits_to_str(pred_bits)); let (start, end) = self.dfcx.compute_id_range(id); let changed = { // FIXME(#5074) awkward construction @@ -936,7 +936,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> { changed }; if changed { - debug!("changed entry set for %? to %s", + debug2!("changed entry set for {:?} to {}", id, bits_to_str(self.dfcx.on_entry.slice(start, end))); self.changed = true; } @@ -957,7 +957,7 @@ fn bits_to_str(words: &[uint]) -> ~str { let mut v = word; for _ in range(0u, uint::bytes) { result.push_char(sep); - result.push_str(fmt!("%02x", v & 0xFF)); + result.push_str(format!("{:02x}", v & 0xFF)); v >>= 8; sep = '-'; } @@ -992,12 +992,12 @@ fn bitwise(out_vec: &mut [uint], } fn set_bit(words: &mut [uint], bit: uint) -> bool { - debug!("set_bit: words=%s bit=%s", + debug2!("set_bit: words={} bit={}", mut_bits_to_str(words), bit_str(bit)); let word = bit / uint::bits; let bit_in_word = bit % uint::bits; let bit_mask = 1 << bit_in_word; - debug!("word=%u bit_in_word=%u bit_mask=%u", word, bit_in_word, word); + debug2!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word); let oldv = words[word]; let newv = oldv | bit_mask; words[word] = newv; @@ -1007,7 +1007,7 @@ fn set_bit(words: &mut [uint], bit: uint) -> bool { fn bit_str(bit: uint) -> ~str { let byte = bit >> 8; let lobits = 1 << (bit & 0xFF); - fmt!("[%u:%u-%02x]", bit, byte, lobits) + format!("[{}:{}-{:02x}]", bit, byte, lobits) } fn reslice<'a>(v: &'a mut [uint]) -> &'a [uint] { diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index 9c02f544fbaeb..6d479ca220a06 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -58,12 +58,12 @@ impl EffectCheckVisitor { SafeContext => { // Report an error. self.tcx.sess.span_err(span, - fmt!("%s requires unsafe function or block", + format!("{} requires unsafe function or block", description)) } UnsafeBlock(block_id) => { // OK, but record this. - debug!("effect: recording unsafe block as used: %?", block_id); + debug2!("effect: recording unsafe block as used: {:?}", block_id); let _ = self.tcx.used_unsafe.insert(block_id); } UnsafeFn => {} @@ -119,7 +119,7 @@ impl Visitor<()> for EffectCheckVisitor { match expr.node { ExprMethodCall(callee_id, _, _, _, _, _) => { let base_type = ty::node_id_to_type(self.tcx, callee_id); - debug!("effect: method call case, base type is %s", + debug2!("effect: method call case, base type is {}", ppaux::ty_to_str(self.tcx, base_type)); if type_is_unsafe_function(base_type) { self.require_unsafe(expr.span, @@ -128,7 +128,7 @@ impl Visitor<()> for EffectCheckVisitor { } ExprCall(base, _, _) => { let base_type = ty::node_id_to_type(self.tcx, base.id); - debug!("effect: call case, base type is %s", + debug2!("effect: call case, base type is {}", ppaux::ty_to_str(self.tcx, base_type)); if type_is_unsafe_function(base_type) { self.require_unsafe(expr.span, "call to unsafe function") @@ -136,7 +136,7 @@ impl Visitor<()> for EffectCheckVisitor { } ExprUnary(_, UnDeref, base) => { let base_type = ty::node_id_to_type(self.tcx, base.id); - debug!("effect: unary case, base type is %s", + debug2!("effect: unary case, base type is {}", ppaux::ty_to_str(self.tcx, base_type)); match ty::get(base_type).sty { ty_ptr(_) => { diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs index ea6ff90634a00..383c37952d7a7 100644 --- a/src/librustc/middle/freevars.rs +++ b/src/librustc/middle/freevars.rs @@ -53,7 +53,7 @@ impl Visitor for CollectFreevarsVisitor { ast::ExprPath(*) | ast::ExprSelf => { let mut i = 0; match self.def_map.find(&expr.id) { - None => fail!("path not found"), + None => fail2!("path not found"), Some(&df) => { let mut def = df; while i < depth { @@ -137,7 +137,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: &ast::Crate) -> pub fn get_freevars(tcx: ty::ctxt, fid: ast::NodeId) -> freevar_info { match tcx.freevars.find(&fid) { - None => fail!("get_freevars: %d has no freevars", fid), + None => fail2!("get_freevars: {} has no freevars", fid), Some(&d) => return d } } diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 46394454d006f..98912b57572a6 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -343,7 +343,7 @@ mod test { do graph.each_incoming_edge(start_index) |edge_index, edge| { assert_eq!(graph.edge_data(edge_index), &edge.data); assert!(counter < expected_incoming.len()); - debug!("counter=%? expected=%? edge_index=%? edge=%?", + debug2!("counter={:?} expected={:?} edge_index={:?} edge={:?}", counter, expected_incoming[counter], edge_index, edge); match expected_incoming[counter] { (ref e, ref n) => { @@ -361,7 +361,7 @@ mod test { do graph.each_outgoing_edge(start_index) |edge_index, edge| { assert_eq!(graph.edge_data(edge_index), &edge.data); assert!(counter < expected_outgoing.len()); - debug!("counter=%? expected=%? edge_index=%? edge=%?", + debug2!("counter={:?} expected={:?} edge_index={:?} edge={:?}", counter, expected_outgoing[counter], edge_index, edge); match expected_outgoing[counter] { (ref e, ref n) => { diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 270babb9cf3e2..b20cb8ed809b9 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -124,13 +124,13 @@ fn check_impl_of_trait(cx: &mut Context, it: @item, trait_ref: &trait_ref, self_ // If this trait has builtin-kind supertraits, meet them. let self_ty: ty::t = ty::node_id_to_type(cx.tcx, it.id); - debug!("checking impl with self type %?", ty::get(self_ty).sty); + debug2!("checking impl with self type {:?}", ty::get(self_ty).sty); do check_builtin_bounds(cx, self_ty, trait_def.bounds) |missing| { cx.tcx.sess.span_err(self_type.span, - fmt!("the type `%s', which does not fulfill `%s`, cannot implement this \ + format!("the type `{}', which does not fulfill `{}`, cannot implement this \ trait", ty_to_str(cx.tcx, self_ty), missing.user_string(cx.tcx))); cx.tcx.sess.span_note(self_type.span, - fmt!("types implementing this trait must fulfill `%s`", + format!("types implementing this trait must fulfill `{}`", trait_def.bounds.user_string(cx.tcx))); } @@ -238,7 +238,7 @@ fn with_appropriate_checker(cx: &Context, id: NodeId, } ref s => { cx.tcx.sess.bug( - fmt!("expect fn type in kind checker, not %?", s)); + format!("expect fn type in kind checker, not {:?}", s)); } } } @@ -265,7 +265,7 @@ fn check_fn( } pub fn check_expr(cx: &mut Context, e: @Expr) { - debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr())); + debug2!("kind::check_expr({})", expr_to_str(e, cx.tcx.sess.intr())); // Handle any kind bounds on type parameters let type_parameter_id = match e.get_callee_id() { @@ -292,9 +292,9 @@ pub fn check_expr(cx: &mut Context, e: @Expr) { }; if ts.len() != type_param_defs.len() { // Fail earlier to make debugging easier - fail!("internal error: in kind::check_expr, length \ + fail2!("internal error: in kind::check_expr, length \ mismatch between actual and declared bounds: actual = \ - %s, declared = %s", + {}, declared = {}", ts.repr(cx.tcx), type_param_defs.repr(cx.tcx)); } @@ -375,8 +375,8 @@ pub fn check_typaram_bounds(cx: &Context, do check_builtin_bounds(cx, ty, type_param_def.bounds.builtin_bounds) |missing| { cx.tcx.sess.span_err( sp, - fmt!("instantiating a type parameter with an incompatible type \ - `%s`, which does not fulfill `%s`", + format!("instantiating a type parameter with an incompatible type \ + `{}`, which does not fulfill `{}`", ty_to_str(cx.tcx, ty), missing.user_string(cx.tcx))); } @@ -390,17 +390,17 @@ pub fn check_freevar_bounds(cx: &Context, sp: Span, ty: ty::t, // Emit a less mysterious error message in this case. match referenced_ty { Some(rty) => cx.tcx.sess.span_err(sp, - fmt!("cannot implicitly borrow variable of type `%s` in a bounded \ - stack closure (implicit reference does not fulfill `%s`)", + format!("cannot implicitly borrow variable of type `{}` in a bounded \ + stack closure (implicit reference does not fulfill `{}`)", ty_to_str(cx.tcx, rty), missing.user_string(cx.tcx))), None => cx.tcx.sess.span_err(sp, - fmt!("cannot capture variable of type `%s`, which does \ - not fulfill `%s`, in a bounded closure", + format!("cannot capture variable of type `{}`, which does \ + not fulfill `{}`, in a bounded closure", ty_to_str(cx.tcx, ty), missing.user_string(cx.tcx))), } cx.tcx.sess.span_note( sp, - fmt!("this closure's environment must satisfy `%s`", + format!("this closure's environment must satisfy `{}`", bounds.user_string(cx.tcx))); } } @@ -409,8 +409,8 @@ pub fn check_trait_cast_bounds(cx: &Context, sp: Span, ty: ty::t, bounds: ty::BuiltinBounds) { do check_builtin_bounds(cx, ty, bounds) |missing| { cx.tcx.sess.span_err(sp, - fmt!("cannot pack type `%s`, which does not fulfill \ - `%s`, as a trait bounded by %s", + format!("cannot pack type `{}`, which does not fulfill \ + `{}`, as a trait bounded by {}", ty_to_str(cx.tcx, ty), missing.user_string(cx.tcx), bounds.user_string(cx.tcx))); } @@ -445,27 +445,27 @@ fn check_imm_free_var(cx: &Context, def: Def, sp: Span) { _ => { cx.tcx.sess.span_bug( sp, - fmt!("unknown def for free variable: %?", def)); + format!("unknown def for free variable: {:?}", def)); } } } fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) { - debug!("type_contents(%s)=%s", + debug2!("type_contents({})={}", ty_to_str(cx.tcx, ty), ty::type_contents(cx.tcx, ty).to_str()); if ty::type_moves_by_default(cx.tcx, ty) { cx.tcx.sess.span_err( - sp, fmt!("copying a value of non-copyable type `%s`", + sp, format!("copying a value of non-copyable type `{}`", ty_to_str(cx.tcx, ty))); - cx.tcx.sess.span_note(sp, fmt!("%s", reason)); + cx.tcx.sess.span_note(sp, format!("{}", reason)); } } pub fn check_send(cx: &Context, ty: ty::t, sp: Span) -> bool { if !ty::type_is_sendable(cx.tcx, ty) { cx.tcx.sess.span_err( - sp, fmt!("value has non-sendable type `%s`", + sp, format!("value has non-sendable type `{}`", ty_to_str(cx.tcx, ty))); false } else { @@ -565,8 +565,8 @@ pub fn check_cast_for_escaping_regions( // if !target_regions.iter().any(|t_r| is_subregion_of(cx, *t_r, r)) { // cx.tcx.sess.span_err( // source.span, - // fmt!("source contains borrowed pointer with lifetime \ - // not found in the target type `%s`", + // format!("source contains borrowed pointer with lifetime \ + // not found in the target type `{}`", // ty_to_str(cx.tcx, target_ty))); // note_and_explain_region( // cx.tcx, "source data is only valid for ", r, ""); diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 92c619eba0ecd..f154255e7b6f2 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -154,7 +154,7 @@ impl LanguageItems { pub fn require(&self, it: LangItem) -> Result { match self.items[it as uint] { Some(id) => Ok(id), - None => Err(fmt!("requires `%s` lang_item", + None => Err(format!("requires `{}` lang_item", LanguageItems::item_name(it as uint))) } } @@ -398,7 +398,7 @@ impl<'self> LanguageItemCollector<'self> { // Check for duplicates. match self.items.items[item_index] { Some(original_def_id) if original_def_id != item_def_id => { - self.session.err(fmt!("duplicate entry for `%s`", + self.session.err(format!("duplicate entry for `{}`", LanguageItems::item_name(item_index))); } Some(_) | None => { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 3c6ebc9311db5..591ca2ada5a12 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -430,7 +430,7 @@ impl Context { return *k; } } - fail!("unregistered lint %?", lint); + fail2!("unregistered lint {:?}", lint); } fn span_lint(&self, lint: lint, span: Span, msg: &str) { @@ -444,9 +444,9 @@ impl Context { let mut note = None; let msg = match src { Default | CommandLine => { - fmt!("%s [-%c %s%s]", msg, match level { + format!("{} [-{} {}{}]", msg, match level { warn => 'W', deny => 'D', forbid => 'F', - allow => fail!() + allow => fail2!() }, self.lint_to_str(lint).replace("_", "-"), if src == Default { " (default)" } else { "" }) }, @@ -458,7 +458,7 @@ impl Context { match level { warn => { self.tcx.sess.span_warn(span, msg); } deny | forbid => { self.tcx.sess.span_err(span, msg); } - allow => fail!(), + allow => fail2!(), } for &span in note.iter() { @@ -483,7 +483,7 @@ impl Context { self.span_lint( unrecognized_lint, meta.span, - fmt!("unknown `%s` attribute: `%s`", + format!("unknown `{}` attribute: `{}`", level_to_str(level), lintname)); } Some(lint) => { @@ -491,7 +491,7 @@ impl Context { let now = self.get_level(lint); if now == forbid && level != forbid { self.tcx.sess.span_err(meta.span, - fmt!("%s(%s) overruled by outer forbid(%s)", + format!("{}({}) overruled by outer forbid({})", level_to_str(level), lintname, lintname)); } else if now != level { @@ -757,7 +757,7 @@ impl TypeLimitsLintVisitor { ast::BiGt => v >= min, ast::BiGe => v > min, ast::BiEq | ast::BiNe => v >= min && v <= max, - _ => fail!() + _ => fail2!() } } @@ -821,7 +821,7 @@ impl TypeLimitsLintVisitor { ast::lit_int_unsuffixed(v) => v, _ => return true }, - _ => fail!() + _ => fail2!() }; self.is_valid(norm_binop, lit_val, min, max) } @@ -834,7 +834,7 @@ impl TypeLimitsLintVisitor { ast::lit_int_unsuffixed(v) => v as u64, _ => return true }, - _ => fail!() + _ => fail2!() }; self.is_valid(norm_binop, lit_val, min, max) } @@ -1071,7 +1071,7 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) { if !is_camel_case(cx.tcx, ident) { cx.span_lint( non_camel_case_types, span, - fmt!("%s `%s` should have a camel case identifier", + format!("{} `{}` should have a camel case identifier", sort, cx.tcx.sess.str_of(ident))); } } @@ -1437,7 +1437,7 @@ impl StabilityLintVisitor { None => return } } - _ => cx.tcx.sess.bug(fmt!("handle_def: %? not found", id)) + _ => cx.tcx.sess.bug(format!("handle_def: {:?} not found", id)) } } else { // cross-crate @@ -1466,9 +1466,9 @@ impl StabilityLintVisitor { let msg = match stability { Some(attr::Stability { text: Some(ref s), _ }) => { - fmt!("use of %s item: %s", label, *s) + format!("use of {} item: {}", label, *s) } - _ => fmt!("use of %s item", label) + _ => format!("use of {} item", label) }; cx.span_lint(lint, sp, msg); @@ -1613,8 +1613,8 @@ pub fn check_crate(tcx: ty::ctxt, crate: &ast::Crate) { for t in v.iter() { match *t { (lint, span, ref msg) => - tcx.sess.span_bug(span, fmt!("unprocessed lint %? at %s: \ - %s", + tcx.sess.span_bug(span, format!("unprocessed lint {:?} at {}: \ + {}", lint, ast_map::node_id_to_str( tcx.items, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 9e28bfcb964c4..e9119e75287a3 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -144,9 +144,9 @@ enum LiveNodeKind { fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str { let cm = cx.sess.codemap; match lnk { - FreeVarNode(s) => fmt!("Free var node [%s]", cm.span_to_str(s)), - ExprNode(s) => fmt!("Expr node [%s]", cm.span_to_str(s)), - VarDefNode(s) => fmt!("Var def node [%s]", cm.span_to_str(s)), + FreeVarNode(s) => format!("Free var node [{}]", cm.span_to_str(s)), + ExprNode(s) => format!("Expr node [{}]", cm.span_to_str(s)), + VarDefNode(s) => format!("Var def node [{}]", cm.span_to_str(s)), ExitNode => ~"Exit node" } } @@ -176,11 +176,11 @@ pub fn check_crate(tcx: ty::ctxt, } impl to_str::ToStr for LiveNode { - fn to_str(&self) -> ~str { fmt!("ln(%u)", **self) } + fn to_str(&self) -> ~str { format!("ln({})", **self) } } impl to_str::ToStr for Variable { - fn to_str(&self) -> ~str { fmt!("v(%u)", **self) } + fn to_str(&self) -> ~str { format!("v({})", **self) } } // ______________________________________________________________________ @@ -276,7 +276,7 @@ impl IrMaps { self.lnks.push(lnk); self.num_live_nodes += 1; - debug!("%s is of kind %s", ln.to_str(), + debug2!("{} is of kind {}", ln.to_str(), live_node_kind_to_str(lnk, self.tcx)); ln @@ -288,7 +288,7 @@ impl IrMaps { let ln = self.add_live_node(lnk); self.live_node_map.insert(node_id, ln); - debug!("%s is node %d", ln.to_str(), node_id); + debug2!("{} is node {}", ln.to_str(), node_id); } pub fn add_variable(&mut self, vk: VarKind) -> Variable { @@ -303,7 +303,7 @@ impl IrMaps { ImplicitRet => {} } - debug!("%s is %?", v.to_str(), vk); + debug2!("{} is {:?}", v.to_str(), vk); v } @@ -313,7 +313,7 @@ impl IrMaps { Some(&var) => var, None => { self.tcx.sess.span_bug( - span, fmt!("No variable registered for id %d", node_id)); + span, format!("No variable registered for id {}", node_id)); } } } @@ -367,7 +367,7 @@ fn visit_fn(v: &mut LivenessVisitor, sp: Span, id: NodeId, this: @mut IrMaps) { - debug!("visit_fn: id=%d", id); + debug2!("visit_fn: id={}", id); let _i = ::util::common::indenter(); // swap in a new set of IR maps for this function body: @@ -376,13 +376,13 @@ fn visit_fn(v: &mut LivenessVisitor, this.capture_map); unsafe { - debug!("creating fn_maps: %x", transmute(&*fn_maps)); + debug2!("creating fn_maps: {}", transmute::<&IrMaps, *IrMaps>(fn_maps)); } for arg in decl.inputs.iter() { do pat_util::pat_bindings(this.tcx.def_map, arg.pat) |_bm, arg_id, _x, path| { - debug!("adding argument %d", arg_id); + debug2!("adding argument {}", arg_id); let ident = ast_util::path_to_ident(path); fn_maps.add_variable(Arg(arg_id, ident)); } @@ -429,7 +429,7 @@ fn visit_fn(v: &mut LivenessVisitor, fn visit_local(v: &mut LivenessVisitor, local: @Local, this: @mut IrMaps) { let def_map = this.tcx.def_map; do pat_util::pat_bindings(def_map, local.pat) |_bm, p_id, sp, path| { - debug!("adding local variable %d", p_id); + debug2!("adding local variable {}", p_id); let name = ast_util::path_to_ident(path); this.add_live_node_for_node(p_id, VarDefNode(sp)); let kind = match local.init { @@ -450,7 +450,7 @@ fn visit_arm(v: &mut LivenessVisitor, arm: &Arm, this: @mut IrMaps) { let def_map = this.tcx.def_map; for pat in arm.pats.iter() { do pat_util::pat_bindings(def_map, *pat) |bm, p_id, sp, path| { - debug!("adding local variable %d from match with bm %?", + debug2!("adding local variable {} from match with bm {:?}", p_id, bm); let name = ast_util::path_to_ident(path); this.add_live_node_for_node(p_id, VarDefNode(sp)); @@ -470,7 +470,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) { // live nodes required for uses or definitions of variables: ExprPath(_) | ExprSelf => { let def = this.tcx.def_map.get_copy(&expr.id); - debug!("expr %d: path that leads to %?", expr.id, def); + debug2!("expr {}: path that leads to {:?}", expr.id, def); if moves::moved_variable_node_id_from_def(def).is_some() { this.add_live_node_for_node(expr.id, ExprNode(expr.span)); } @@ -515,7 +515,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) { this.add_live_node_for_node(expr.id, ExprNode(expr.span)); visit::walk_expr(v, expr, this); } - ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ExprBinary(_, op, _, _) if ast_util::lazy_binop(op) => { this.add_live_node_for_node(expr.id, ExprNode(expr.span)); visit::walk_expr(v, expr, this); @@ -609,7 +609,7 @@ impl Liveness { // code have to agree about which AST nodes are worth // creating liveness nodes for. self.tcx.sess.span_bug( - span, fmt!("No live node registered for node %d", + span, format!("No live node registered for node {}", node_id)); } } @@ -788,7 +788,7 @@ impl Liveness { wr.write_str("[ln("); wr.write_uint(*ln); wr.write_str(") of kind "); - wr.write_str(fmt!("%?", self.ir.lnks[*ln])); + wr.write_str(format!("{:?}", self.ir.lnks[*ln])); wr.write_str(" reads"); self.write_vars(wr, ln, |idx| self.users[idx].reader ); wr.write_str(" writes"); @@ -819,7 +819,7 @@ impl Liveness { self.indices2(ln, succ_ln, |idx, succ_idx| { self.users[idx] = self.users[succ_idx] }); - debug!("init_from_succ(ln=%s, succ=%s)", + debug2!("init_from_succ(ln={}, succ={})", self.ln_str(ln), self.ln_str(succ_ln)); } @@ -843,7 +843,7 @@ impl Liveness { } } - debug!("merge_from_succ(ln=%s, succ=%s, first_merge=%b, changed=%b)", + debug2!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})", ln.to_str(), self.ln_str(succ_ln), first_merge, changed); return changed; @@ -866,7 +866,7 @@ impl Liveness { self.users[idx].reader = invalid_node(); self.users[idx].writer = invalid_node(); - debug!("%s defines %s (idx=%u): %s", writer.to_str(), var.to_str(), + debug2!("{} defines {} (idx={}): {}", writer.to_str(), var.to_str(), idx, self.ln_str(writer)); } @@ -891,7 +891,7 @@ impl Liveness { user.used = true; } - debug!("%s accesses[%x] %s: %s", + debug2!("{} accesses[{:x}] {}: {}", ln.to_str(), acc, var.to_str(), self.ln_str(ln)); } @@ -902,18 +902,18 @@ impl Liveness { // effectively a return---this only occurs in `for` loops, // where the body is really a closure. - debug!("compute: using id for block, %s", block_to_str(body, + debug2!("compute: using id for block, {}", block_to_str(body, self.tcx.sess.intr())); let entry_ln: LiveNode = self.with_loop_nodes(body.id, self.s.exit_ln, self.s.exit_ln, || { self.propagate_through_fn_block(decl, body) }); - // hack to skip the loop unless debug! is enabled: - debug!("^^ liveness computation results for body %d (entry=%s)", + // hack to skip the loop unless debug2! is enabled: + debug2!("^^ liveness computation results for body {} (entry={})", { for ln_idx in range(0u, self.ir.num_live_nodes) { - debug!("%s", self.ln_str(LiveNode(ln_idx))); + debug2!("{}", self.ln_str(LiveNode(ln_idx))); } body.id }, @@ -1007,7 +1007,7 @@ impl Liveness { pub fn propagate_through_expr(&self, expr: @Expr, succ: LiveNode) -> LiveNode { - debug!("propagate_through_expr: %s", + debug2!("propagate_through_expr: {}", expr_to_str(expr, self.tcx.sess.intr())); match expr.node { @@ -1022,7 +1022,7 @@ impl Liveness { } ExprFnBlock(_, ref blk) => { - debug!("%s is an expr_fn_block", + debug2!("{} is an expr_fn_block", expr_to_str(expr, self.tcx.sess.intr())); /* @@ -1070,7 +1070,7 @@ impl Liveness { self.propagate_through_loop(expr, Some(cond), blk, succ) } - ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), // Note that labels have been resolved, so we don't need to look // at the label ident @@ -1379,7 +1379,7 @@ impl Liveness { self.merge_from_succ(ln, succ, first_merge); first_merge = false; } - debug!("propagate_through_loop: using id for loop body %d %s", + debug2!("propagate_through_loop: using id for loop body {} {}", expr.id, block_to_str(body, self.tcx.sess.intr())); let cond_ln = self.propagate_through_opt_expr(cond, ln); @@ -1407,7 +1407,7 @@ impl Liveness { cont_ln: LiveNode, f: &fn() -> R) -> R { - debug!("with_loop_nodes: %d %u", loop_node_id, *break_ln); + debug2!("with_loop_nodes: {} {}", loop_node_id, *break_ln); self.loop_scope.push(loop_node_id); self.break_ln.insert(loop_node_id, break_ln); self.cont_ln.insert(loop_node_id, cont_ln); @@ -1430,7 +1430,7 @@ fn check_local(this: &mut Liveness, local: @Local) { // No initializer: the variable might be unused; if not, it // should not be live at this point. - debug!("check_local() with no initializer"); + debug2!("check_local() with no initializer"); do this.pat_bindings(local.pat) |ln, var, sp, id| { if !this.warn_about_unused(sp, id, ln, var) { match this.live_on_exit(ln, var) { @@ -1501,7 +1501,7 @@ fn check_expr(this: &mut Liveness, expr: @Expr) { ExprParen(*) | ExprFnBlock(*) | ExprPath(*) | ExprSelf(*) => { visit::walk_expr(this, expr, ()); } - ExprForLoop(*) => fail!("non-desugared expr_for_loop") + ExprForLoop(*) => fail2!("non-desugared expr_for_loop") } } @@ -1596,17 +1596,17 @@ impl Liveness { FreeVarNode(span) => { self.tcx.sess.span_err( span, - fmt!("capture of %s: `%s`", msg, name)); + format!("capture of {}: `{}`", msg, name)); } ExprNode(span) => { self.tcx.sess.span_err( span, - fmt!("use of %s: `%s`", msg, name)); + format!("use of {}: `{}`", msg, name)); } ExitNode | VarDefNode(_) => { self.tcx.sess.span_bug( chk_span, - fmt!("illegal reader: %?", lnk)); + format!("illegal reader: {:?}", lnk)); } } } @@ -1655,11 +1655,11 @@ impl Liveness { if is_assigned { self.tcx.sess.add_lint(unused_variable, id, sp, - fmt!("variable `%s` is assigned to, \ + format!("variable `{}` is assigned to, \ but never used", *name)); } else { self.tcx.sess.add_lint(unused_variable, id, sp, - fmt!("unused variable: `%s`", *name)); + format!("unused variable: `{}`", *name)); } } true @@ -1677,7 +1677,7 @@ impl Liveness { let r = self.should_warn(var); for name in r.iter() { self.tcx.sess.add_lint(dead_assignment, id, sp, - fmt!("value assigned to `%s` is never read", *name)); + format!("value assigned to `{}` is never read", *name)); } } } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 9cc95b873d25d..19be4d041edfd 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -214,7 +214,7 @@ pub fn deref_kind(tcx: ty::ctxt, t: ty::t) -> deref_kind { Some(k) => k, None => { tcx.sess.bug( - fmt!("deref_cat() invoked on non-derefable type %s", + format!("deref_cat() invoked on non-derefable type {}", ty_to_str(tcx, t))); } } @@ -288,7 +288,7 @@ pub struct mem_categorization_ctxt { impl ToStr for MutabilityCategory { fn to_str(&self) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } @@ -383,7 +383,7 @@ impl mem_categorization_ctxt { } pub fn cat_expr_unadjusted(&self, expr: @ast::Expr) -> cmt { - debug!("cat_expr: id=%d expr=%s", + debug2!("cat_expr: id={} expr={}", expr.id, pprust::expr_to_str(expr, self.tcx.sess.intr())); let expr_ty = self.expr_ty(expr); @@ -436,7 +436,7 @@ impl mem_categorization_ctxt { return self.cat_rvalue_node(expr, expr_ty); } - ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop") + ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop") } } @@ -544,7 +544,7 @@ impl mem_categorization_ctxt { _ => { self.tcx.sess.span_bug( span, - fmt!("Upvar of non-closure %? - %s", + format!("Upvar of non-closure {:?} - {}", fn_node_id, ty.repr(self.tcx))); } } @@ -651,7 +651,7 @@ impl mem_categorization_ctxt { None => { self.tcx.sess.span_bug( node.span(), - fmt!("Explicit deref of non-derefable type: %s", + format!("Explicit deref of non-derefable type: {}", ty_to_str(self.tcx, base_cmt.ty))); } }; @@ -741,7 +741,7 @@ impl mem_categorization_ctxt { None => { self.tcx.sess.span_bug( elt.span(), - fmt!("Explicit index of non-index type `%s`", + format!("Explicit index of non-index type `{}`", ty_to_str(self.tcx, base_cmt.ty))); } }; @@ -872,7 +872,7 @@ impl mem_categorization_ctxt { // get the type of the *subpattern* and use that. let tcx = self.tcx; - debug!("cat_pattern: id=%d pat=%s cmt=%s", + debug2!("cat_pattern: id={} pat={} cmt={}", pat.id, pprust::pat_to_str(pat, tcx.sess.intr()), cmt.repr(tcx)); let _i = indenter(); @@ -1020,7 +1020,7 @@ impl mem_categorization_ctxt { ~"argument" } cat_deref(_, _, pk) => { - fmt!("dereference of %s pointer", ptr_sigil(pk)) + format!("dereference of {} pointer", ptr_sigil(pk)) } cat_interior(_, InteriorField(NamedField(_))) => { ~"field" @@ -1177,7 +1177,7 @@ impl cmt_ { impl Repr for cmt_ { fn repr(&self, tcx: ty::ctxt) -> ~str { - fmt!("{%s id:%d m:%? ty:%s}", + format!("\\{{} id:{} m:{:?} ty:{}\\}", self.cat.repr(tcx), self.id, self.mutbl, @@ -1194,19 +1194,19 @@ impl Repr for categorization { cat_local(*) | cat_self(*) | cat_arg(*) => { - fmt!("%?", *self) + format!("{:?}", *self) } cat_deref(cmt, derefs, ptr) => { - fmt!("%s->(%s, %u)", cmt.cat.repr(tcx), + format!("{}->({}, {})", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs) } cat_interior(cmt, interior) => { - fmt!("%s.%s", + format!("{}.{}", cmt.cat.repr(tcx), interior.repr(tcx)) } cat_downcast(cmt) => { - fmt!("%s->(enum)", cmt.cat.repr(tcx)) + format!("{}->(enum)", cmt.cat.repr(tcx)) } cat_stack_upvar(cmt) | cat_discr(cmt, _) => { @@ -1229,7 +1229,7 @@ impl Repr for InteriorKind { fn repr(&self, _tcx: ty::ctxt) -> ~str { match *self { InteriorField(NamedField(fld)) => token::interner_get(fld).to_owned(), - InteriorField(PositionalField(i)) => fmt!("#%?", i), + InteriorField(PositionalField(i)) => format!("\\#{:?}", i), InteriorElement(_) => ~"[]", } } diff --git a/src/librustc/middle/moves.rs b/src/librustc/middle/moves.rs index b7bdb9a1e5d66..71d0621fc16ae 100644 --- a/src/librustc/middle/moves.rs +++ b/src/librustc/middle/moves.rs @@ -275,7 +275,7 @@ impl VisitContext { * meaning either copied or moved depending on its type. */ - debug!("consume_expr(expr=%s)", + debug2!("consume_expr(expr={})", expr.repr(self.tcx)); let expr_ty = ty::expr_ty_adjusted(self.tcx, expr); @@ -293,7 +293,7 @@ impl VisitContext { * meaning either copied or moved depending on its type. */ - debug!("consume_block(blk.id=%?)", blk.id); + debug2!("consume_block(blk.id={:?})", blk.id); for stmt in blk.stmts.iter() { self.visit_stmt(*stmt, ()); @@ -312,7 +312,7 @@ impl VisitContext { * in turn trigger calls to the subcomponents of `expr`. */ - debug!("use_expr(expr=%s, mode=%?)", + debug2!("use_expr(expr={}, mode={:?})", expr.repr(self.tcx), expr_mode); @@ -326,7 +326,7 @@ impl VisitContext { _ => expr_mode }; - debug!("comp_mode = %?", comp_mode); + debug2!("comp_mode = {:?}", comp_mode); match expr.node { ExprPath(*) | ExprSelf => { @@ -375,7 +375,7 @@ impl VisitContext { ty::ty_bare_fn(*) => Read, ref x => self.tcx.sess.span_bug(callee.span, - fmt!("non-function type in moves for expr_call: %?", x)), + format!("non-function type in moves for expr_call: {:?}", x)), }; // Note we're not using consume_expr, which uses type_moves_by_default // to determine the mode, for this. The reason is that while stack @@ -411,7 +411,7 @@ impl VisitContext { ref r => { self.tcx.sess.span_bug( with_expr.span, - fmt!("bad base expr type in record: %?", r)) + format!("bad base expr type in record: {:?}", r)) } }; @@ -435,7 +435,7 @@ impl VisitContext { if consume_with { if has_dtor(self.tcx, with_ty) { self.tcx.sess.span_err(with_expr.span, - fmt!("cannot move out of type `%s`, \ + format!("cannot move out of type `{}`, \ which defines the `Drop` trait", with_ty.user_string(self.tcx))); } @@ -500,7 +500,7 @@ impl VisitContext { self.consume_block(blk); } - ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ExprUnary(_, _, lhs) => { if !self.use_overloaded_operator(expr, lhs, []) @@ -620,7 +620,7 @@ impl VisitContext { BindByRef(_) => false, BindInfer => { let pat_ty = ty::node_id_to_type(self.tcx, id); - debug!("pattern %? %s type is %s", + debug2!("pattern {:?} {} type is {}", id, ast_util::path_to_ident(path).repr(self.tcx), pat_ty.repr(self.tcx)); @@ -628,7 +628,7 @@ impl VisitContext { } }; - debug!("pattern binding %?: bm=%?, binding_moves=%b", + debug2!("pattern binding {:?}: bm={:?}, binding_moves={}", id, bm, binding_moves); if binding_moves { @@ -678,7 +678,7 @@ impl VisitContext { } pub fn compute_captures(&mut self, fn_expr_id: NodeId) -> @[CaptureVar] { - debug!("compute_capture_vars(fn_expr_id=%?)", fn_expr_id); + debug2!("compute_capture_vars(fn_expr_id={:?})", fn_expr_id); let _indenter = indenter(); let fn_ty = ty::node_id_to_type(self.tcx, fn_expr_id); @@ -696,7 +696,7 @@ impl VisitContext { let fvar = &freevars[i]; let fvar_def_id = ast_util::def_id_of_def(fvar.def).node; let fvar_ty = ty::node_id_to_type(self.tcx, fvar_def_id); - debug!("fvar_def_id=%? fvar_ty=%s", + debug2!("fvar_def_id={:?} fvar_ty={}", fvar_def_id, ppaux::ty_to_str(self.tcx, fvar_ty)); let mode = if ty::type_moves_by_default(self.tcx, fvar_ty) { CapMove diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 3c60bd67362f7..8b2e581836bd8 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -111,8 +111,8 @@ impl PrivacyVisitor { // WRONG Public }; - debug!("parental_privacy = %?", parental_privacy); - debug!("vis = %?, priv = %?", + debug2!("parental_privacy = {:?}", parental_privacy); + debug2!("vis = {:?}, priv = {:?}", variant_info.vis, visibility_to_privacy(variant_info.vis)) // inherited => privacy of the enum item @@ -175,7 +175,7 @@ impl PrivacyVisitor { } Some(_) => { self.tcx.sess.span_bug(span, - fmt!("method_is_private: method was a %s?!", + format!("method_is_private: method was a {}?!", ast_map::node_id_to_str( self.tcx.items, method_id, @@ -205,8 +205,8 @@ impl PrivacyVisitor { Some(&node_trait_method(_, trait_did, _)) => f(trait_did.node), Some(_) => { self.tcx.sess.span_bug(span, - fmt!("local_item_is_private: item was \ - a %s?!", + format!("local_item_is_private: item was \ + a {}?!", ast_map::node_id_to_str( self.tcx.items, item_id, @@ -227,7 +227,7 @@ impl PrivacyVisitor { for field in fields.iter() { if field.name != ident.name { loop; } if field.vis == private { - self.tcx.sess.span_err(span, fmt!("field `%s` is private", + self.tcx.sess.span_err(span, format!("field `{}` is private", token::ident_to_str(&ident))); } break; @@ -248,7 +248,7 @@ impl PrivacyVisitor { (container_id.crate != LOCAL_CRATE || !self.privileged_items.iter().any(|x| x == &(container_id.node))) { self.tcx.sess.span_err(span, - fmt!("method `%s` is private", + format!("method `{}` is private", token::ident_to_str(name))); } } else { @@ -256,7 +256,7 @@ impl PrivacyVisitor { csearch::get_item_visibility(self.tcx.sess.cstore, method_id); if visibility != public { self.tcx.sess.span_err(span, - fmt!("method `%s` is private", + format!("method `{}` is private", token::ident_to_str(name))); } } @@ -264,10 +264,10 @@ impl PrivacyVisitor { // Checks that a private path is in scope. fn check_path(&mut self, span: Span, def: Def, path: &Path) { - debug!("checking path"); + debug2!("checking path"); match def { DefStaticMethod(method_id, _, _) => { - debug!("found static method def, checking it"); + debug2!("found static method def, checking it"); self.check_method_common(span, method_id, &path.segments.last().identifier) @@ -277,7 +277,7 @@ impl PrivacyVisitor { if self.local_item_is_private(span, def_id.node) && !self.privileged_items.iter().any(|x| x == &def_id.node) { self.tcx.sess.span_err(span, - fmt!("function `%s` is private", + format!("function `{}` is private", token::ident_to_str( &path.segments .last() @@ -286,7 +286,7 @@ impl PrivacyVisitor { //} else if csearch::get_item_visibility(self.tcx.sess.cstore, // def_id) != public { // self.tcx.sess.span_err(span, - // fmt!("function `%s` is private", + // format!("function `{}` is private", // token::ident_to_str( // &path.segments // .last() @@ -333,7 +333,7 @@ impl PrivacyVisitor { !self.privileged_items.iter() .any(|x| x == &(trait_id.node)) => { self.tcx.sess.span_err(span, - fmt!("method `%s` is private", + format!("method `{}` is private", token::ident_to_str(&method .ident))); } @@ -476,7 +476,7 @@ impl<'self> Visitor> for PrivacyVisitor { ty_struct(id, _) if id.crate != LOCAL_CRATE || !self.privileged_items.iter() .any(|x| x == &(id.node)) => { - debug!("(privacy checking) checking field access"); + debug2!("(privacy checking) checking field access"); self.check_field(expr.span, id, ident); } _ => {} @@ -497,7 +497,7 @@ impl<'self> Visitor> for PrivacyVisitor { method map"); } Some(ref entry) => { - debug!("(privacy checking) checking \ + debug2!("(privacy checking) checking \ impl method"); self.check_method(expr.span, &entry.origin, ident); } @@ -515,7 +515,7 @@ impl<'self> Visitor> for PrivacyVisitor { if id.crate != LOCAL_CRATE || !self.privileged_items.iter().any(|x| x == &(id.node)) { for field in (*fields).iter() { - debug!("(privacy checking) checking \ + debug2!("(privacy checking) checking \ field in struct literal"); self.check_field(expr.span, id, field.ident); } @@ -527,7 +527,7 @@ impl<'self> Visitor> for PrivacyVisitor { match self.tcx.def_map.get_copy(&expr.id) { DefVariant(_, variant_id, _) => { for field in (*fields).iter() { - debug!("(privacy checking) \ + debug2!("(privacy checking) \ checking field in \ struct variant \ literal"); @@ -582,7 +582,7 @@ impl<'self> Visitor> for PrivacyVisitor { if id.crate != LOCAL_CRATE || !self.privileged_items.iter().any(|x| x == &(id.node)) { for field in fields.iter() { - debug!("(privacy checking) checking \ + debug2!("(privacy checking) checking \ struct pattern"); self.check_field(pattern.span, id, field.ident); } @@ -594,7 +594,7 @@ impl<'self> Visitor> for PrivacyVisitor { match self.tcx.def_map.find(&pattern.id) { Some(&DefVariant(_, variant_id, _)) => { for field in fields.iter() { - debug!("(privacy checking) \ + debug2!("(privacy checking) \ checking field in \ struct variant pattern"); self.check_field(pattern.span, variant_id, field.ident); diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 718f8005b74bf..6973b46c92c47 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -400,14 +400,14 @@ impl ReachableContext { let desc = ast_map::node_id_to_str(self.tcx.items, search_item, ident_interner); - self.tcx.sess.bug(fmt!("found unexpected thingy in \ - worklist: %s", - desc)) + self.tcx.sess.bug(format!("found unexpected thingy in \ + worklist: {}", + desc)) } None => { - self.tcx.sess.bug(fmt!("found unmapped ID in worklist: \ - %d", - search_item)) + self.tcx.sess.bug(format!("found unmapped ID in worklist: \ + {}", + search_item)) } } } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 5b6bb3a7b752a..0afcf87817ab5 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -93,13 +93,13 @@ impl RegionMaps { None => {} } - debug!("relate_free_regions(sub=%?, sup=%?)", sub, sup); + debug2!("relate_free_regions(sub={:?}, sup={:?})", sub, sup); self.free_region_map.insert(sub, ~[sup]); } pub fn record_parent(&mut self, sub: ast::NodeId, sup: ast::NodeId) { - debug!("record_parent(sub=%?, sup=%?)", sub, sup); + debug2!("record_parent(sub={:?}, sup={:?})", sub, sup); assert!(sub != sup); self.scope_map.insert(sub, sup); @@ -125,7 +125,7 @@ impl RegionMaps { match self.scope_map.find(&id) { Some(&r) => r, - None => { fail!("No enclosing scope for id %?", id); } + None => { fail2!("No enclosing scope for id {:?}", id); } } } @@ -168,7 +168,7 @@ impl RegionMaps { while superscope != s { match self.scope_map.find(&s) { None => { - debug!("is_subscope_of(%?, %?, s=%?)=false", + debug2!("is_subscope_of({:?}, {:?}, s={:?})=false", subscope, superscope, s); return false; @@ -177,7 +177,7 @@ impl RegionMaps { } } - debug!("is_subscope_of(%?, %?)=true", + debug2!("is_subscope_of({:?}, {:?})=true", subscope, superscope); return true; @@ -231,7 +231,7 @@ impl RegionMaps { * duplicated with the code in infer.rs. */ - debug!("is_subregion_of(sub_region=%?, super_region=%?)", + debug2!("is_subregion_of(sub_region={:?}, super_region={:?})", sub_region, super_region); sub_region == super_region || { @@ -303,7 +303,7 @@ impl RegionMaps { fn ancestors_of(this: &RegionMaps, scope: ast::NodeId) -> ~[ast::NodeId] { - // debug!("ancestors_of(scope=%d)", scope); + // debug2!("ancestors_of(scope={})", scope); let mut result = ~[scope]; let mut scope = scope; loop { @@ -314,7 +314,7 @@ impl RegionMaps { scope = superscope; } } - // debug!("ancestors_of_loop(scope=%d)", scope); + // debug2!("ancestors_of_loop(scope={})", scope); } } } @@ -323,7 +323,7 @@ impl RegionMaps { /// Records the current parent (if any) as the parent of `child_id`. fn parent_to_expr(visitor: &mut RegionResolutionVisitor, cx: Context, child_id: ast::NodeId, sp: Span) { - debug!("region::parent_to_expr(span=%?)", + debug2!("region::parent_to_expr(span={:?})", visitor.sess.codemap.span_to_str(sp)); for parent_id in cx.parent.iter() { visitor.region_maps.record_parent(child_id, *parent_id); @@ -437,10 +437,10 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor, sp: Span, id: ast::NodeId, cx: Context) { - debug!("region::resolve_fn(id=%?, \ - span=%?, \ - body.id=%?, \ - cx.parent=%?)", + debug2!("region::resolve_fn(id={:?}, \ + span={:?}, \ + body.id={:?}, \ + cx.parent={:?})", id, visitor.sess.codemap.span_to_str(sp), body.id, @@ -619,7 +619,7 @@ impl DetermineRpCtxt { Some(v) => join_variance(v, variance) }; - debug!("add_rp() variance for %s: %? == %? ^ %?", + debug2!("add_rp() variance for {}: {:?} == {:?} ^ {:?}", ast_map::node_id_to_str(self.ast_map, id, token::get_ident_interner()), joined_variance, old_variance, variance); @@ -637,7 +637,7 @@ impl DetermineRpCtxt { /// contains a value of type `from`, so if `from` is /// region-parameterized, so is the current item. pub fn add_dep(&mut self, from: ast::NodeId) { - debug!("add dependency from %d -> %d (%s -> %s) with variance %?", + debug2!("add dependency from {} -> {} ({} -> {}) with variance {:?}", from, self.item_id, ast_map::node_id_to_str(self.ast_map, from, token::get_ident_interner()), @@ -715,7 +715,7 @@ impl DetermineRpCtxt { let old_anon_implies_rp = self.anon_implies_rp; self.item_id = item_id; self.anon_implies_rp = anon_implies_rp; - debug!("with_item_id(%d, %b)", + debug2!("with_item_id({}, {})", item_id, anon_implies_rp); let _i = ::util::common::indenter(); @@ -787,7 +787,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor, let sess = cx.sess; match ty.node { ast::ty_rptr(ref r, _) => { - debug!("referenced rptr type %s", + debug2!("referenced rptr type {}", pprust::ty_to_str(ty, sess.intr())); if cx.region_is_relevant(r) { @@ -797,7 +797,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor, } ast::ty_closure(ref f) => { - debug!("referenced fn type: %s", + debug2!("referenced fn type: {}", pprust::ty_to_str(ty, sess.intr())); match f.region { Some(_) => { @@ -837,7 +837,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor, match csearch::get_region_param(cstore, did) { None => {} Some(variance) => { - debug!("reference to external, rp'd type %s", + debug2!("reference to external, rp'd type {}", pprust::ty_to_str(ty, sess.intr())); if cx.region_is_relevant(&path.segments.last().lifetime) { let rv = cx.add_variance(variance); @@ -967,7 +967,7 @@ pub fn determine_rp_in_crate(sess: Session, while cx.worklist.len() != 0 { let c_id = cx.worklist.pop(); let c_variance = cx.region_paramd_items.get_copy(&c_id); - debug!("popped %d from worklist", c_id); + debug2!("popped {} from worklist", c_id); match cx.dep_map.find(&c_id) { None => {} Some(deps) => { @@ -980,11 +980,11 @@ pub fn determine_rp_in_crate(sess: Session, } } - debug!("%s", { - debug!("Region variance results:"); + debug2!("{}", { + debug2!("Region variance results:"); let region_paramd_items = cx.region_paramd_items; for (&key, &value) in region_paramd_items.iter() { - debug!("item %? (%s) is parameterized with variance %?", + debug2!("item {:?} ({}) is parameterized with variance {:?}", key, ast_map::node_id_to_str(ast_map, key, token::get_ident_interner()), diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index f0ce22d5f33ad..4b5141f1630e0 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -646,7 +646,7 @@ impl NameBindings { pub fn get_module(&mut self) -> @mut Module { match self.get_module_if_available() { None => { - fail!("get_module called on a node with no module \ + fail2!("get_module called on a node with no module \ definition!") } Some(module_def) => module_def @@ -1096,14 +1096,14 @@ impl Resolver { // had the duplicate. let ns = ns.unwrap(); self.resolve_error(sp, - fmt!("duplicate definition of %s `%s`", + format!("duplicate definition of {} `{}`", namespace_error_to_str(duplicate_type), self.session.str_of(name))); { let r = child.span_for_namespace(ns); for sp in r.iter() { self.session.span_note(*sp, - fmt!("first definition of %s `%s` here", + format!("first definition of {} `{}` here", namespace_error_to_str(duplicate_type), self.session.str_of(name))); } @@ -1427,7 +1427,7 @@ impl Resolver { } match self.method_map.find_mut(name) { Some(s) => { s.insert(def_id); }, - _ => fail!("Can't happen"), + _ => fail2!("Can't happen"), } } @@ -1436,7 +1436,7 @@ impl Resolver { } item_mac(*) => { - fail!("item macros unimplemented") + fail2!("item macros unimplemented") } } } @@ -1620,8 +1620,8 @@ impl Resolver { if self.block_needs_anonymous_module(block) { let block_id = block.id; - debug!("(building reduced graph for block) creating a new \ - anonymous module for block %d", + debug2!("(building reduced graph for block) creating a new \ + anonymous module for block {}", block_id); let parent_module = self.get_module_from_parent(parent); @@ -1645,22 +1645,22 @@ impl Resolver { ident: Ident, new_parent: ReducedGraphParent) { let privacy = visibility_to_privacy(visibility); - debug!("(building reduced graph for \ - external crate) building external def, priv %?", + debug2!("(building reduced graph for \ + external crate) building external def, priv {:?}", privacy); match def { DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) | DefTy(def_id) => { match child_name_bindings.type_def { Some(TypeNsDef { module_def: Some(module_def), _ }) => { - debug!("(building reduced graph for external crate) \ + debug2!("(building reduced graph for external crate) \ already created module"); module_def.def_id = Some(def_id); } Some(_) | None => { - debug!("(building reduced graph for \ + debug2!("(building reduced graph for \ external crate) building module \ - %s", final_ident); + {}", final_ident); let parent_link = self.get_parent_link(new_parent, ident); child_name_bindings.define_module(privacy, @@ -1678,8 +1678,8 @@ impl Resolver { match def { DefMod(_) | DefForeignMod(_) => {} DefVariant(_, variant_id, is_struct) => { - debug!("(building reduced graph for external crate) building \ - variant %s", + debug2!("(building reduced graph for external crate) building \ + variant {}", final_ident); // We assume the parent is visible, or else we wouldn't have seen // it. @@ -1693,13 +1693,13 @@ impl Resolver { } } DefFn(*) | DefStaticMethod(*) | DefStatic(*) => { - debug!("(building reduced graph for external \ - crate) building value (fn/static) %s", final_ident); + debug2!("(building reduced graph for external \ + crate) building value (fn/static) {}", final_ident); child_name_bindings.define_value(privacy, def, dummy_sp()); } DefTrait(def_id) => { - debug!("(building reduced graph for external \ - crate) building type %s", final_ident); + debug2!("(building reduced graph for external \ + crate) building type {}", final_ident); // If this is a trait, add all the method names // to the trait info. @@ -1712,9 +1712,9 @@ impl Resolver { get_method_name_and_explicit_self(self.session.cstore, method_def_id); - debug!("(building reduced graph for \ + debug2!("(building reduced graph for \ external crate) ... adding \ - trait method '%s'", + trait method '{}'", self.session.str_of(method_name)); // Add it to the trait info if not static. @@ -1728,7 +1728,7 @@ impl Resolver { } match self.method_map.find_mut(name) { Some(s) => { s.insert(def_id); }, - _ => fail!("Can't happen"), + _ => fail2!("Can't happen"), } } @@ -1744,14 +1744,14 @@ impl Resolver { dummy_sp()) } DefTy(_) => { - debug!("(building reduced graph for external \ - crate) building type %s", final_ident); + debug2!("(building reduced graph for external \ + crate) building type {}", final_ident); child_name_bindings.define_type(privacy, def, dummy_sp()); } DefStruct(def_id) => { - debug!("(building reduced graph for external \ - crate) building type and value for %s", + debug2!("(building reduced graph for external \ + crate) building type and value for {}", final_ident); child_name_bindings.define_type(privacy, def, dummy_sp()); if get_struct_fields(self.session.cstore, def_id).len() == 0 { @@ -1766,7 +1766,7 @@ impl Resolver { DefPrimTy(*) | DefTyParam(*) | DefBinding(*) | DefUse(*) | DefUpvar(*) | DefRegion(*) | DefTyParamBinder(*) | DefLabel(*) | DefSelfTy(*) => { - fail!("didn't expect `%?`", def); + fail2!("didn't expect `{:?}`", def); } } } @@ -1821,9 +1821,9 @@ impl Resolver { match static_methods_opt { Some(ref static_methods) if static_methods.len() >= 1 => { - debug!("(building reduced graph for \ + debug2!("(building reduced graph for \ external crate) processing \ - static methods for type name %s", + static methods for type name {}", self.session.str_of( final_ident)); @@ -1873,9 +1873,9 @@ impl Resolver { for static_method_info in static_methods.iter() { let ident = static_method_info.ident; - debug!("(building reduced graph for \ + debug2!("(building reduced graph for \ external crate) creating \ - static method '%s'", + static method '{}'", self.session.str_of(ident)); let (method_name_bindings, _) = @@ -1901,7 +1901,7 @@ impl Resolver { } } DlField => { - debug!("(building reduced graph for external crate) \ + debug2!("(building reduced graph for external crate) \ ignoring field"); } } @@ -1909,12 +1909,12 @@ impl Resolver { /// Builds the reduced graph rooted at the given external module. fn populate_external_module(&mut self, module: @mut Module) { - debug!("(populating external module) attempting to populate %s", + debug2!("(populating external module) attempting to populate {}", self.module_to_str(module)); let def_id = match module.def_id { None => { - debug!("(populating external module) ... no def ID!"); + debug2!("(populating external module) ... no def ID!"); return } Some(def_id) => def_id, @@ -1922,7 +1922,7 @@ impl Resolver { do csearch::each_child_of_item(self.session.cstore, def_id) |def_like, child_ident, visibility| { - debug!("(populating external module) ... found ident: %s", + debug2!("(populating external module) ... found ident: {}", token::ident_to_str(&child_ident)); self.build_reduced_graph_for_external_crate_def(module, def_like, @@ -1972,15 +1972,15 @@ impl Resolver { match *subclass { SingleImport(target, _) => { - debug!("(building import directive) building import \ - directive: privacy %? %s::%s", + debug2!("(building import directive) building import \ + directive: privacy {:?} {}::{}", privacy, self.idents_to_str(directive.module_path), self.session.str_of(target)); match module_.import_resolutions.find(&target.name) { Some(&resolution) => { - debug!("(building import directive) bumping \ + debug2!("(building import directive) bumping \ reference"); resolution.outstanding_references += 1; @@ -1990,7 +1990,7 @@ impl Resolver { resolution.value_id = id; } None => { - debug!("(building import directive) creating new"); + debug2!("(building import directive) creating new"); let resolution = @mut ImportResolution::new(privacy, id); resolution.outstanding_references = 1; module_.import_resolutions.insert(target.name, resolution); @@ -2022,14 +2022,14 @@ impl Resolver { let mut i = 0; let mut prev_unresolved_imports = 0; loop { - debug!("(resolving imports) iteration %u, %u imports left", + debug2!("(resolving imports) iteration {}, {} imports left", i, self.unresolved_imports); let module_root = self.graph_root.get_module(); self.resolve_imports_for_module_subtree(module_root); if self.unresolved_imports == 0 { - debug!("(resolving imports) success"); + debug2!("(resolving imports) success"); break; } @@ -2047,7 +2047,7 @@ impl Resolver { /// submodules. pub fn resolve_imports_for_module_subtree(&mut self, module_: @mut Module) { - debug!("(resolving imports for module subtree) resolving %s", + debug2!("(resolving imports for module subtree) resolving {}", self.module_to_str(module_)); self.resolve_imports_for_module(module_); @@ -2071,8 +2071,8 @@ impl Resolver { /// Attempts to resolve imports for the given module only. pub fn resolve_imports_for_module(&mut self, module: @mut Module) { if module.all_imports_resolved() { - debug!("(resolving imports for module) all imports resolved for \ - %s", + debug2!("(resolving imports for module) all imports resolved for \ + {}", self.module_to_str(module)); return; } @@ -2085,7 +2085,7 @@ impl Resolver { match self.resolve_import_for_module(module, import_directive) { Failed => { // We presumably emitted an error. Continue. - let msg = fmt!("failed to resolve import `%s`", + let msg = format!("failed to resolve import `{}`", self.import_path_to_str( import_directive.module_path, *import_directive.subclass)); @@ -2142,7 +2142,7 @@ impl Resolver { if idents.is_empty() { self.import_directive_subclass_to_str(subclass) } else { - (fmt!("%s::%s", + (format!("{}::{}", self.idents_to_str(idents), self.import_directive_subclass_to_str(subclass))).to_managed() } @@ -2160,8 +2160,8 @@ impl Resolver { let mut resolution_result = Failed; let module_path = &import_directive.module_path; - debug!("(resolving import for module) resolving import `%s::...` in \ - `%s`", + debug2!("(resolving import for module) resolving import `{}::...` in \ + `{}`", self.idents_to_str(*module_path), self.module_to_str(module_)); @@ -2263,8 +2263,8 @@ impl Resolver { source: Ident, directive: &ImportDirective) -> ResolveResult<()> { - debug!("(resolving single import) resolving `%s` = `%s::%s` from \ - `%s`", + debug2!("(resolving single import) resolving `{}` = `{}::{}` from \ + `{}`", self.session.str_of(target), self.module_to_str(containing_module), self.session.str_of(source), @@ -2304,7 +2304,7 @@ impl Resolver { // able to resolve this import. if containing_module.glob_count > 0 { - debug!("(resolving single import) unresolved glob; \ + debug2!("(resolving single import) unresolved glob; \ bailing out"); return Indeterminate; } @@ -2369,7 +2369,7 @@ impl Resolver { } Some(_) => { // The import is unresolved. Bail out. - debug!("(resolving single import) unresolved import; \ + debug2!("(resolving single import) unresolved import; \ bailing out"); return Indeterminate; } @@ -2402,19 +2402,19 @@ impl Resolver { match value_result { BoundResult(target_module, name_bindings) => { - debug!("(resolving single import) found value target"); + debug2!("(resolving single import) found value target"); import_resolution.value_target = Some(Target::new(target_module, name_bindings)); import_resolution.value_id = directive.id; } UnboundResult => { /* Continue. */ } UnknownResult => { - fail!("value result should be known at this point"); + fail2!("value result should be known at this point"); } } match type_result { BoundResult(target_module, name_bindings) => { - debug!("(resolving single import) found type target: %?", + debug2!("(resolving single import) found type target: {:?}", name_bindings.type_def.unwrap().type_def); import_resolution.type_target = Some(Target::new(target_module, name_bindings)); @@ -2422,7 +2422,7 @@ impl Resolver { } UnboundResult => { /* Continue. */ } UnknownResult => { - fail!("type result should be known at this point"); + fail2!("type result should be known at this point"); } } @@ -2469,15 +2469,15 @@ impl Resolver { let span = directive.span; if resolve_fail { - let msg = fmt!("unresolved import: there is no `%s` in `%s`", - self.session.str_of(source), - self.module_to_str(containing_module)); + let msg = format!("unresolved import: there is no `{}` in `{}`", + self.session.str_of(source), + self.module_to_str(containing_module)); self.resolve_error(span, msg); return Failed; } else if priv_fail { - let msg = fmt!("unresolved import: found `%s` in `%s` but it is \ - private", self.session.str_of(source), - self.module_to_str(containing_module)); + let msg = format!("unresolved import: found `{}` in `{}` but it is \ + private", self.session.str_of(source), + self.module_to_str(containing_module)); self.resolve_error(span, msg); return Failed; } @@ -2505,7 +2505,7 @@ impl Resolver { None => {} } - debug!("(resolving single import) successfully resolved import"); + debug2!("(resolving single import) successfully resolved import"); return Success(()); } @@ -2521,12 +2521,12 @@ impl Resolver { // This function works in a highly imperative manner; it eagerly adds // everything it can to the list of import resolutions of the module // node. - debug!("(resolving glob import) resolving %? glob import", privacy); + debug2!("(resolving glob import) resolving {:?} glob import", privacy); // We must bail out if the node has unresolved imports of any kind // (including globs). if !(*containing_module).all_imports_resolved() { - debug!("(resolving glob import) target module has unresolved \ + debug2!("(resolving glob import) target module has unresolved \ imports; bailing out"); return Indeterminate; } @@ -2536,8 +2536,8 @@ impl Resolver { // Add all resolved imports from the containing module. for (ident, target_import_resolution) in containing_module.import_resolutions.iter() { - debug!("(resolving glob import) writing module resolution \ - %? into `%s`", + debug2!("(resolving glob import) writing module resolution \ + {:?} into `{}`", target_import_resolution.type_target.is_none(), self.module_to_str(module_)); @@ -2597,8 +2597,8 @@ impl Resolver { } } - debug!("(resolving glob import) writing resolution `%s` in `%s` \ - to `%s`, privacy=%?", + debug2!("(resolving glob import) writing resolution `{}` in `{}` \ + to `{}`, privacy={:?}", interner_get(name), self.module_to_str(containing_module), self.module_to_str(module_), @@ -2606,13 +2606,13 @@ impl Resolver { // Merge the child item into the import resolution. if name_bindings.defined_in_public_namespace(ValueNS) { - debug!("(resolving glob import) ... for value target"); + debug2!("(resolving glob import) ... for value target"); dest_import_resolution.value_target = Some(Target::new(containing_module, name_bindings)); dest_import_resolution.value_id = id; } if name_bindings.defined_in_public_namespace(TypeNS) { - debug!("(resolving glob import) ... for type target"); + debug2!("(resolving glob import) ... for type target"); dest_import_resolution.type_target = Some(Target::new(containing_module, name_bindings)); dest_import_resolution.type_id = id; @@ -2640,7 +2640,7 @@ impl Resolver { None => {} } - debug!("(resolving glob import) successfully resolved import"); + debug2!("(resolving glob import) successfully resolved import"); return Success(()); } @@ -2675,19 +2675,19 @@ impl Resolver { expn_info: span.expn_info, }; self.resolve_error(span, - fmt!("unresolved import. maybe \ + format!("unresolved import. maybe \ a missing `extern mod \ - %s`?", + {}`?", segment_name)); return Failed; } - self.resolve_error(span, fmt!("unresolved import: could not find `%s` in \ - `%s`.", segment_name, module_name)); + self.resolve_error(span, format!("unresolved import: could not find `{}` in \ + `{}`.", segment_name, module_name)); return Failed; } Indeterminate => { - debug!("(resolving module path for import) module \ - resolution is indeterminate: %s", + debug2!("(resolving module path for import) module \ + resolution is indeterminate: {}", self.session.str_of(name)); return Indeterminate; } @@ -2700,8 +2700,8 @@ impl Resolver { None => { // Not a module. self.resolve_error(span, - fmt!("not a \ - module `%s`", + format!("not a \ + module `{}`", self.session. str_of( name))); @@ -2729,7 +2729,7 @@ impl Resolver { None => { // There are no type bindings at all. self.resolve_error(span, - fmt!("not a module `%s`", + format!("not a module `{}`", self.session.str_of( name))); return Failed; @@ -2764,8 +2764,8 @@ impl Resolver { let module_path_len = module_path.len(); assert!(module_path_len > 0); - debug!("(resolving module path for import) processing `%s` rooted at \ - `%s`", + debug2!("(resolving module path for import) processing `{}` rooted at \ + `{}`", self.idents_to_str(module_path), self.module_to_str(module_)); @@ -2780,8 +2780,8 @@ impl Resolver { let mpath = self.idents_to_str(module_path); match mpath.rfind(':') { Some(idx) => { - self.resolve_error(span, fmt!("unresolved import: could not find `%s` \ - in `%s`", + self.resolve_error(span, format!("unresolved import: could not find `{}` \ + in `{}`", // idx +- 1 to account for the colons // on either side mpath.slice_from(idx + 1), @@ -2792,7 +2792,7 @@ impl Resolver { return Failed; } Indeterminate => { - debug!("(resolving module path for import) indeterminate; \ + debug2!("(resolving module path for import) indeterminate; \ bailing"); return Indeterminate; } @@ -2820,7 +2820,7 @@ impl Resolver { return Failed; } Indeterminate => { - debug!("(resolving module path for import) \ + debug2!("(resolving module path for import) \ indeterminate; bailing"); return Indeterminate; } @@ -2854,8 +2854,8 @@ impl Resolver { search_through_modules: SearchThroughModulesFlag) -> ResolveResult { - debug!("(resolving item in lexical scope) resolving `%s` in \ - namespace %? in `%s`", + debug2!("(resolving item in lexical scope) resolving `{}` in \ + namespace {:?} in `{}`", self.session.str_of(name), namespace, self.module_to_str(module_)); @@ -2883,12 +2883,12 @@ impl Resolver { match (*import_resolution).target_for_namespace(namespace) { None => { // Not found; continue. - debug!("(resolving item in lexical scope) found \ - import resolution, but not in namespace %?", + debug2!("(resolving item in lexical scope) found \ + import resolution, but not in namespace {:?}", namespace); } Some(target) => { - debug!("(resolving item in lexical scope) using \ + debug2!("(resolving item in lexical scope) using \ import resolution"); self.used_imports.insert(import_resolution.id(namespace)); return Success(target); @@ -2917,7 +2917,7 @@ impl Resolver { match search_module.parent_link { NoParentLink => { // No more parents. This module was unresolved. - debug!("(resolving item in lexical scope) unresolved \ + debug2!("(resolving item in lexical scope) unresolved \ module"); return Failed; } @@ -2927,7 +2927,7 @@ impl Resolver { match search_module.kind { NormalModuleKind => { // We stop the search here. - debug!("(resolving item in lexical \ + debug2!("(resolving item in lexical \ scope) unresolved module: not \ searching through module \ parents"); @@ -2963,7 +2963,7 @@ impl Resolver { // We couldn't see through the higher scope because of an // unresolved import higher up. Bail. - debug!("(resolving item in lexical scope) indeterminate \ + debug2!("(resolving item in lexical scope) indeterminate \ higher scope; bailing"); return Indeterminate; } @@ -2991,7 +2991,7 @@ impl Resolver { Some(ref type_def) => { match (*type_def).module_def { None => { - error!("!!! (resolving module in lexical \ + error2!("!!! (resolving module in lexical \ scope) module wasn't actually a \ module!"); return Failed; @@ -3002,19 +3002,19 @@ impl Resolver { } } None => { - error!("!!! (resolving module in lexical scope) module + error2!("!!! (resolving module in lexical scope) module wasn't actually a module!"); return Failed; } } } Indeterminate => { - debug!("(resolving module in lexical scope) indeterminate; \ + debug2!("(resolving module in lexical scope) indeterminate; \ bailing"); return Indeterminate; } Failed => { - debug!("(resolving module in lexical scope) failed to \ + debug2!("(resolving module in lexical scope) failed to \ resolve"); return Failed; } @@ -3087,7 +3087,7 @@ impl Resolver { // Now loop through all the `super`s we find. while i < module_path.len() && "super" == token::ident_to_str(&module_path[i]) { - debug!("(resolving module prefix) resolving `super` at %s", + debug2!("(resolving module prefix) resolving `super` at {}", self.module_to_str(containing_module)); match self.get_nearest_normal_module_parent(containing_module) { None => return Failed, @@ -3098,7 +3098,7 @@ impl Resolver { } } - debug!("(resolving module prefix) finished resolving prefix at %s", + debug2!("(resolving module prefix) finished resolving prefix at {}", self.module_to_str(containing_module)); return Success(PrefixFound(containing_module, i)); @@ -3113,7 +3113,7 @@ impl Resolver { namespace: Namespace, name_search_type: NameSearchType) -> ResolveResult { - debug!("(resolving name in module) resolving `%s` in `%s`", + debug2!("(resolving name in module) resolving `{}` in `{}`", self.session.str_of(name), self.module_to_str(module_)); @@ -3122,7 +3122,7 @@ impl Resolver { match module_.children.find(&name.name) { Some(name_bindings) if name_bindings.defined_in_namespace(namespace) => { - debug!("(resolving name in module) found node as child"); + debug2!("(resolving name in module) found node as child"); return Success(Target::new(module_, *name_bindings)); } Some(_) | None => { @@ -3144,28 +3144,28 @@ impl Resolver { Some(import_resolution) => { if import_resolution.privacy == Public && import_resolution.outstanding_references != 0 { - debug!("(resolving name in module) import \ + debug2!("(resolving name in module) import \ unresolved; bailing out"); return Indeterminate; } match import_resolution.target_for_namespace(namespace) { None => { - debug!("(resolving name in module) name found, \ - but not in namespace %?", + debug2!("(resolving name in module) name found, \ + but not in namespace {:?}", namespace); } Some(target) if name_search_type == PathPublicOrPrivateSearch || import_resolution.privacy == Public => { - debug!("(resolving name in module) resolved to \ + debug2!("(resolving name in module) resolved to \ import"); self.used_imports.insert(import_resolution.id(namespace)); return Success(target); } Some(_) => { - debug!("(resolving name in module) name found, \ + debug2!("(resolving name in module) name found, \ but not public"); } } @@ -3187,7 +3187,7 @@ impl Resolver { } // We're out of luck. - debug!("(resolving name in module) failed to resolve `%s`", + debug2!("(resolving name in module) failed to resolve `{}`", self.session.str_of(name)); return Failed; } @@ -3201,7 +3201,7 @@ impl Resolver { if sn.contains("::") { self.resolve_error(imports[index].span, "unresolved import"); } else { - let err = fmt!("unresolved import (maybe you meant `%s::*`?)", + let err = format!("unresolved import (maybe you meant `{}::*`?)", sn.slice(0, sn.len())); self.resolve_error(imports[index].span, err); } @@ -3247,20 +3247,20 @@ impl Resolver { match module_.def_id { Some(def_id) if def_id.crate == LOCAL_CRATE => { // OK. Continue. - debug!("(recording exports for module subtree) recording \ - exports for local module `%s`", + debug2!("(recording exports for module subtree) recording \ + exports for local module `{}`", self.module_to_str(module_)); } None => { // Record exports for the root module. - debug!("(recording exports for module subtree) recording \ - exports for root module `%s`", + debug2!("(recording exports for module subtree) recording \ + exports for root module `{}`", self.module_to_str(module_)); } Some(_) => { // Bail out. - debug!("(recording exports for module subtree) not recording \ - exports for `%s`", + debug2!("(recording exports for module subtree) not recording \ + exports for `{}`", self.module_to_str(module_)); return; } @@ -3292,7 +3292,7 @@ impl Resolver { match module_.def_id { Some(def_id) => { self.export_map2.insert(def_id.node, exports2); - debug!("(computing exports) writing exports for %d (some)", + debug2!("(computing exports) writing exports for {} (some)", def_id.node); } None => {} @@ -3308,7 +3308,7 @@ impl Resolver { match (namebindings.def_for_namespace(ns), namebindings.privacy_for_namespace(ns)) { (Some(d), Some(Public)) => { - debug!("(computing exports) YES: %s '%s' => %?", + debug2!("(computing exports) YES: {} '{}' => {:?}", if reexport { ~"reexport" } else { ~"export"}, interner_get(name), def_id_of_def(d)); @@ -3319,10 +3319,10 @@ impl Resolver { }); } (Some(_), Some(privacy)) => { - debug!("(computing reexports) NO: privacy %?", privacy); + debug2!("(computing reexports) NO: privacy {:?}", privacy); } (d_opt, p_opt) => { - debug!("(computing reexports) NO: %?, %?", d_opt, p_opt); + debug2!("(computing reexports) NO: {:?}, {:?}", d_opt, p_opt); } } } @@ -3332,7 +3332,7 @@ impl Resolver { module_: @mut Module) { for (name, importresolution) in module_.import_resolutions.iter() { if importresolution.privacy != Public { - debug!("(computing exports) not reexporting private `%s`", + debug2!("(computing exports) not reexporting private `{}`", interner_get(*name)); loop; } @@ -3340,7 +3340,7 @@ impl Resolver { for ns in xs.iter() { match importresolution.target_for_namespace(*ns) { Some(target) => { - debug!("(computing exports) maybe reexport '%s'", + debug2!("(computing exports) maybe reexport '{}'", interner_get(*name)); self.add_exports_of_namebindings(&mut *exports2, *name, @@ -3384,15 +3384,15 @@ impl Resolver { self.populate_module_if_necessary(orig_module); match orig_module.children.find(&name.name) { None => { - debug!("!!! (with scope) didn't find `%s` in `%s`", + debug2!("!!! (with scope) didn't find `{}` in `{}`", self.session.str_of(name), self.module_to_str(orig_module)); } Some(name_bindings) => { match (*name_bindings).get_module_if_available() { None => { - debug!("!!! (with scope) didn't find module \ - for `%s` in `%s`", + debug2!("!!! (with scope) didn't find module \ + for `{}` in `{}`", self.session.str_of(name), self.module_to_str(orig_module)); } @@ -3551,13 +3551,13 @@ impl Resolver { } pub fn resolve_crate(&mut self, crate: &ast::Crate) { - debug!("(resolving crate) starting"); + debug2!("(resolving crate) starting"); visit::walk_crate(self, crate, ()); } pub fn resolve_item(&mut self, item: @item) { - debug!("(resolving item) resolving %s", + debug2!("(resolving item) resolving {}", self.session.str_of(item.ident)); // Items with the !resolve_unexported attribute are X-ray contexts. @@ -3727,7 +3727,7 @@ impl Resolver { } item_mac(*) => { - fail!("item macros unimplemented") + fail2!("item macros unimplemented") } } @@ -3746,7 +3746,7 @@ impl Resolver { for (index, type_parameter) in generics.ty_params.iter().enumerate() { let ident = type_parameter.ident; - debug!("with_type_parameter_rib: %d %d", node_id, + debug2!("with_type_parameter_rib: {} {}", node_id, type_parameter.id); let def_like = DlDef(DefTyParam (local_def(type_parameter.id), @@ -3844,7 +3844,7 @@ impl Resolver { this.resolve_type(&argument.ty); - debug!("(resolving function) recorded argument"); + debug2!("(resolving function) recorded argument"); } this.resolve_type(&declaration.output); @@ -3854,7 +3854,7 @@ impl Resolver { // Resolve the function body. this.resolve_block(block); - debug!("(resolving function) leaving function"); + debug2!("(resolving function) leaving function"); } self.label_ribs.pop(); @@ -3894,11 +3894,11 @@ impl Resolver { TraitDerivation => "derive" }; - let msg = fmt!("attempt to %s a nonexistent trait `%s`", usage_str, path_str); + let msg = format!("attempt to {} a nonexistent trait `{}`", usage_str, path_str); self.resolve_error(trait_reference.path.span, msg); } Some(def) => { - debug!("(resolving trait) found trait def: %?", def); + debug2!("(resolving trait) found trait def: {:?}", def); self.record_def(trait_reference.ref_id, def); } } @@ -3916,7 +3916,7 @@ impl Resolver { Some(&prev_field) => { let ident_str = self.session.str_of(ident); self.resolve_error(field.span, - fmt!("field `%s` is already declared", ident_str)); + format!("field `{}` is already declared", ident_str)); self.session.span_note(prev_field.span, "Previously declared here"); }, @@ -4049,7 +4049,7 @@ impl Resolver { _name: Ident, id: NodeId) { // Write the implementations in scope into the module metadata. - debug!("(resolving module) resolving module ID %d", id); + debug2!("(resolving module) resolving module ID {}", id); visit::walk_mod(self, module_, ()); } @@ -4101,16 +4101,16 @@ impl Resolver { None => { self.resolve_error( p.span, - fmt!("variable `%s` from pattern #1 is \ - not bound in pattern #%u", + format!("variable `{}` from pattern \\#1 is \ + not bound in pattern \\#{}", interner_get(key), i + 1)); } Some(binding_i) => { if binding_0.binding_mode != binding_i.binding_mode { self.resolve_error( binding_i.span, - fmt!("variable `%s` is bound with different \ - mode in pattern #%u than in pattern #1", + format!("variable `{}` is bound with different \ + mode in pattern \\#{} than in pattern \\#1", interner_get(key), i + 1)); } } @@ -4121,8 +4121,8 @@ impl Resolver { if !map_0.contains_key(&key) { self.resolve_error( binding.span, - fmt!("variable `%s` from pattern #%u is \ - not bound in pattern #1", + format!("variable `{}` from pattern \\#{} is \ + not bound in pattern \\#1", interner_get(key), i + 1)); } } @@ -4149,7 +4149,7 @@ impl Resolver { } pub fn resolve_block(&mut self, block: &Block) { - debug!("(resolving block) entering block"); + debug2!("(resolving block) entering block"); self.value_ribs.push(@Rib::new(NormalRibKind)); // Move down in the graph, if there's an anonymous module rooted here. @@ -4157,7 +4157,7 @@ impl Resolver { match self.current_module.anonymous_children.find(&block.id) { None => { /* Nothing to do. */ } Some(&anonymous_module) => { - debug!("(resolving block) found anonymous module, moving \ + debug2!("(resolving block) found anonymous module, moving \ down"); self.current_module = anonymous_module; } @@ -4170,7 +4170,7 @@ impl Resolver { self.current_module = orig_module; self.value_ribs.pop(); - debug!("(resolving block) leaving block"); + debug2!("(resolving block) leaving block"); } pub fn resolve_type(&mut self, ty: &Ty) { @@ -4224,8 +4224,8 @@ impl Resolver { TypeNS, true) { Some(def) => { - debug!("(resolving type) resolved `%s` to \ - type %?", + debug2!("(resolving type) resolved `{}` to \ + type {:?}", self.session.str_of(path.segments .last() .identifier), @@ -4243,15 +4243,15 @@ impl Resolver { match result_def { Some(def) => { // Write the result into the def map. - debug!("(resolving type) writing resolution for `%s` \ - (id %d)", + debug2!("(resolving type) writing resolution for `{}` \ + (id {})", self.path_idents_to_str(path), path_id); self.record_def(path_id, def); } None => { - let msg = fmt!("use of undeclared type name `%s`", - self.path_idents_to_str(path)); + let msg = format!("use of undeclared type name `{}`", + self.path_idents_to_str(path)); self.resolve_error(ty.span, msg); } } @@ -4307,7 +4307,7 @@ impl Resolver { match self.resolve_bare_identifier_pattern(ident) { FoundStructOrEnumVariant(def) if mode == RefutableMode => { - debug!("(resolving pattern) resolving `%s` to \ + debug2!("(resolving pattern) resolving `{}` to \ struct or enum variant", interner_get(renamed)); @@ -4319,14 +4319,14 @@ impl Resolver { } FoundStructOrEnumVariant(_) => { self.resolve_error(pattern.span, - fmt!("declaration of `%s` \ + format!("declaration of `{}` \ shadows an enum \ variant or unit-like \ struct in scope", interner_get(renamed))); } FoundConst(def) if mode == RefutableMode => { - debug!("(resolving pattern) resolving `%s` to \ + debug2!("(resolving pattern) resolving `{}` to \ constant", interner_get(renamed)); @@ -4342,7 +4342,7 @@ impl Resolver { allowed here"); } BareIdentifierPatternUnresolved => { - debug!("(resolving pattern) binding `%s`", + debug2!("(resolving pattern) binding `{}`", interner_get(renamed)); let is_mutable = mutability == Mutable; @@ -4392,7 +4392,7 @@ impl Resolver { // in the same disjunct, which is an // error self.resolve_error(pattern.span, - fmt!("Identifier `%s` is bound more \ + format!("Identifier `{}` is bound more \ than once in the same pattern", path_to_str(path, self.session .intr()))); @@ -4435,7 +4435,7 @@ impl Resolver { Some(_) => { self.resolve_error( path.span, - fmt!("`%s` is not an enum variant or constant", + format!("`{}` is not an enum variant or constant", self.session.str_of( path.segments.last().identifier))) } @@ -4465,7 +4465,7 @@ impl Resolver { Some(_) => { self.resolve_error( path.span, - fmt!("`%s` is not an enum variant, struct or const", + format!("`{}` is not an enum variant, struct or const", self.session .str_of(path.segments .last() @@ -4473,8 +4473,8 @@ impl Resolver { } None => { self.resolve_error(path.span, - fmt!("unresolved enum variant, \ - struct or const `%s`", + format!("unresolved enum variant, \ + struct or const `{}`", self.session .str_of(path.segments .last() @@ -4515,10 +4515,10 @@ impl Resolver { self.record_def(pattern.id, definition); } result => { - debug!("(resolving pattern) didn't find struct \ - def: %?", result); - let msg = fmt!("`%s` does not name a structure", - self.path_idents_to_str(path)); + debug2!("(resolving pattern) didn't find struct \ + def: {:?}", result); + let msg = format!("`{}` does not name a structure", + self.path_idents_to_str(path)); self.resolve_error(path.span, msg); } } @@ -4542,7 +4542,7 @@ impl Resolver { Success(target) => { match target.bindings.value_def { None => { - fail!("resolved name in the value namespace to a \ + fail2!("resolved name in the value namespace to a \ set of name bindings with no def?!"); } Some(def) => { @@ -4562,7 +4562,7 @@ impl Resolver { } Indeterminate => { - fail!("unexpected indeterminate result"); + fail2!("unexpected indeterminate result"); } Failed => { @@ -4732,14 +4732,14 @@ impl Resolver { path.span, PathPublicOnlySearch) { Failed => { - let msg = fmt!("use of undeclared module `%s`", - self.idents_to_str(module_path_idents)); + let msg = format!("use of undeclared module `{}`", + self.idents_to_str(module_path_idents)); self.resolve_error(path.span, msg); return None; } Indeterminate => { - fail!("indeterminate unexpected"); + fail2!("indeterminate unexpected"); } Success(resulting_module) => { @@ -4766,7 +4766,7 @@ impl Resolver { Some(s) => { match containing_module.def_id { Some(def_id) if s.contains(&def_id) => { - debug!("containing module was a trait or impl \ + debug2!("containing module was a trait or impl \ and name was a method -> not resolved"); return None; }, @@ -4799,14 +4799,14 @@ impl Resolver { path.span, PathPublicOrPrivateSearch) { Failed => { - let msg = fmt!("use of undeclared module `::%s`", - self.idents_to_str(module_path_idents)); + let msg = format!("use of undeclared module `::{}`", + self.idents_to_str(module_path_idents)); self.resolve_error(path.span, msg); return None; } Indeterminate => { - fail!("indeterminate unexpected"); + fail2!("indeterminate unexpected"); } Success(resulting_module) => { @@ -4852,8 +4852,8 @@ impl Resolver { match search_result { Some(DlDef(def)) => { - debug!("(resolving path in local ribs) resolved `%s` to \ - local: %?", + debug2!("(resolving path in local ribs) resolved `{}` to \ + local: {:?}", self.session.str_of(ident), def); return Some(def); @@ -4913,15 +4913,15 @@ impl Resolver { return None; } Some(def) => { - debug!("(resolving item path in lexical scope) \ - resolved `%s` to item", + debug2!("(resolving item path in lexical scope) \ + resolved `{}` to item", self.session.str_of(ident)); return Some(def); } } } Indeterminate => { - fail!("unexpected indeterminate result"); + fail2!("unexpected indeterminate result"); } Failed => { return None; @@ -5000,7 +5000,7 @@ impl Resolver { match self.resolve_path(expr.id, path, ValueNS, true) { Some(def) => { // Write the result into the def map. - debug!("(resolving expr) resolved `%s`", + debug2!("(resolving expr) resolved `{}`", self.path_idents_to_str(path)); // First-class methods are not supported yet; error @@ -5031,11 +5031,15 @@ impl Resolver { Some(DefTy(struct_id)) if self.structs.contains(&struct_id) => { self.resolve_error(expr.span, - fmt!("`%s` is a structure name, but this expression \ - uses it like a function name", wrong_name)); + format!("`{}` is a structure name, but \ + this expression \ + uses it like a function name", + wrong_name)); - self.session.span_note(expr.span, fmt!("Did you mean to write: \ - `%s { /* fields */ }`?", wrong_name)); + self.session.span_note(expr.span, + format!("Did you mean to write: \ + `{} \\{ /* fields */ \\}`?", + wrong_name)); } _ => @@ -5044,14 +5048,14 @@ impl Resolver { match self.find_best_match_for_name(wrong_name, 5) { Some(m) => { self.resolve_error(expr.span, - fmt!("unresolved name `%s`. \ - Did you mean `%s`?", - wrong_name, m)); + format!("unresolved name `{}`. \ + Did you mean `{}`?", + wrong_name, m)); } None => { self.resolve_error(expr.span, - fmt!("unresolved name `%s`.", - wrong_name)); + format!("unresolved name `{}`.", + wrong_name)); } } } @@ -5082,10 +5086,10 @@ impl Resolver { self.record_def(expr.id, definition); } result => { - debug!("(resolving expression) didn't find struct \ - def: %?", result); - let msg = fmt!("`%s` does not name a structure", - self.path_idents_to_str(path)); + debug2!("(resolving expression) didn't find struct \ + def: {:?}", result); + let msg = format!("`{}` does not name a structure", + self.path_idents_to_str(path)); self.resolve_error(path.span, msg); } } @@ -5104,15 +5108,15 @@ impl Resolver { } } - ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ExprBreak(Some(label)) | ExprAgain(Some(label)) => { match self.search_ribs(self.label_ribs, label, expr.span, DontAllowCapturingSelf) { None => self.resolve_error(expr.span, - fmt!("use of undeclared label \ - `%s`", + format!("use of undeclared label \ + `{}`", interner_get(label))), Some(DlDef(def @ DefLabel(_))) => { self.record_def(expr.id, def) @@ -5154,8 +5158,8 @@ impl Resolver { self.trait_map.insert(expr.id, @mut traits); } ExprMethodCall(_, _, ident, _, _, _) => { - debug!("(recording candidate traits for expr) recording \ - traits for %d", + debug2!("(recording candidate traits for expr) recording \ + traits for {}", expr.id); let traits = self.search_for_traits_containing_method(ident); self.trait_map.insert(expr.id, @mut traits); @@ -5229,7 +5233,7 @@ impl Resolver { pub fn search_for_traits_containing_method(&mut self, name: Ident) -> ~[DefId] { - debug!("(searching for traits containing method) looking for '%s'", + debug2!("(searching for traits containing method) looking for '{}'", self.session.str_of(name)); let mut found_traits = ~[]; @@ -5331,7 +5335,7 @@ impl Resolver { found_traits: &mut ~[DefId], trait_def_id: DefId, name: Ident) { - debug!("(adding trait info) found trait %d:%d for method '%s'", + debug2!("(adding trait info) found trait {}:{} for method '{}'", trait_def_id.crate, trait_def_id.node, self.session.str_of(name)); @@ -5350,14 +5354,14 @@ impl Resolver { } pub fn record_def(&mut self, node_id: NodeId, def: Def) { - debug!("(recording def) recording %? for %?", def, node_id); + debug2!("(recording def) recording {:?} for {:?}", def, node_id); do self.def_map.insert_or_update_with(node_id, def) |_, old_value| { // Resolve appears to "resolve" the same ID multiple // times, so here is a sanity check it at least comes to // the same conclusion! - nmatsakis if def != *old_value { - self.session.bug(fmt!("node_id %? resolved first to %? \ - and then %?", node_id, *old_value, def)); + self.session.bug(format!("node_id {:?} resolved first to {:?} \ + and then {:?}", node_id, *old_value, def)); } }; } @@ -5371,7 +5375,7 @@ impl Resolver { BindByRef(*) => { self.resolve_error( pat.span, - fmt!("cannot use `ref` binding mode with %s", + format!("cannot use `ref` binding mode with {}", descr)); } } @@ -5459,15 +5463,15 @@ impl Resolver { } pub fn dump_module(&mut self, module_: @mut Module) { - debug!("Dump of module `%s`:", self.module_to_str(module_)); + debug2!("Dump of module `{}`:", self.module_to_str(module_)); - debug!("Children:"); + debug2!("Children:"); self.populate_module_if_necessary(module_); for (&name, _) in module_.children.iter() { - debug!("* %s", interner_get(name)); + debug2!("* {}", interner_get(name)); } - debug!("Import resolutions:"); + debug2!("Import resolutions:"); for (name, import_resolution) in module_.import_resolutions.iter() { let value_repr; match import_resolution.target_for_namespace(ValueNS) { @@ -5487,7 +5491,7 @@ impl Resolver { } } - debug!("* %s:%s%s", interner_get(*name), + debug2!("* {}:{}{}", interner_get(*name), value_repr, type_repr); } } diff --git a/src/librustc/middle/stack_check.rs b/src/librustc/middle/stack_check.rs index 44de6fde05070..1c572b2cbadbf 100644 --- a/src/librustc/middle/stack_check.rs +++ b/src/librustc/middle/stack_check.rs @@ -123,20 +123,20 @@ fn stack_check_fn<'a>(v: &mut StackCheckVisitor, } }; let new_cx = Context {safe_stack: safe_stack}; - debug!("stack_check_fn(safe_stack=%b, id=%?)", safe_stack, id); + debug2!("stack_check_fn(safe_stack={}, id={:?})", safe_stack, id); visit::walk_fn(v, fk, decl, body, sp, id, new_cx); } fn stack_check_expr<'a>(v: &mut StackCheckVisitor, expr: @ast::Expr, cx: Context) { - debug!("stack_check_expr(safe_stack=%b, expr=%s)", + debug2!("stack_check_expr(safe_stack={}, expr={})", cx.safe_stack, expr.repr(v.tcx)); if !cx.safe_stack { match expr.node { ast::ExprCall(callee, _, _) => { let callee_ty = ty::expr_ty(v.tcx, callee); - debug!("callee_ty=%s", callee_ty.repr(v.tcx)); + debug2!("callee_ty={}", callee_ty.repr(v.tcx)); match ty::get(callee_ty).sty { ty::ty_bare_fn(ref fty) => { if !fty.abis.is_rust() && !fty.abis.is_intrinsic() { @@ -177,6 +177,6 @@ fn call_to_extern_fn(v: &mut StackCheckVisitor, callee: @ast::Expr) { v.tcx.sess.add_lint(lint::cstack, callee.id, callee.span, - fmt!("invoking non-Rust fn in fn without \ - #[fixed_stack_segment]")); + format!("invoking non-Rust fn in fn without \ + \\#[fixed_stack_segment]")); } diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 7b2b130bc68ec..40cd693b5c109 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -183,9 +183,9 @@ impl Subst for ty::Region { ty::NonerasedRegions(ref regions) => { if regions.len() != 1 { tcx.sess.bug( - fmt!("ty::Region#subst(): \ + format!("ty::Region\\#subst(): \ Reference to self region when \ - given substs with no self region: %s", + given substs with no self region: {}", substs.repr(tcx))); } *regions.get(0) diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index c2dbcfa3b57d6..a159512aee5b9 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -264,7 +264,7 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool { a_expr = e.unwrap(); } UnitLikeStructLit(_) => { - fail!("UnitLikeStructLit should have been handled \ + fail2!("UnitLikeStructLit should have been handled \ above") } } @@ -277,14 +277,14 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool { b_expr = e.unwrap(); } UnitLikeStructLit(_) => { - fail!("UnitLikeStructLit should have been handled \ + fail2!("UnitLikeStructLit should have been handled \ above") } } match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) { Some(val1) => val1 == 0, - None => fail!("compare_list_exprs: type mismatch"), + None => fail2!("compare_list_exprs: type mismatch"), } } } @@ -294,7 +294,7 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool { let m2 = const_eval::compare_lit_exprs(tcx, a2, b2); match (m1, m2) { (Some(val1), Some(val2)) => (val1 == 0 && val2 == 0), - _ => fail!("compare_list_exprs: type mismatch"), + _ => fail2!("compare_list_exprs: type mismatch"), } } (&var(a, _), &var(b, _)) => a == b, @@ -419,7 +419,7 @@ impl<'self> Repr for Match<'self> { // for many programs, this just take too long to serialize self.pats.repr(tcx) } else { - fmt!("%u pats", self.pats.len()) + format!("{} pats", self.pats.len()) } } } @@ -439,7 +439,7 @@ fn expand_nested_bindings<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("expand_nested_bindings(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -472,7 +472,7 @@ fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::Pat) { if !pat_is_binding_or_wild(bcx.tcx().def_map, p) { bcx.sess().span_bug( p.span, - fmt!("Expected an identifier pattern but found p: %s", + format!("Expected an identifier pattern but found p: {}", p.repr(bcx.tcx()))); } } @@ -486,7 +486,7 @@ fn enter_match<'r>(bcx: @mut Block, val: ValueRef, e: enter_pat) -> ~[Match<'r>] { - debug!("enter_match(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_match(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -523,7 +523,7 @@ fn enter_match<'r>(bcx: @mut Block, } } - debug!("result=%s", result.repr(bcx.tcx())); + debug2!("result={}", result.repr(bcx.tcx())); return result; } @@ -535,7 +535,7 @@ fn enter_default<'r>(bcx: @mut Block, val: ValueRef, chk: FailureHandler) -> ~[Match<'r>] { - debug!("enter_default(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_default(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -605,7 +605,7 @@ fn enter_opt<'r>(bcx: @mut Block, variant_size: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_opt(bcx=%s, m=%s, opt=%?, col=%u, val=%s)", + debug2!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), *opt, @@ -741,7 +741,7 @@ fn enter_rec_or_struct<'r>(bcx: @mut Block, fields: &[ast::Ident], val: ValueRef) -> ~[Match<'r>] { - debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_rec_or_struct(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -776,7 +776,7 @@ fn enter_tup<'r>(bcx: @mut Block, val: ValueRef, n_elts: uint) -> ~[Match<'r>] { - debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_tup(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -802,7 +802,7 @@ fn enter_tuple_struct<'r>(bcx: @mut Block, val: ValueRef, n_elts: uint) -> ~[Match<'r>] { - debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_tuple_struct(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -827,7 +827,7 @@ fn enter_box<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_box(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_box(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -854,7 +854,7 @@ fn enter_uniq<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_uniq(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -881,7 +881,7 @@ fn enter_region<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_region(bcx=%s, m=%s, col=%u, val=%s)", + debug2!("enter_region(bcx={}, m={}, col={}, val={})", bcx.to_str(), m.repr(bcx.tcx()), col, @@ -1232,7 +1232,7 @@ impl FailureHandler { fn handle_fail(&self) -> BasicBlockRef { match *self { Infallible => { - fail!("attempted to fail in infallible failure handler!") + fail2!("attempted to fail in infallible failure handler!") } JumpToBasicBlock(basic_block) => basic_block, CustomFailureHandlerClass(custom_failure_handler) => { @@ -1295,7 +1295,7 @@ fn compare_values(cx: @mut Block, let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs"); Store(cx, rhs, scratch_rhs); let did = langcall(cx, None, - fmt!("comparison of `%s`", cx.ty_to_str(rhs_t)), + format!("comparison of `{}`", cx.ty_to_str(rhs_t)), UniqStrEqFnLangItem); let result = callee::trans_lang_call(cx, did, [scratch_lhs, scratch_rhs], None); Result { @@ -1305,7 +1305,7 @@ fn compare_values(cx: @mut Block, } ty::ty_estr(_) => { let did = langcall(cx, None, - fmt!("comparison of `%s`", cx.ty_to_str(rhs_t)), + format!("comparison of `{}`", cx.ty_to_str(rhs_t)), StrEqFnLangItem); let result = callee::trans_lang_call(cx, did, [lhs, rhs], None); Result { @@ -1383,7 +1383,7 @@ fn insert_lllocals(bcx: @mut Block, } }; - debug!("binding %? to %s", binding_info.id, bcx.val_to_str(llval)); + debug2!("binding {:?} to {}", binding_info.id, bcx.val_to_str(llval)); llmap.insert(binding_info.id, llval); if bcx.sess().opts.extra_debuginfo { @@ -1404,7 +1404,7 @@ fn compile_guard(bcx: @mut Block, vals: &[ValueRef], chk: FailureHandler) -> @mut Block { - debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%s)", + debug2!("compile_guard(bcx={}, guard_expr={}, m={}, vals={})", bcx.to_str(), bcx.expr_to_str(guard_expr), m.repr(bcx.tcx()), @@ -1458,7 +1458,7 @@ fn compile_submatch(bcx: @mut Block, m: &[Match], vals: &[ValueRef], chk: FailureHandler) { - debug!("compile_submatch(bcx=%s, m=%s, vals=%s)", + debug2!("compile_submatch(bcx={}, m={}, vals={})", bcx.to_str(), m.repr(bcx.tcx()), vec_map_to_str(vals, |v| bcx.val_to_str(*v))); @@ -1624,7 +1624,7 @@ fn compile_submatch_continue(mut bcx: @mut Block, // Decide what kind of branch we need let opts = get_options(bcx, m, col); - debug!("options=%?", opts); + debug2!("options={:?}", opts); let mut kind = no_branch; let mut test_val = val; if opts.len() > 0u { @@ -2113,13 +2113,13 @@ fn bind_irrefutable_pat(bcx: @mut Block, * - binding_mode: is this for an argument or a local variable? */ - debug!("bind_irrefutable_pat(bcx=%s, pat=%s, binding_mode=%?)", + debug2!("bind_irrefutable_pat(bcx={}, pat={}, binding_mode={:?})", bcx.to_str(), pat.repr(bcx.tcx()), binding_mode); if bcx.sess().asm_comments() { - add_comment(bcx, fmt!("bind_irrefutable_pat(pat=%s)", + add_comment(bcx, format!("bind_irrefutable_pat(pat={})", pat.repr(bcx.tcx()))); } @@ -2241,7 +2241,7 @@ fn bind_irrefutable_pat(bcx: @mut Block, ast::PatVec(*) => { bcx.tcx().sess.span_bug( pat.span, - fmt!("vector patterns are never irrefutable!")); + format!("vector patterns are never irrefutable!")); } ast::PatWild | ast::PatLit(_) | ast::PatRange(_, _) => () } diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 5c255ad081811..0fdbc04a6c1e0 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -113,13 +113,13 @@ pub fn represent_node(bcx: @mut Block, node: ast::NodeId) -> @Repr { /// Decides how to represent a given type. pub fn represent_type(cx: &mut CrateContext, t: ty::t) -> @Repr { - debug!("Representing: %s", ty_to_str(cx.tcx, t)); + debug2!("Representing: {}", ty_to_str(cx.tcx, t)); match cx.adt_reprs.find(&t) { Some(repr) => return *repr, None => { } } let repr = @represent_type_uncached(cx, t); - debug!("Represented as: %?", repr) + debug2!("Represented as: {:?}", repr) cx.adt_reprs.insert(t, repr); return repr; } @@ -179,7 +179,7 @@ fn represent_type_uncached(cx: &mut CrateContext, t: ty::t) -> Repr { // non-empty body, explicit discriminants should have // been rejected by a checker before this point. if !cases.iter().enumerate().all(|(i,c)| c.discr == (i as Disr)) { - cx.sess.bug(fmt!("non-C-like enum %s with specified \ + cx.sess.bug(format!("non-C-like enum {} with specified \ discriminants", ty::item_path_str(cx.tcx, def_id))) } diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs index de4ea331041f2..4a960b1721d2d 100644 --- a/src/librustc/middle/trans/asm.rs +++ b/src/librustc/middle/trans/asm.rs @@ -47,7 +47,7 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block { let e = match out.node { ast::ExprAddrOf(_, e) => e, - _ => fail!("Expression must be addr of") + _ => fail2!("Expression must be addr of") }; unpack_result!(bcx, { @@ -89,7 +89,7 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block { let mut clobbers = getClobbers(); if !ia.clobbers.is_empty() && !clobbers.is_empty() { - clobbers = fmt!("%s,%s", ia.clobbers, clobbers); + clobbers = format!("{},{}", ia.clobbers, clobbers); } else { clobbers.push_str(ia.clobbers); }; @@ -102,7 +102,7 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block { constraints.push_str(clobbers); } - debug!("Asm Constraints: %?", constraints); + debug2!("Asm Constraints: {:?}", constraints); let numOutputs = outputs.len(); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 264ad3c7c5780..3a35f144ab504 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -351,7 +351,7 @@ pub fn malloc_raw_dyn(bcx: @mut Block, match li.require(it) { Ok(id) => id, Err(s) => { - bcx.tcx().sess.fatal(fmt!("allocation of `%s` %s", + bcx.tcx().sess.fatal(format!("allocation of `{}` {}", bcx.ty_to_str(t), s)); } } @@ -379,7 +379,7 @@ pub fn malloc_raw_dyn(bcx: @mut Block, (ty::mk_imm_box, require_alloc_fn(bcx, t, ClosureExchangeMallocFnLangItem)) } - _ => fail!("heap_exchange already handled") + _ => fail2!("heap_exchange already handled") }; // Grab the TypeRef type of box_ptr_ty. @@ -911,20 +911,18 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef], } match bcx.node_info { - None => debug!("invoke at ???"), + None => debug2!("invoke at ???"), Some(node_info) => { - debug!("invoke at %s", + debug2!("invoke at {}", bcx.sess().codemap.span_to_str(node_info.span)); } } if need_invoke(bcx) { unsafe { - debug!("invoking %x at %x", - ::std::cast::transmute(llfn), - ::std::cast::transmute(bcx.llbb)); + debug2!("invoking {} at {}", llfn, bcx.llbb); for &llarg in llargs.iter() { - debug!("arg: %x", ::std::cast::transmute(llarg)); + debug2!("arg: {}", llarg); } } let normal_bcx = sub_block(bcx, "normal return"); @@ -937,11 +935,9 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef], return (llresult, normal_bcx); } else { unsafe { - debug!("calling %x at %x", - ::std::cast::transmute(llfn), - ::std::cast::transmute(bcx.llbb)); + debug2!("calling {} at {}", llfn, bcx.llbb); for &llarg in llargs.iter() { - debug!("arg: %x", ::std::cast::transmute(llarg)); + debug2!("arg: {}", llarg); } } let llresult = Call(bcx, llfn, llargs, attributes); @@ -1092,7 +1088,7 @@ pub fn find_bcx_for_scope(bcx: @mut Block, scope_id: ast::NodeId) -> @mut Block } None => { bcx_sid = match bcx_sid.parent { - None => bcx.tcx().sess.bug(fmt!("no enclosing scope with id %d", scope_id)), + None => bcx.tcx().sess.bug(format!("no enclosing scope with id {}", scope_id)), Some(bcx_par) => bcx_par }; bcx_sid.scope @@ -1161,7 +1157,7 @@ pub fn ignore_lhs(_bcx: @mut Block, local: &ast::Local) -> bool { pub fn init_local(bcx: @mut Block, local: &ast::Local) -> @mut Block { - debug!("init_local(bcx=%s, local.id=%?)", + debug2!("init_local(bcx={}, local.id={:?})", bcx.to_str(), local.id); let _indenter = indenter(); @@ -1182,7 +1178,7 @@ pub fn init_local(bcx: @mut Block, local: &ast::Local) -> @mut Block { pub fn trans_stmt(cx: @mut Block, s: &ast::Stmt) -> @mut Block { let _icx = push_ctxt("trans_stmt"); - debug!("trans_stmt(%s)", stmt_to_str(s, cx.tcx().sess.intr())); + debug2!("trans_stmt({})", stmt_to_str(s, cx.tcx().sess.intr())); if cx.sess().asm_comments() { add_span_comment(cx, s.span, stmt_to_str(s, cx.ccx().sess.intr())); @@ -1345,12 +1341,12 @@ pub fn cleanup_and_leave(bcx: @mut Block, let mut bcx = bcx; let is_lpad = leave == None; loop { - debug!("cleanup_and_leave: leaving %s", cur.to_str()); + debug2!("cleanup_and_leave: leaving {}", cur.to_str()); if bcx.sess().trace() { trans_trace( bcx, None, - (fmt!("cleanup_and_leave(%s)", cur.to_str())).to_managed()); + (format!("cleanup_and_leave({})", cur.to_str())).to_managed()); } let mut cur_scope = cur.scope; @@ -1419,12 +1415,12 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option) -> @mut Block let mut cur = bcx; let mut bcx = bcx; loop { - debug!("cleanup_block: %s", cur.to_str()); + debug2!("cleanup_block: {}", cur.to_str()); if bcx.sess().trace() { trans_trace( bcx, None, - (fmt!("cleanup_block(%s)", cur.to_str())).to_managed()); + (format!("cleanup_block({})", cur.to_str())).to_managed()); } let mut cur_scope = cur.scope; @@ -1469,7 +1465,7 @@ pub fn with_scope(bcx: @mut Block, f: &fn(@mut Block) -> @mut Block) -> @mut Block { let _icx = push_ctxt("with_scope"); - debug!("with_scope(bcx=%s, opt_node_info=%?, name=%s)", + debug2!("with_scope(bcx={}, opt_node_info={:?}, name={})", bcx.to_str(), opt_node_info, name); let _indenter = indenter(); @@ -1599,7 +1595,7 @@ pub fn alloc_ty(bcx: @mut Block, t: ty::t, name: &str) -> ValueRef { let _icx = push_ctxt("alloc_ty"); let ccx = bcx.ccx(); let ty = type_of::type_of(ccx, t); - assert!(!ty::type_has_params(t), "Type has params: %s", ty_to_str(ccx.tcx, t)); + assert!(!ty::type_has_params(t)); let val = alloca(bcx, ty, name); return val; } @@ -1688,8 +1684,8 @@ pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext, -> @mut FunctionContext { for p in param_substs.iter() { p.validate(); } - debug!("new_fn_ctxt_w_id(path=%s, id=%?, \ - param_substs=%s)", + debug2!("new_fn_ctxt_w_id(path={}, id={:?}, \ + param_substs={})", path_str(ccx.sess, path), id, param_substs.repr(ccx.tcx)); @@ -1802,7 +1798,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext, args: &[ast::arg], raw_llargs: &[ValueRef], arg_tys: &[ty::t]) -> @mut Block { - debug!("copy_args_to_allocas: raw_llargs=%s arg_tys=%s", + debug2!("copy_args_to_allocas: raw_llargs={} arg_tys={}", raw_llargs.llrepr(fcx.ccx), arg_tys.repr(fcx.ccx.tcx)); @@ -1926,7 +1922,7 @@ pub fn trans_closure(ccx: @mut CrateContext, let _icx = push_ctxt("trans_closure"); set_uwtable(llfndecl); - debug!("trans_closure(..., param_substs=%s)", + debug2!("trans_closure(..., param_substs={})", param_substs.repr(ccx.tcx)); let fcx = new_fn_ctxt_w_id(ccx, @@ -2006,7 +2002,7 @@ pub fn trans_fn(ccx: @mut CrateContext, let the_path_str = path_str(ccx.sess, path); let _s = StatRecorder::new(ccx, the_path_str); - debug!("trans_fn(self_arg=%?, param_substs=%s)", + debug2!("trans_fn(self_arg={:?}, param_substs={})", self_arg, param_substs.repr(ccx.tcx)); let _icx = push_ctxt("trans_fn"); @@ -2042,7 +2038,7 @@ fn insert_synthetic_type_entries(bcx: @mut Block, let tcx = bcx.tcx(); for i in range(0u, fn_args.len()) { - debug!("setting type of argument %u (pat node %d) to %s", + debug2!("setting type of argument {} (pat node {}) to {}", i, fn_args[i].pat.id, bcx.ty_to_str(arg_tys[i])); let pat_id = fn_args[i].pat.id; @@ -2141,8 +2137,8 @@ pub fn trans_enum_variant_or_tuple_like_struct( let result_ty = match ty::get(ctor_ty).sty { ty::ty_bare_fn(ref bft) => bft.sig.output, _ => ccx.sess.bug( - fmt!("trans_enum_variant_or_tuple_like_struct: \ - unexpected ctor return type %s", + format!("trans_enum_variant_or_tuple_like_struct: \ + unexpected ctor return type {}", ty_to_str(ccx.tcx, ctor_ty))) }; @@ -2218,7 +2214,7 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) { let path = match ccx.tcx.items.get_copy(&item.id) { ast_map::node_item(_, p) => p, // tjc: ? - _ => fail!("trans_item"), + _ => fail2!("trans_item"), }; match item.node { ast::item_fn(ref decl, purity, _abis, ref generics, ref body) => { @@ -2360,7 +2356,7 @@ pub fn register_fn(ccx: @mut CrateContext, assert!(f.abis.is_rust() || f.abis.is_intrinsic()); f } - _ => fail!("expected bare rust fn or an intrinsic") + _ => fail2!("expected bare rust fn or an intrinsic") }; let llfn = decl_rust_fn(ccx, f.sig.inputs, f.sig.output, sym); @@ -2376,7 +2372,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext, cc: lib::llvm::CallConv, fn_ty: Type) -> ValueRef { - debug!("register_fn_fuller creating fn for item %d with path %s", + debug2!("register_fn_fuller creating fn for item {} with path {}", node_id, ast_map::path_to_str(item_path(ccx, &node_id), token::get_ident_interner())); @@ -2455,7 +2451,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext, }; (start_fn, args) } else { - debug!("using user-defined start fn"); + debug2!("using user-defined start fn"); let args = ~[ C_null(Type::opaque_box(ccx).ptr_to()), llvm::LLVMGetParam(llfn, 0 as c_uint), @@ -2503,7 +2499,7 @@ fn exported_name(ccx: &mut CrateContext, path: path, ty: ty::t, attrs: &[ast::At } pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { - debug!("get_item_val(id=`%?`)", id); + debug2!("get_item_val(id=`{:?}`)", id); let val = ccx.item_vals.find_copy(&id); match val { @@ -2525,10 +2521,10 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { // we need to get the symbol from csearch instead of // using the current crate's name/version // information in the hash of the symbol - debug!("making %s", sym); + debug2!("making {}", sym); let sym = match ccx.external_srcs.find(&i.id) { Some(&did) => { - debug!("but found in other crate..."); + debug2!("but found in other crate..."); csearch::get_symbol(ccx.sess.cstore, did) } None => sym @@ -2579,7 +2575,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { } if !inlineable { - debug!("%s not inlined", sym); + debug2!("{} not inlined", sym); ccx.non_inlineable_statics.insert(id); } ccx.item_symbols.insert(i.id, sym); @@ -2600,7 +2596,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { llfn } - _ => fail!("get_item_val: weird result in table") + _ => fail2!("get_item_val: weird result in table") }; match (attr::first_attr_value_str_by_name(i.attrs, "link_section")) { @@ -2616,7 +2612,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { } ast_map::node_trait_method(trait_method, _, pth) => { - debug!("get_item_val(): processing a node_trait_method"); + debug2!("get_item_val(): processing a node_trait_method"); match *trait_method { ast::required(_) => { ccx.sess.bug("unexpected variant: required trait method in \ @@ -2673,11 +2669,11 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { ast::item_enum(_, _) => { register_fn(ccx, (*v).span, sym, id, ty) } - _ => fail!("node_variant, shouldn't happen") + _ => fail2!("node_variant, shouldn't happen") }; } ast::struct_variant_kind(_) => { - fail!("struct variant kind unexpected in get_item_val") + fail2!("struct variant kind unexpected in get_item_val") } } set_inline_hint(llfn); @@ -2704,7 +2700,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { } ref variant => { - ccx.sess.bug(fmt!("get_item_val(): unexpected variant: %?", + ccx.sess.bug(format!("get_item_val(): unexpected variant: {:?}", variant)) } }; @@ -2959,7 +2955,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta, let cstore = sess.cstore; while cstore::have_crate_data(cstore, n_subcrates) { n_subcrates += 1; } let mapname = if *sess.building_library { - fmt!("%s_%s_%s", mapmeta.name, mapmeta.vers, mapmeta.extras_hash) + format!("{}_{}_{}", mapmeta.name, mapmeta.vers, mapmeta.extras_hash) } else { ~"toplevel" }; @@ -2988,7 +2984,7 @@ pub fn fill_crate_map(ccx: &mut CrateContext, map: ValueRef) { let cstore = ccx.sess.cstore; while cstore::have_crate_data(cstore, i) { let cdata = cstore::get_crate_data(cstore, i); - let nm = fmt!("_rust_crate_map_%s_%s_%s", + let nm = format!("_rust_crate_map_{}_{}_{}", cdata.name, cstore::get_crate_vers(cstore, i), cstore::get_crate_hash(cstore, i)); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 1cad4f8a93f00..1754741a1f4fe 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -29,7 +29,7 @@ pub fn terminate(cx: &mut Block, _: &str) { pub fn check_not_terminated(cx: &Block) { if cx.terminated { - fail!("already terminated!"); + fail2!("already terminated!"); } } @@ -117,7 +117,7 @@ pub fn Invoke(cx: @mut Block, } check_not_terminated(cx); terminate(cx, "Invoke"); - debug!("Invoke(%s with arguments (%s))", + debug2!("Invoke({} with arguments ({}))", cx.val_to_str(Fn), Args.map(|a| cx.val_to_str(*a)).connect(", ")); B(cx).invoke(Fn, Args, Then, Catch, attributes) diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs index d7a4dbb3510fe..febe4de730da7 100644 --- a/src/librustc/middle/trans/builder.rs +++ b/src/librustc/middle/trans/builder.rs @@ -476,7 +476,7 @@ impl Builder { } pub fn store(&self, val: ValueRef, ptr: ValueRef) { - debug!("Store %s -> %s", + debug2!("Store {} -> {}", self.ccx.tn.val_to_str(val), self.ccx.tn.val_to_str(ptr)); assert!(is_not_null(self.llbuilder)); @@ -487,7 +487,7 @@ impl Builder { } pub fn atomic_store(&self, val: ValueRef, ptr: ValueRef, order: AtomicOrdering) { - debug!("Store %s -> %s", + debug2!("Store {} -> {}", self.ccx.tn.val_to_str(val), self.ccx.tn.val_to_str(ptr)); self.count_insn("store.atomic"); @@ -725,8 +725,8 @@ impl Builder { pub fn add_span_comment(&self, sp: Span, text: &str) { if self.ccx.sess.asm_comments() { - let s = fmt!("%s (%s)", text, self.ccx.sess.codemap.span_to_str(sp)); - debug!("%s", s); + let s = format!("{} ({})", text, self.ccx.sess.codemap.span_to_str(sp)); + debug2!("{}", s); self.add_comment(s); } } @@ -734,7 +734,7 @@ impl Builder { pub fn add_comment(&self, text: &str) { if self.ccx.sess.asm_comments() { let sanitized = text.replace("$", ""); - let comment_text = fmt!("# %s", sanitized.replace("\n", "\n\t# ")); + let comment_text = format!("\\# {}", sanitized.replace("\n", "\n\t# ")); self.count_insn("inlineasm"); let asm = do comment_text.with_c_str |c| { unsafe { @@ -758,11 +758,11 @@ impl Builder { else { lib::llvm::False }; let argtys = do inputs.map |v| { - debug!("Asm Input Type: %?", self.ccx.tn.val_to_str(*v)); + debug2!("Asm Input Type: {:?}", self.ccx.tn.val_to_str(*v)); val_ty(*v) }; - debug!("Asm Output Type: %?", self.ccx.tn.type_to_str(output)); + debug2!("Asm Output Type: {:?}", self.ccx.tn.type_to_str(output)); let fty = Type::func(argtys, &output); unsafe { let v = llvm::LLVMInlineAsm( diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs index 19f0b9b78eb35..2cba0615310f7 100644 --- a/src/librustc/middle/trans/cabi_arm.rs +++ b/src/librustc/middle/trans/cabi_arm.rs @@ -49,7 +49,7 @@ fn ty_align(ty: Type) -> uint { let elt = ty.element_type(); ty_align(elt) } - _ => fail!("ty_align: unhandled type") + _ => fail2!("ty_align: unhandled type") } } @@ -79,7 +79,7 @@ fn ty_size(ty: Type) -> uint { let eltsz = ty_size(elt); len * eltsz } - _ => fail!("ty_size: unhandled type") + _ => fail2!("ty_size: unhandled type") } } diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs index 4577bf11b84de..3d11c3dafb2e9 100644 --- a/src/librustc/middle/trans/cabi_mips.rs +++ b/src/librustc/middle/trans/cabi_mips.rs @@ -51,7 +51,7 @@ fn ty_align(ty: Type) -> uint { let elt = ty.element_type(); ty_align(elt) } - _ => fail!("ty_size: unhandled type") + _ => fail2!("ty_size: unhandled type") } } @@ -81,7 +81,7 @@ fn ty_size(ty: Type) -> uint { let eltsz = ty_size(elt); len * eltsz } - _ => fail!("ty_size: unhandled type") + _ => fail2!("ty_size: unhandled type") } } diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 179366878418f..9f098fe3cc116 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -112,7 +112,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] { let elt = ty.element_type(); ty_align(elt) } - _ => fail!("ty_size: unhandled type") + _ => fail2!("ty_size: unhandled type") } } @@ -141,7 +141,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] { let eltsz = ty_size(elt); len * eltsz } - _ => fail!("ty_size: unhandled type") + _ => fail2!("ty_size: unhandled type") } } @@ -232,7 +232,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] { i += 1u; } } - _ => fail!("classify: unhandled type") + _ => fail2!("classify: unhandled type") } } @@ -325,7 +325,7 @@ fn llreg_ty(cls: &[RegClass]) -> Type { SSEDs => { tys.push(Type::f64()); } - _ => fail!("llregtype: unhandled class") + _ => fail2!("llregtype: unhandled class") } i += 1u; } diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index a3788d7cbdef4..c1a9f7649626a 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -79,7 +79,7 @@ pub struct Callee { pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee { let _icx = push_ctxt("trans_callee"); - debug!("callee::trans(expr=%s)", expr.repr(bcx.tcx())); + debug2!("callee::trans(expr={})", expr.repr(bcx.tcx())); // pick out special kinds of expressions that can be called: match expr.node { @@ -105,7 +105,7 @@ pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee { _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("Type of callee is neither bare-fn nor closure: %s", + format!("Type of callee is neither bare-fn nor closure: {}", bcx.ty_to_str(datum.ty))); } } @@ -153,7 +153,7 @@ pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee { ast::DefSelfTy(*) | ast::DefMethod(*) => { bcx.tcx().sess.span_bug( ref_expr.span, - fmt!("Cannot translate def %? \ + format!("Cannot translate def {:?} \ to a callable thing!", def)); } } @@ -180,7 +180,7 @@ pub fn trans_fn_ref(bcx: @mut Block, let type_params = node_id_type_params(bcx, ref_id); let vtables = node_vtables(bcx, ref_id); - debug!("trans_fn_ref(def_id=%s, ref_id=%?, type_params=%s, vtables=%s)", + debug2!("trans_fn_ref(def_id={}, ref_id={:?}, type_params={}, vtables={})", def_id.repr(bcx.tcx()), ref_id, type_params.repr(bcx.tcx()), vtables.repr(bcx.tcx())); trans_fn_ref_with_vtables(bcx, def_id, ref_id, type_params, vtables) @@ -266,8 +266,8 @@ pub fn trans_fn_ref_with_vtables( let ccx = bcx.ccx(); let tcx = ccx.tcx; - debug!("trans_fn_ref_with_vtables(bcx=%s, def_id=%s, ref_id=%?, \ - type_params=%s, vtables=%s)", + debug2!("trans_fn_ref_with_vtables(bcx={}, def_id={}, ref_id={:?}, \ + type_params={}, vtables={})", bcx.to_str(), def_id.repr(bcx.tcx()), ref_id, @@ -329,11 +329,11 @@ pub fn trans_fn_ref_with_vtables( resolve_default_method_vtables(bcx, impl_id, method, &substs, vtables); - debug!("trans_fn_with_vtables - default method: \ - substs = %s, trait_subst = %s, \ - first_subst = %s, new_subst = %s, \ - vtables = %s, \ - self_vtable = %s, param_vtables = %s", + debug2!("trans_fn_with_vtables - default method: \ + substs = {}, trait_subst = {}, \ + first_subst = {}, new_subst = {}, \ + vtables = {}, \ + self_vtable = {}, param_vtables = {}", substs.repr(tcx), trait_ref.substs.repr(tcx), first_subst.repr(tcx), new_substs.repr(tcx), vtables.repr(tcx), @@ -365,7 +365,7 @@ pub fn trans_fn_ref_with_vtables( let map_node = session::expect( ccx.sess, ccx.tcx.items.find(&def_id.node), - || fmt!("local item should be in ast map")); + || format!("local item should be in ast map")); match *map_node { ast_map::node_foreign_item(_, abis, _, _) => { @@ -472,7 +472,7 @@ pub fn trans_method_call(in_cx: @mut Block, dest: expr::Dest) -> @mut Block { let _icx = push_ctxt("trans_method_call"); - debug!("trans_method_call(call_ex=%s, rcvr=%s)", + debug2!("trans_method_call(call_ex={}, rcvr={})", call_ex.repr(in_cx.tcx()), rcvr.repr(in_cx.tcx())); trans_call_inner( @@ -483,7 +483,7 @@ pub fn trans_method_call(in_cx: @mut Block, |cx| { match cx.ccx().maps.method_map.find_copy(&call_ex.id) { Some(origin) => { - debug!("origin for %s: %s", + debug2!("origin for {}: {}", call_ex.repr(in_cx.tcx()), origin.repr(in_cx.tcx())); @@ -562,7 +562,7 @@ pub fn trans_lang_call_with_type_params(bcx: @mut Block, substituted); new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty); } - _ => fail!() + _ => fail2!() } Callee { bcx: callee.bcx, data: Fn(FnData { llfn: new_llval }) } }, @@ -840,7 +840,7 @@ pub fn trans_arg_expr(bcx: @mut Block, let _icx = push_ctxt("trans_arg_expr"); let ccx = bcx.ccx(); - debug!("trans_arg_expr(formal_arg_ty=(%s), self_mode=%?, arg_expr=%s)", + debug2!("trans_arg_expr(formal_arg_ty=({}), self_mode={:?}, arg_expr={})", formal_arg_ty.repr(bcx.tcx()), self_mode, arg_expr.repr(bcx.tcx())); @@ -850,7 +850,7 @@ pub fn trans_arg_expr(bcx: @mut Block, let arg_datum = arg_datumblock.datum; let bcx = arg_datumblock.bcx; - debug!(" arg datum: %s", arg_datum.to_str(bcx.ccx())); + debug2!(" arg datum: {}", arg_datum.to_str(bcx.ccx())); let mut val; if ty::type_is_bot(arg_datum.ty) { @@ -890,11 +890,11 @@ pub fn trans_arg_expr(bcx: @mut Block, val = match self_mode { ty::ByRef => { - debug!("by ref arg with type %s", bcx.ty_to_str(arg_datum.ty)); + debug2!("by ref arg with type {}", bcx.ty_to_str(arg_datum.ty)); arg_datum.to_ref_llval(bcx) } ty::ByCopy => { - debug!("by copy arg with type %s", bcx.ty_to_str(arg_datum.ty)); + debug2!("by copy arg with type {}", bcx.ty_to_str(arg_datum.ty)); arg_datum.to_appropriate_llval(bcx) } } @@ -904,12 +904,12 @@ pub fn trans_arg_expr(bcx: @mut Block, if formal_arg_ty != arg_datum.ty { // this could happen due to e.g. subtyping let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, formal_arg_ty); - debug!("casting actual type (%s) to match formal (%s)", + debug2!("casting actual type ({}) to match formal ({})", bcx.val_to_str(val), bcx.llty_str(llformal_arg_ty)); val = PointerCast(bcx, val, llformal_arg_ty); } } - debug!("--- trans_arg_expr passing %s", bcx.val_to_str(val)); + debug2!("--- trans_arg_expr passing {}", bcx.val_to_str(val)); return rslt(bcx, val); } diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index b5b181e22a6eb..875be5d3af54a 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -127,7 +127,7 @@ impl EnvAction { impl EnvValue { pub fn to_str(&self, ccx: &CrateContext) -> ~str { - fmt!("%s(%s)", self.action.to_str(), self.datum.to_str(ccx)) + format!("{}({})", self.action.to_str(), self.datum.to_str(ccx)) } } @@ -151,7 +151,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt, } }); let cdata_ty = ty::mk_tup(tcx, bound_tys); - debug!("cdata_ty=%s", ty_to_str(tcx, cdata_ty)); + debug2!("cdata_ty={}", ty_to_str(tcx, cdata_ty)); return cdata_ty; } @@ -224,15 +224,15 @@ pub fn store_environment(bcx: @mut Block, let Result {bcx: bcx, val: llbox} = allocate_cbox(bcx, sigil, cdata_ty); let llbox = PointerCast(bcx, llbox, llboxptr_ty); - debug!("tuplify_box_ty = %s", ty_to_str(tcx, cbox_ty)); + debug2!("tuplify_box_ty = {}", ty_to_str(tcx, cbox_ty)); // Copy expr values into boxed bindings. let mut bcx = bcx; for (i, bv) in bound_values.iter().enumerate() { - debug!("Copy %s into closure", bv.to_str(ccx)); + debug2!("Copy {} into closure", bv.to_str(ccx)); if ccx.sess.asm_comments() { - add_comment(bcx, fmt!("Copy %s into closure", + add_comment(bcx, format!("Copy {} into closure", bv.to_str(ccx))); } @@ -268,7 +268,7 @@ pub fn build_closure(bcx0: @mut Block, // Package up the captured upvars let mut env_vals = ~[]; for cap_var in cap_vars.iter() { - debug!("Building closure: captured variable %?", *cap_var); + debug2!("Building closure: captured variable {:?}", *cap_var); let datum = expr::trans_local_var(bcx, cap_var.def); match cap_var.mode { moves::CapRef => { @@ -384,7 +384,7 @@ pub fn trans_expr_fn(bcx: @mut Block, let fty = node_id_type(bcx, outer_id); let f = match ty::get(fty).sty { ty::ty_closure(ref f) => f, - _ => fail!("expected closure") + _ => fail2!("expected closure") }; let sub_path = vec::append_one(bcx.fcx.path.clone(), diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index f030fb4996b59..4d46ae385eb2f 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -169,7 +169,7 @@ impl param_substs { } fn param_substs_to_str(this: ¶m_substs, tcx: ty::ctxt) -> ~str { - fmt!("param_substs {tys:%s, vtables:%s}", + format!("param_substs \\{tys:{}, vtables:{}\\}", this.tys.repr(tcx), this.vtables.repr(tcx)) } @@ -436,7 +436,7 @@ pub fn add_clean(bcx: @mut Block, val: ValueRef, t: ty::t) { return } - debug!("add_clean(%s, %s, %s)", bcx.to_str(), bcx.val_to_str(val), t.repr(bcx.tcx())); + debug2!("add_clean({}, {}, {})", bcx.to_str(), bcx.val_to_str(val), t.repr(bcx.tcx())); let cleanup_type = cleanup_type(bcx.tcx(), t); do in_scope_cx(bcx, None) |scope_info| { @@ -451,7 +451,7 @@ pub fn add_clean(bcx: @mut Block, val: ValueRef, t: ty::t) { pub fn add_clean_temp_immediate(cx: @mut Block, val: ValueRef, ty: ty::t) { if !ty::type_needs_drop(cx.tcx(), ty) { return; } - debug!("add_clean_temp_immediate(%s, %s, %s)", + debug2!("add_clean_temp_immediate({}, {}, {})", cx.to_str(), cx.val_to_str(val), ty.repr(cx.tcx())); let cleanup_type = cleanup_type(cx.tcx(), ty); @@ -480,7 +480,7 @@ pub fn add_clean_temp_mem_in_scope(bcx: @mut Block, pub fn add_clean_temp_mem_in_scope_(bcx: @mut Block, scope_id: Option, val: ValueRef, t: ty::t) { if !ty::type_needs_drop(bcx.tcx(), t) { return; } - debug!("add_clean_temp_mem(%s, %s, %s)", + debug2!("add_clean_temp_mem({}, {}, {})", bcx.to_str(), bcx.val_to_str(val), t.repr(bcx.tcx())); let cleanup_type = cleanup_type(bcx.tcx(), t); @@ -509,7 +509,7 @@ pub fn add_clean_return_to_mut(bcx: @mut Block, //! box was frozen initially. Here, both `frozen_val_ref` and //! `bits_val_ref` are in fact pointers to stack slots. - debug!("add_clean_return_to_mut(%s, %s, %s)", + debug2!("add_clean_return_to_mut({}, {}, {})", bcx.to_str(), bcx.val_to_str(frozen_val_ref), bcx.val_to_str(bits_val_ref)); @@ -705,8 +705,8 @@ impl Block { match self.tcx().def_map.find(&nid) { Some(&v) => v, None => { - self.tcx().sess.bug(fmt!( - "No def associated with node id %?", nid)); + self.tcx().sess.bug(format!( + "No def associated with node id {:?}", nid)); } } } @@ -726,8 +726,8 @@ impl Block { pub fn to_str(&self) -> ~str { unsafe { match self.node_info { - Some(node_info) => fmt!("[block %d]", node_info.id), - None => fmt!("[block %x]", transmute(&*self)), + Some(node_info) => format!("[block {}]", node_info.id), + None => format!("[block {}]", transmute::<&Block, *Block>(self)), } } } @@ -763,7 +763,7 @@ pub fn in_scope_cx(cx: @mut Block, scope_id: Option, f: &fn(si: &mu Some(inf) => match scope_id { Some(wanted) => match inf.node_info { Some(NodeInfo { id: actual, _ }) if wanted == actual => { - debug!("in_scope_cx: selected cur=%s (cx=%s)", + debug2!("in_scope_cx: selected cur={} (cx={})", cur.to_str(), cx.to_str()); f(inf); return; @@ -771,7 +771,7 @@ pub fn in_scope_cx(cx: @mut Block, scope_id: Option, f: &fn(si: &mu _ => inf.parent, }, None => { - debug!("in_scope_cx: selected cur=%s (cx=%s)", + debug2!("in_scope_cx: selected cur={} (cx={})", cur.to_str(), cx.to_str()); f(inf); return; @@ -788,7 +788,7 @@ pub fn in_scope_cx(cx: @mut Block, scope_id: Option, f: &fn(si: &mu pub fn block_parent(cx: @mut Block) -> @mut Block { match cx.parent { Some(b) => b, - None => cx.sess().bug(fmt!("block_parent called on root block %?", + None => cx.sess().bug(format!("block_parent called on root block {:?}", cx)) } } @@ -881,7 +881,7 @@ pub fn C_cstr(cx: &mut CrateContext, s: @str) -> ValueRef { }; let gsym = token::gensym("str"); - let g = do fmt!("str%u", gsym).with_c_str |buf| { + let g = do format!("str{}", gsym).with_c_str |buf| { llvm::LLVMAddGlobal(cx.llmod, val_ty(sc).to_ref(), buf) }; llvm::LLVMSetInitializer(g, sc); @@ -964,7 +964,7 @@ pub fn const_get_elt(cx: &CrateContext, v: ValueRef, us: &[c_uint]) llvm::LLVMConstExtractValue(v, p, len as c_uint) }; - debug!("const_get_elt(v=%s, us=%?, r=%s)", + debug2!("const_get_elt(v={}, us={:?}, r={})", cx.tn.val_to_str(v), us, cx.tn.val_to_str(r)); return r; @@ -1115,7 +1115,7 @@ pub fn node_id_type_params(bcx: &mut Block, id: ast::NodeId) -> ~[ty::t] { if !params.iter().all(|t| !ty::type_needs_infer(*t)) { bcx.sess().bug( - fmt!("Type parameters for node %d include inference types: %s", + format!("Type parameters for node {} include inference types: {}", id, params.map(|t| bcx.ty_to_str(*t)).connect(","))); } @@ -1193,7 +1193,7 @@ pub fn resolve_vtable_under_param_substs(tcx: ty::ctxt, find_vtable(tcx, substs, n_param, n_bound) } _ => { - tcx.sess.bug(fmt!( + tcx.sess.bug(format!( "resolve_vtable_under_param_substs: asked to lookup \ but no vtables in the fn_ctxt!")) } @@ -1207,7 +1207,7 @@ pub fn find_vtable(tcx: ty::ctxt, n_param: typeck::param_index, n_bound: uint) -> typeck::vtable_origin { - debug!("find_vtable(n_param=%?, n_bound=%u, ps=%s)", + debug2!("find_vtable(n_param={:?}, n_bound={}, ps={})", n_param, n_bound, ps.repr(tcx)); let param_bounds = match n_param { @@ -1248,7 +1248,7 @@ pub fn langcall(bcx: @mut Block, span: Option, msg: &str, match bcx.tcx().lang_items.require(li) { Ok(id) => id, Err(s) => { - let msg = fmt!("%s %s", msg, s); + let msg = format!("{} {}", msg, s); match span { Some(span) => { bcx.tcx().sess.span_fatal(span, msg); } None => { bcx.tcx().sess.fatal(msg); } diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index 7d208c896b7ca..aa56631438638 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -52,7 +52,7 @@ pub fn const_lit(cx: &mut CrateContext, e: &ast::Expr, lit: ast::lit) C_integral(Type::uint_from_ty(cx, t), i as u64, false) } _ => cx.sess.span_bug(lit.span, - fmt!("integer literal has type %s (expected int or uint)", + format!("integer literal has type {} (expected int or uint)", ty_to_str(cx.tcx, lit_int_ty))) } } @@ -144,14 +144,14 @@ fn const_deref(cx: &mut CrateContext, v: ValueRef, t: ty::t, explicit: bool) const_deref_newtype(cx, v, t) } _ => { - cx.sess.bug(fmt!("Unexpected dereferenceable type %s", + cx.sess.bug(format!("Unexpected dereferenceable type {}", ty_to_str(cx.tcx, t))) } }; (dv, mt.ty) } None => { - cx.sess.bug(fmt!("Can't dereference const of type %s", + cx.sess.bug(format!("Can't dereference const of type {}", ty_to_str(cx.tcx, t))) } } @@ -189,8 +189,8 @@ pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) { llconst = C_struct([llconst, C_null(Type::opaque_box(cx).ptr_to())]) } Some(@ty::AutoAddEnv(ref r, ref s)) => { - cx.sess.span_bug(e.span, fmt!("unexpected static function: \ - region %? sigil %?", *r, *s)) + cx.sess.span_bug(e.span, format!("unexpected static function: \ + region {:?} sigil {:?}", *r, *s)) } Some(@ty::AutoDerefRef(ref adj)) => { let mut ty = ety; @@ -234,8 +234,8 @@ pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) { } _ => { cx.sess.span_bug(e.span, - fmt!("unimplemented const \ - autoref %?", autoref)) + format!("unimplemented const \ + autoref {:?}", autoref)) } } } @@ -253,7 +253,7 @@ pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) { llvm::LLVMDumpValue(llconst); llvm::LLVMDumpValue(C_undef(llty)); } - cx.sess.bug(fmt!("const %s of type %s has size %u instead of %u", + cx.sess.bug(format!("const {} of type {} has size {} instead of {}", e.repr(cx.tcx), ty_to_str(cx.tcx, ety), csize, tsize)); } diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs index 36757374b0b06..d2a3557d85b9e 100644 --- a/src/librustc/middle/trans/context.rs +++ b/src/librustc/middle/trans/context.rs @@ -252,7 +252,7 @@ impl CrateContext { pub fn const_inbounds_gepi(&self, pointer: ValueRef, indices: &[uint]) -> ValueRef { - debug!("const_inbounds_gepi: pointer=%s indices=%?", + debug2!("const_inbounds_gepi: pointer={} indices={:?}", self.tn.val_to_str(pointer), indices); let v: ~[ValueRef] = indices.iter().map(|i| C_i32(*i as i32)).collect(); diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index 73e7a6745fb3c..105cb6e5606db 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -50,7 +50,7 @@ pub fn trans_if(bcx: @mut Block, els: Option<@ast::Expr>, dest: expr::Dest) -> @mut Block { - debug!("trans_if(bcx=%s, cond=%s, thn=%?, dest=%s)", + debug2!("trans_if(bcx={}, cond={}, thn={:?}, dest={})", bcx.to_str(), bcx.expr_to_str(cond), thn.id, dest.to_str(bcx.ccx())); let _indenter = indenter(); @@ -119,7 +119,7 @@ pub fn trans_if(bcx: @mut Block, } }; - debug!("then_bcx_in=%s, else_bcx_in=%s", + debug2!("then_bcx_in={}, else_bcx_in={}", then_bcx_in.to_str(), else_bcx_in.to_str()); CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb); diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index e48174b04f840..7842215912640 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -242,7 +242,7 @@ impl Datum { action: CopyAction, datum: Datum) -> @mut Block { - debug!("store_to_datum(self=%s, action=%?, datum=%s)", + debug2!("store_to_datum(self={}, action={:?}, datum={})", self.to_str(bcx.ccx()), action, datum.to_str(bcx.ccx())); assert!(datum.mode.is_by_ref()); self.store_to(bcx, action, datum.val) @@ -275,7 +275,7 @@ impl Datum { return bcx; } - debug!("copy_to(self=%s, action=%?, dst=%s)", + debug2!("copy_to(self={}, action={:?}, dst={})", self.to_str(bcx.ccx()), action, bcx.val_to_str(dst)); // Watch out for the case where we are writing the copying the @@ -340,7 +340,7 @@ impl Datum { let _icx = push_ctxt("move_to"); let mut bcx = bcx; - debug!("move_to(self=%s, action=%?, dst=%s)", + debug2!("move_to(self={}, action={:?}, dst={})", self.to_str(bcx.ccx()), action, bcx.val_to_str(dst)); if ty::type_is_voidish(self.ty) { @@ -380,7 +380,7 @@ impl Datum { } ByRef(ZeroMem) => { bcx.tcx().sess.bug( - fmt!("Cannot add clean to a 'zero-mem' datum")); + format!("Cannot add clean to a 'zero-mem' datum")); } } } @@ -404,7 +404,7 @@ impl Datum { } pub fn to_str(&self, ccx: &CrateContext) -> ~str { - fmt!("Datum { val=%s, ty=%s, mode=%? }", + format!("Datum \\{ val={}, ty={}, mode={:?} \\}", ccx.tn.val_to_str(self.val), ty_to_str(ccx.tcx, self.ty), self.mode) @@ -573,8 +573,8 @@ impl Datum { (unboxed_vec_ty, true) } _ => { - bcx.tcx().sess.bug(fmt!( - "box_body() invoked on non-box type %s", + bcx.tcx().sess.bug(format!( + "box_body() invoked on non-box type {}", ty_to_str(bcx.tcx(), self.ty))); } }; @@ -620,7 +620,7 @@ impl Datum { -> (Option, @mut Block) { let ccx = bcx.ccx(); - debug!("try_deref(expr_id=%?, derefs=%?, is_auto=%b, self=%?)", + debug2!("try_deref(expr_id={:?}, derefs={:?}, is_auto={}, self={:?})", expr_id, derefs, is_auto, self.to_str(bcx.ccx())); let bcx = @@ -745,7 +745,7 @@ impl Datum { -> DatumBlock { let _icx = push_ctxt("autoderef"); - debug!("autoderef(expr_id=%d, max=%?, self=%?)", + debug2!("autoderef(expr_id={}, max={:?}, self={:?})", expr_id, max, self.to_str(bcx.ccx())); let _indenter = indenter(); diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index c36d427a06cae..3f4c2e8abc586 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -142,7 +142,7 @@ pub struct CrateDebugContext { impl CrateDebugContext { pub fn new(llmod: ModuleRef, crate: ~str) -> CrateDebugContext { - debug!("CrateDebugContext::new"); + debug2!("CrateDebugContext::new"); let builder = unsafe { llvm::LLVMDIBuilderCreate(llmod) }; // DIBuilder inherits context from the module, so we'd better use the same one let llcontext = unsafe { llvm::LLVMGetModuleContext(llmod) }; @@ -240,7 +240,7 @@ pub fn finalize(cx: @mut CrateContext) { return; } - debug!("finalize"); + debug2!("finalize"); compile_unit_metadata(cx); unsafe { llvm::LLVMDIBuilderFinalize(DIB(cx)); @@ -268,7 +268,8 @@ pub fn create_local_var_metadata(bcx: @mut Block, let llptr = match bcx.fcx.lllocals.find_copy(&node_id) { Some(v) => v, None => { - bcx.tcx().sess.span_bug(span, fmt!("No entry in lllocals table for %?", node_id)); + bcx.tcx().sess.span_bug(span, + format!("No entry in lllocals table for {:?}", node_id)); } }; @@ -310,8 +311,8 @@ pub fn create_captured_var_metadata(bcx: @mut Block, ast_util::path_to_ident(path) } _ => { - cx.sess.span_bug(span, fmt!("debuginfo::create_captured_var_metadata() - \ - Captured var-id refers to unexpected ast_map variant: %?", ast_item)); + cx.sess.span_bug(span, format!("debuginfo::create_captured_var_metadata() - \ + Captured var-id refers to unexpected ast_map variant: {:?}", ast_item)); } }; @@ -366,7 +367,7 @@ pub fn create_match_binding_metadata(bcx: @mut Block, let llptr = match bcx.fcx.lllocals.find_copy(&node_id) { Some(v) => v, None => { - bcx.tcx().sess.span_bug(span, fmt!("No entry in lllocals table for %?", node_id)); + bcx.tcx().sess.span_bug(span, format!("No entry in lllocals table for {:?}", node_id)); } }; @@ -408,7 +409,7 @@ pub fn create_self_argument_metadata(bcx: @mut Block, explicit_self.span } _ => bcx.ccx().sess.bug( - fmt!("create_self_argument_metadata: unexpected sort of node: %?", fnitem)) + format!("create_self_argument_metadata: unexpected sort of node: {:?}", fnitem)) }; let scope_metadata = bcx.fcx.debug_context.get_ref(bcx.ccx(), span).fn_metadata; @@ -459,7 +460,8 @@ pub fn create_argument_metadata(bcx: @mut Block, let llptr = match bcx.fcx.llargs.find_copy(&node_id) { Some(v) => v, None => { - bcx.tcx().sess.span_bug(span, fmt!("No entry in llargs table for %?", node_id)); + bcx.tcx().sess.span_bug(span, + format!("No entry in llargs table for {:?}", node_id)); } }; @@ -501,7 +503,7 @@ pub fn set_source_location(fcx: &FunctionContext, let cx = fcx.ccx; - debug!("set_source_location: %s", cx.sess.codemap.span_to_str(span)); + debug2!("set_source_location: {}", cx.sess.codemap.span_to_str(span)); if fcx.debug_context.get_ref(cx, span).source_locations_enabled { let loc = span_start(cx, span); @@ -574,7 +576,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext, ast_map::node_expr(ref expr) => { match expr.node { ast::ExprFnBlock(ref fn_decl, ref top_level_block) => { - let name = fmt!("fn%u", token::gensym("fn")); + let name = format!("fn{}", token::gensym("fn")); let name = token::str_to_ident(name); (name, fn_decl, // This is not quite right. It should actually inherit the generics of the @@ -606,7 +608,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext, ast_map::node_struct_ctor(*) => { return FunctionWithoutDebugInfo; } - _ => cx.sess.bug(fmt!("create_function_debug_context: unexpected sort of node: %?", fnitem)) + _ => cx.sess.bug(format!("create_function_debug_context: \ + unexpected sort of node: {:?}", fnitem)) }; // This can be the case for functions inlined from another crate @@ -637,8 +640,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext, } None => { // This branch is only hit when there is a bug in the NamespaceVisitor. - cx.sess.span_warn(span, fmt!("debuginfo: Could not find namespace node for function - with name %s. This is a bug! Please report this to + cx.sess.span_warn(span, format!("debuginfo: Could not find namespace node for function + with name {}. This is a bug! Please report this to github.com/mozilla/rust/issues", function_name)); (function_name.clone(), file_metadata) } @@ -870,10 +873,10 @@ fn compile_unit_metadata(cx: @mut CrateContext) { let dcx = debug_context(cx); let crate_name: &str = dcx.crate_file; - debug!("compile_unit_metadata: %?", crate_name); + debug2!("compile_unit_metadata: {:?}", crate_name); let work_dir = cx.sess.working_dir.to_str(); - let producer = fmt!("rustc version %s", env!("CFG_VERSION")); + let producer = format!("rustc version {}", env!("CFG_VERSION")); do crate_name.with_c_str |crate_name| { do work_dir.with_c_str |work_dir| { @@ -980,7 +983,7 @@ fn file_metadata(cx: &mut CrateContext, full_path: &str) -> DIFile { None => () } - debug!("file_metadata: %s", full_path); + debug2!("file_metadata: {}", full_path); let work_dir = cx.sess.working_dir.to_str(); let file_name = @@ -1015,14 +1018,14 @@ fn scope_metadata(fcx: &FunctionContext, let node = fcx.ccx.tcx.items.get_copy(&node_id); fcx.ccx.sess.span_bug(span, - fmt!("debuginfo: Could not find scope info for node %?", node)); + format!("debuginfo: Could not find scope info for node {:?}", node)); } } } fn basic_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType { - debug!("basic_type_metadata: %?", ty::get(t)); + debug2!("basic_type_metadata: {:?}", ty::get(t)); let (name, encoding) = match ty::get(t).sty { ty::ty_nil | ty::ty_bot => (~"uint", DW_ATE_unsigned), @@ -1340,8 +1343,8 @@ fn describe_variant(cx: &mut CrateContext, Some(&ast_map::node_variant(ref variant, _, _)) => variant.span, ref node => { cx.sess.span_warn(span, - fmt!("debuginfo::enum_metadata()::adt_struct_metadata() - Unexpected node \ - type: %?. This is a bug.", node)); + format!("debuginfo::enum_metadata()::adt_struct_metadata() - Unexpected node \ + type: {:?}. This is a bug.", node)); codemap::dummy_sp() } } @@ -1659,7 +1662,7 @@ fn boxed_type_metadata(cx: &mut CrateContext, span: Span) -> DICompositeType { let box_type_name = match content_type_name { - Some(content_type_name) => fmt!("Boxed<%s>", content_type_name), + Some(content_type_name) => format!("Boxed<{}>", content_type_name), None => ~"BoxedType" }; @@ -1768,7 +1771,7 @@ fn vec_metadata(cx: &mut CrateContext, let (element_size, element_align) = size_and_align_of(cx, element_llvm_type); let vec_llvm_type = Type::vec(cx.sess.targ_cfg.arch, &element_llvm_type); - let vec_type_name: &str = fmt!("[%s]", ppaux::ty_to_str(cx.tcx, element_type)); + let vec_type_name: &str = format!("[{}]", ppaux::ty_to_str(cx.tcx, element_type)); let member_llvm_types = vec_llvm_type.field_types(); @@ -1824,7 +1827,7 @@ fn boxed_vec_metadata(cx: &mut CrateContext, -> DICompositeType { let element_llvm_type = type_of::type_of(cx, element_type); let vec_llvm_type = Type::vec(cx.sess.targ_cfg.arch, &element_llvm_type); - let vec_type_name: &str = fmt!("[%s]", ppaux::ty_to_str(cx.tcx, element_type)); + let vec_type_name: &str = format!("[{}]", ppaux::ty_to_str(cx.tcx, element_type)); let vec_metadata = vec_metadata(cx, element_type, span); return boxed_type_metadata( @@ -1841,7 +1844,7 @@ fn vec_slice_metadata(cx: &mut CrateContext, span: Span) -> DICompositeType { - debug!("vec_slice_metadata: %?", ty::get(vec_type)); + debug2!("vec_slice_metadata: {:?}", ty::get(vec_type)); let slice_llvm_type = type_of::type_of(cx, vec_type); let slice_type_name = ppaux::ty_to_str(cx.tcx, vec_type); @@ -1956,10 +1959,10 @@ fn trait_metadata(cx: &mut CrateContext, } fn unimplemented_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType { - debug!("unimplemented_type_metadata: %?", ty::get(t)); + debug2!("unimplemented_type_metadata: {:?}", ty::get(t)); let name = ppaux::ty_to_str(cx.tcx, t); - let metadata = do fmt!("NYI<%s>", name).with_c_str |name| { + let metadata = do format!("NYI<{}>", name).with_c_str |name| { unsafe { llvm::LLVMDIBuilderCreateBasicType( DIB(cx), @@ -2008,7 +2011,7 @@ fn type_metadata(cx: &mut CrateContext, pointer_type_metadata(cx, pointer_type, box_metadata) } - debug!("type_metadata: %?", ty::get(t)); + debug2!("type_metadata: {:?}", ty::get(t)); let sty = &ty::get(t).sty; let type_metadata = match *sty { @@ -2095,7 +2098,7 @@ fn type_metadata(cx: &mut CrateContext, ty::ty_opaque_box => { create_pointer_to_box_metadata(cx, t, ty::mk_nil()) } - _ => cx.sess.bug(fmt!("debuginfo: unexpected type in type_metadata: %?", sty)) + _ => cx.sess.bug(format!("debuginfo: unexpected type in type_metadata: {:?}", sty)) }; debug_context(cx).created_types.insert(cache_id, type_metadata); @@ -2127,7 +2130,7 @@ fn set_debug_location(cx: &mut CrateContext, debug_location: DebugLocation) { match debug_location { KnownLocation { scope, line, col } => { - debug!("setting debug location to %u %u", line, col); + debug2!("setting debug location to {} {}", line, col); let elements = [C_i32(line as i32), C_i32(col as i32), scope, ptr::null()]; unsafe { metadata_node = llvm::LLVMMDNodeInContext(debug_context(cx).llcontext, @@ -2136,7 +2139,7 @@ fn set_debug_location(cx: &mut CrateContext, debug_location: DebugLocation) { } } UnknownLocation => { - debug!("clearing debug location "); + debug2!("clearing debug location "); metadata_node = ptr::null(); } }; @@ -2202,8 +2205,9 @@ fn get_namespace_and_span_for_item(cx: &mut CrateContext, let definition_span = match cx.tcx.items.find(&def_id.node) { Some(&ast_map::node_item(@ast::item { span, _ }, _)) => span, ref node => { - cx.sess.span_warn(warning_span, fmt!("debuginfo::get_namespace_and_span_for_item() \ - - Unexpected node type: %?", *node)); + cx.sess.span_warn(warning_span, + format!("debuginfo::get_namespace_and_span_for_item() \ + - Unexpected node type: {:?}", *node)); codemap::dummy_sp() } }; @@ -2682,7 +2686,7 @@ impl NamespaceTreeNode { let mut name = ~"_ZN"; fill_nested(self, &mut name); - name.push_str(fmt!("%u%s", item_name.len(), item_name)); + name.push_str(format!("{}{}", item_name.len(), item_name)); name.push_char('E'); return name; @@ -2695,7 +2699,7 @@ impl NamespaceTreeNode { None => {} } let name = token::ident_to_str(&node.ident); - output.push_str(fmt!("%u%s", name.len(), name)); + output.push_str(format!("{}{}", name.len(), name)); } } } @@ -2704,7 +2708,7 @@ fn namespace_for_external_item(cx: &mut CrateContext, item_path: &ast_map::path) -> @NamespaceTreeNode { if item_path.len() < 2 { - cx.sess.bug(fmt!("debuginfo::namespace_for_external_item() - Invalid item_path: %s", + cx.sess.bug(format!("debuginfo::namespace_for_external_item() - Invalid item_path: {}", ast_map::path_to_str(*item_path, token::get_ident_interner()))); } diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 56677167f0e00..995b246788854 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -169,7 +169,7 @@ pub enum Dest { impl Dest { pub fn to_str(&self, ccx: &CrateContext) -> ~str { match *self { - SaveIn(v) => fmt!("SaveIn(%s)", ccx.tn.val_to_str(v)), + SaveIn(v) => format!("SaveIn({})", ccx.tn.val_to_str(v)), Ignore => ~"Ignore" } } @@ -182,7 +182,7 @@ fn drop_and_cancel_clean(bcx: @mut Block, dat: Datum) -> @mut Block { } pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { - debug!("trans_to_datum(expr=%s)", bcx.expr_to_str(expr)); + debug2!("trans_to_datum(expr={})", bcx.expr_to_str(expr)); let mut bcx = bcx; let mut datum = unpack_datum!(bcx, trans_to_datum_unadjusted(bcx, expr)); @@ -190,7 +190,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { None => { return DatumBlock {bcx: bcx, datum: datum}; } Some(adj) => { adj } }; - debug!("unadjusted datum: %s", datum.to_str(bcx.ccx())); + debug2!("unadjusted datum: {}", datum.to_str(bcx.ccx())); match *adjustment { AutoAddEnv(*) => { datum = unpack_datum!(bcx, add_env(bcx, expr, datum)); @@ -232,7 +232,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { }; } } - debug!("after adjustments, datum=%s", datum.to_str(bcx.ccx())); + debug2!("after adjustments, datum={}", datum.to_str(bcx.ccx())); return DatumBlock {bcx: bcx, datum: datum}; fn auto_ref(bcx: @mut Block, datum: Datum) -> DatumBlock { @@ -287,7 +287,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { let tcx = bcx.tcx(); let closure_ty = expr_ty_adjusted(bcx, expr); - debug!("add_env(closure_ty=%s)", closure_ty.repr(tcx)); + debug2!("add_env(closure_ty={})", closure_ty.repr(tcx)); let scratch = scratch_datum(bcx, closure_ty, "__adjust", false); let llfn = GEPi(bcx, scratch.val, [0u, abi::fn_field_code]); assert_eq!(datum.appropriate_mode(tcx), ByValue); @@ -311,7 +311,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { source_datum: Datum) -> DatumBlock { let tcx = bcx.tcx(); let target_obj_ty = expr_ty_adjusted(bcx, expr); - debug!("auto_borrow_obj(target=%s)", + debug2!("auto_borrow_obj(target={})", target_obj_ty.repr(tcx)); // Extract source store information @@ -320,7 +320,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { _ => { bcx.sess().span_bug( expr.span, - fmt!("auto_borrow_trait_obj expected a trait, found %s", + format!("auto_borrow_trait_obj expected a trait, found {}", source_datum.ty.repr(bcx.tcx()))); } }; @@ -432,7 +432,7 @@ pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block { let ty = expr_ty(bcx, expr); - debug!("trans_into_unadjusted(expr=%s, dest=%s)", + debug2!("trans_into_unadjusted(expr={}, dest={})", bcx.expr_to_str(expr), dest.to_str(bcx.ccx())); let _indenter = indenter(); @@ -448,7 +448,7 @@ pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block { }; let kind = bcx.expr_kind(expr); - debug!("expr kind = %?", kind); + debug2!("expr kind = {:?}", kind); return match kind { ty::LvalueExpr => { let datumblock = trans_lvalue_unadjusted(bcx, expr); @@ -490,7 +490,7 @@ fn trans_lvalue(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { Some(_) => { bcx.sess().span_bug( expr.span, - fmt!("trans_lvalue() called on an expression \ + format!("trans_lvalue() called on an expression \ with adjustments")); } }; @@ -506,7 +506,7 @@ fn trans_to_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { let mut bcx = bcx; - debug!("trans_to_datum_unadjusted(expr=%s)", bcx.expr_to_str(expr)); + debug2!("trans_to_datum_unadjusted(expr={})", bcx.expr_to_str(expr)); let _indenter = indenter(); debuginfo::set_source_location(bcx.fcx, expr.id, expr.span); @@ -608,8 +608,8 @@ fn trans_rvalue_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBloc _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("trans_rvalue_datum_unadjusted reached \ - fall-through case: %?", + format!("trans_rvalue_datum_unadjusted reached \ + fall-through case: {:?}", expr.node)); } } @@ -662,8 +662,8 @@ fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> @mut Block _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("trans_rvalue_stmt_unadjusted reached \ - fall-through case: %?", + format!("trans_rvalue_stmt_unadjusted reached \ + fall-through case: {:?}", expr.node)); } }; @@ -718,7 +718,7 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr, ast::ExprFnBlock(ref decl, ref body) => { let expr_ty = expr_ty(bcx, expr); let sigil = ty::ty_closure_sigil(expr_ty); - debug!("translating fn_block %s with type %s", + debug2!("translating fn_block {} with type {}", expr_to_str(expr, tcx.sess.intr()), expr_ty.repr(tcx)); return closure::trans_expr_fn(bcx, sigil, decl, body, @@ -787,7 +787,7 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr, _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("trans_rvalue_dps_unadjusted reached fall-through case: %?", + format!("trans_rvalue_dps_unadjusted reached fall-through case: {:?}", expr.node)); } } @@ -836,8 +836,8 @@ fn trans_def_dps_unadjusted(bcx: @mut Block, ref_expr: &ast::Expr, return bcx; } _ => { - bcx.tcx().sess.span_bug(ref_expr.span, fmt!( - "Non-DPS def %? referened by %s", + bcx.tcx().sess.span_bug(ref_expr.span, format!( + "Non-DPS def {:?} referened by {}", def, bcx.node_id_to_str(ref_expr.id))); } } @@ -861,8 +861,8 @@ fn trans_def_datum_unadjusted(bcx: @mut Block, ref_expr.id) } _ => { - bcx.tcx().sess.span_bug(ref_expr.span, fmt!( - "Non-DPS def %? referened by %s", + bcx.tcx().sess.span_bug(ref_expr.span, format!( + "Non-DPS def {:?} referened by {}", def, bcx.node_id_to_str(ref_expr.id))); } }; @@ -887,7 +887,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { let _icx = push_ctxt("trans_lval"); let mut bcx = bcx; - debug!("trans_lvalue(expr=%s)", bcx.expr_to_str(expr)); + debug2!("trans_lvalue(expr={})", bcx.expr_to_str(expr)); let _indenter = indenter(); trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr))); @@ -912,7 +912,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("trans_lvalue reached fall-through case: %?", + format!("trans_lvalue reached fall-through case: {:?}", expr.node)); } }; @@ -978,8 +978,8 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { base_datum.get_vec_base_and_len(bcx, index_expr.span, index_expr.id, 0); - debug!("trans_index: base %s", bcx.val_to_str(base)); - debug!("trans_index: len %s", bcx.val_to_str(len)); + debug2!("trans_index: base {}", bcx.val_to_str(base)); + debug2!("trans_index: len {}", bcx.val_to_str(len)); let bounds_check = ICmp(bcx, lib::llvm::IntUGE, scaled_ix, len); let bcx = do with_cond(bcx, bounds_check) |bcx| { @@ -1091,8 +1091,8 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum { } } None => { - bcx.sess().bug(fmt!( - "trans_local_var: no llval for upvar %? found", nid)); + bcx.sess().bug(format!( + "trans_local_var: no llval for upvar {:?} found", nid)); } } } @@ -1106,13 +1106,13 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum { let self_info: ValSelfData = match bcx.fcx.llself { Some(ref self_info) => *self_info, None => { - bcx.sess().bug(fmt!( + bcx.sess().bug(format!( "trans_local_var: reference to self \ - out of context with id %?", nid)); + out of context with id {:?}", nid)); } }; - debug!("def_self() reference, self_info.t=%s", + debug2!("def_self() reference, self_info.t={}", self_info.t.repr(bcx.tcx())); Datum { @@ -1122,8 +1122,8 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum { } } _ => { - bcx.sess().unimpl(fmt!( - "unsupported def type in trans_local_var: %?", def)); + bcx.sess().unimpl(format!( + "unsupported def type in trans_local_var: {:?}", def)); } }; @@ -1133,12 +1133,12 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum { let v = match table.find(&nid) { Some(&v) => v, None => { - bcx.sess().bug(fmt!( - "trans_local_var: no llval for local/arg %? found", nid)); + bcx.sess().bug(format!( + "trans_local_var: no llval for local/arg {:?} found", nid)); } }; let ty = node_id_type(bcx, nid); - debug!("take_local(nid=%?, v=%s, ty=%s)", + debug2!("take_local(nid={:?}, v={}, ty={})", nid, bcx.val_to_str(v), bcx.ty_to_str(ty)); Datum { val: v, @@ -1164,8 +1164,8 @@ pub fn with_field_tys(tcx: ty::ctxt, // We want the *variant* ID here, not the enum ID. match node_id_opt { None => { - tcx.sess.bug(fmt!( - "cannot get field types from the enum type %s \ + tcx.sess.bug(format!( + "cannot get field types from the enum type {} \ without a node ID", ty.repr(tcx))); } @@ -1187,8 +1187,8 @@ pub fn with_field_tys(tcx: ty::ctxt, } _ => { - tcx.sess.bug(fmt!( - "cannot get field types from the type %s", + tcx.sess.bug(format!( + "cannot get field types from the type {}", ty.repr(tcx))); } } @@ -1733,14 +1733,14 @@ fn trans_imm_cast(bcx: @mut Block, expr: &ast::Expr, val_ty(lldiscrim_a), lldiscrim_a, true), cast_float => SIToFP(bcx, lldiscrim_a, ll_t_out), - _ => ccx.sess.bug(fmt!("translating unsupported cast: \ - %s (%?) -> %s (%?)", + _ => ccx.sess.bug(format!("translating unsupported cast: \ + {} ({:?}) -> {} ({:?})", t_in.repr(ccx.tcx), k_in, t_out.repr(ccx.tcx), k_out)) } } - _ => ccx.sess.bug(fmt!("translating unsupported cast: \ - %s (%?) -> %s (%?)", + _ => ccx.sess.bug(format!("translating unsupported cast: \ + {} ({:?}) -> {} ({:?})", t_in.repr(ccx.tcx), k_in, t_out.repr(ccx.tcx), k_out)) }; @@ -1757,7 +1757,7 @@ fn trans_assign_op(bcx: @mut Block, let _icx = push_ctxt("trans_assign_op"); let mut bcx = bcx; - debug!("trans_assign_op(expr=%s)", bcx.expr_to_str(expr)); + debug2!("trans_assign_op(expr={})", bcx.expr_to_str(expr)); // Evaluate LHS (destination), which should be an lvalue let dst_datum = unpack_datum!(bcx, trans_lvalue_unadjusted(bcx, dst)); diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index f28f5449e0046..6ca0967f8eea8 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -80,13 +80,13 @@ pub fn llvm_calling_convention(ccx: &mut CrateContext, match *abi { RustIntrinsic => { // Intrinsics are emitted by monomorphic fn - ccx.sess.bug(fmt!("Asked to register intrinsic fn")); + ccx.sess.bug(format!("Asked to register intrinsic fn")); } Rust => { // FIXME(#3678) Implement linking to foreign fns with Rust ABI ccx.sess.unimpl( - fmt!("Foreign functions with Rust ABI")); + format!("Foreign functions with Rust ABI")); } Stdcall => lib::llvm::X86StdcallCallConv, @@ -110,9 +110,9 @@ pub fn register_foreign_item_fn(ccx: @mut CrateContext, * Just adds a LLVM global. */ - debug!("register_foreign_item_fn(abis=%s, \ - path=%s, \ - foreign_item.id=%?)", + debug2!("register_foreign_item_fn(abis={}, \ + path={}, \ + foreign_item.id={:?})", abis.repr(ccx.tcx), path.repr(ccx.tcx), foreign_item.id); @@ -122,9 +122,9 @@ pub fn register_foreign_item_fn(ccx: @mut CrateContext, None => { // FIXME(#8357) We really ought to report a span here ccx.sess.fatal( - fmt!("ABI `%s` has no suitable ABI \ + format!("ABI `{}` has no suitable ABI \ for target architecture \ - in module %s", + in module {}", abis.user_string(ccx.tcx), ast_map::path_to_str(*path, ccx.sess.intr()))); @@ -165,9 +165,9 @@ pub fn trans_native_call(bcx: @mut Block, let ccx = bcx.ccx(); let tcx = bcx.tcx(); - debug!("trans_native_call(callee_ty=%s, \ - llfn=%s, \ - llretptr=%s)", + debug2!("trans_native_call(callee_ty={}, \ + llfn={}, \ + llretptr={})", callee_ty.repr(tcx), ccx.tn.val_to_str(llfn), ccx.tn.val_to_str(llretptr)); @@ -213,7 +213,7 @@ pub fn trans_native_call(bcx: @mut Block, // Does Rust pass this argument by pointer? let rust_indirect = type_of::arg_is_indirect(ccx, fn_sig.inputs[i]); - debug!("argument %u, llarg_rust=%s, rust_indirect=%b, arg_ty=%s", + debug2!("argument {}, llarg_rust={}, rust_indirect={}, arg_ty={}", i, ccx.tn.val_to_str(llarg_rust), rust_indirect, @@ -227,7 +227,7 @@ pub fn trans_native_call(bcx: @mut Block, llarg_rust = scratch; } - debug!("llarg_rust=%s (after indirection)", + debug2!("llarg_rust={} (after indirection)", ccx.tn.val_to_str(llarg_rust)); // Check whether we need to do any casting @@ -236,7 +236,7 @@ pub fn trans_native_call(bcx: @mut Block, llarg_rust = BitCast(bcx, llarg_rust, foreignarg_ty.ptr_to()); } - debug!("llarg_rust=%s (after casting)", + debug2!("llarg_rust={} (after casting)", ccx.tn.val_to_str(llarg_rust)); // Finally, load the value if needed for the foreign ABI @@ -247,7 +247,7 @@ pub fn trans_native_call(bcx: @mut Block, Load(bcx, llarg_rust) }; - debug!("argument %u, llarg_foreign=%s", + debug2!("argument {}, llarg_foreign={}", i, ccx.tn.val_to_str(llarg_foreign)); llargs_foreign.push(llarg_foreign); @@ -258,7 +258,7 @@ pub fn trans_native_call(bcx: @mut Block, None => { // FIXME(#8357) We really ought to report a span here ccx.sess.fatal( - fmt!("ABI string `%s` has no suitable ABI \ + format!("ABI string `{}` has no suitable ABI \ for target architecture", fn_abis.user_string(ccx.tcx))); } @@ -284,10 +284,10 @@ pub fn trans_native_call(bcx: @mut Block, let llrust_ret_ty = llsig.llret_ty; let llforeign_ret_ty = fn_type.ret_ty.ty; - debug!("llretptr=%s", ccx.tn.val_to_str(llretptr)); - debug!("llforeign_retval=%s", ccx.tn.val_to_str(llforeign_retval)); - debug!("llrust_ret_ty=%s", ccx.tn.type_to_str(llrust_ret_ty)); - debug!("llforeign_ret_ty=%s", ccx.tn.type_to_str(llforeign_ret_ty)); + debug2!("llretptr={}", ccx.tn.val_to_str(llretptr)); + debug2!("llforeign_retval={}", ccx.tn.val_to_str(llforeign_retval)); + debug2!("llrust_ret_ty={}", ccx.tn.type_to_str(llrust_ret_ty)); + debug2!("llforeign_ret_ty={}", ccx.tn.type_to_str(llforeign_ret_ty)); if llrust_ret_ty == llforeign_ret_ty { Store(bcx, llforeign_retval, llretptr); @@ -313,7 +313,7 @@ pub fn trans_native_call(bcx: @mut Block, let llforeign_align = machine::llalign_of_min(ccx, llforeign_ret_ty); let llrust_align = machine::llalign_of_min(ccx, llrust_ret_ty); let llalign = uint::min(llforeign_align, llrust_align); - debug!("llrust_size=%?", llrust_size); + debug2!("llrust_size={:?}", llrust_size); base::call_memcpy(bcx, llretptr_i8, llscratch_i8, C_uint(ccx, llrust_size), llalign as u32); } @@ -372,7 +372,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext, lib::llvm::CCallConv, llfn_ty); add_argument_attributes(&tys, llfn); - debug!("register_rust_fn_with_foreign_abi(node_id=%?, llfn_ty=%s, llfn=%s)", + debug2!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})", node_id, ccx.tn.type_to_str(llfn_ty), ccx.tn.val_to_str(llfn)); llfn } @@ -416,14 +416,14 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, f } _ => { - ccx.sess.bug(fmt!("build_rust_fn: extern fn %s has ty %s, \ + ccx.sess.bug(format!("build_rust_fn: extern fn {} has ty {}, \ expected a bare fn ty", path.repr(tcx), t.repr(tcx))); } }; - debug!("build_rust_fn: path=%s id=%? t=%s", + debug2!("build_rust_fn: path={} id={:?} t={}", path.repr(tcx), id, t.repr(tcx)); @@ -449,7 +449,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, "foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn"); let tcx = ccx.tcx; - debug!("build_wrap_fn(llrustfn=%s, llwrapfn=%s)", + debug2!("build_wrap_fn(llrustfn={}, llwrapfn={})", ccx.tn.val_to_str(llrustfn), ccx.tn.val_to_str(llwrapfn)); @@ -504,14 +504,14 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, // alloca some scratch space on the stack. match foreign_outptr { Some(llforeign_outptr) => { - debug!("out pointer, foreign=%s", + debug2!("out pointer, foreign={}", ccx.tn.val_to_str(llforeign_outptr)); let llrust_retptr = llvm::LLVMBuildBitCast(builder, llforeign_outptr, llrust_ret_ty.ptr_to().to_ref(), noname()); - debug!("out pointer, foreign=%s (casted)", + debug2!("out pointer, foreign={} (casted)", ccx.tn.val_to_str(llrust_retptr)); llrust_args.push(llrust_retptr); return_alloca = None; @@ -524,10 +524,10 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, llrust_ret_ty.to_ref(), s)) }; - debug!("out pointer, \ - allocad=%s, \ - llrust_ret_ty=%s, \ - return_ty=%s", + debug2!("out pointer, \ + allocad={}, \ + llrust_ret_ty={}, \ + return_ty={}", ccx.tn.val_to_str(slot), ccx.tn.type_to_str(llrust_ret_ty), tys.fn_sig.output.repr(tcx)); @@ -544,7 +544,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, // Push an (null) env pointer let env_pointer = base::null_env_ptr(ccx); - debug!("env pointer=%s", ccx.tn.val_to_str(env_pointer)); + debug2!("env pointer={}", ccx.tn.val_to_str(env_pointer)); llrust_args.push(env_pointer); // Build up the arguments to the call to the rust function. @@ -558,9 +558,9 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, let foreign_indirect = tys.fn_ty.attrs[foreign_index].is_some(); let mut llforeign_arg = llvm::LLVMGetParam(llwrapfn, foreign_index); - debug!("llforeign_arg #%u: %s", + debug2!("llforeign_arg \\#{}: {}", i, ccx.tn.val_to_str(llforeign_arg)); - debug!("rust_indirect = %b, foreign_indirect = %b", + debug2!("rust_indirect = {}, foreign_indirect = {}", rust_indirect, foreign_indirect); // Ensure that the foreign argument is indirect (by @@ -591,14 +591,14 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext, llvm::LLVMBuildLoad(builder, llforeign_arg, noname()) }; - debug!("llrust_arg #%u: %s", + debug2!("llrust_arg \\#{}: {}", i, ccx.tn.val_to_str(llrust_arg)); llrust_args.push(llrust_arg); } // Perform the call itself let llrust_ret_val = do llrust_args.as_imm_buf |ptr, len| { - debug!("calling llrustfn = %s", ccx.tn.val_to_str(llrustfn)); + debug2!("calling llrustfn = {}", ccx.tn.val_to_str(llrustfn)); llvm::LLVMBuildCall(builder, llrustfn, ptr, len as c_uint, noname()) }; @@ -723,11 +723,11 @@ fn foreign_types_for_fn_ty(ccx: &mut CrateContext, llsig.llarg_tys, llsig.llret_ty, ret_def); - debug!("foreign_types_for_fn_ty(\ - ty=%s, \ - llsig=%s -> %s, \ - fn_ty=%s -> %s, \ - ret_def=%b", + debug2!("foreign_types_for_fn_ty(\ + ty={}, \ + llsig={} -> {}, \ + fn_ty={} -> {}, \ + ret_def={}", ty.repr(ccx.tcx), ccx.tn.types_to_str(llsig.llarg_tys), ccx.tn.type_to_str(llsig.llret_ty), diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index cecea2703307b..d420514e84f7f 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -213,12 +213,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext, match ti.take_glue { Some(_) => (), None => { - debug!("+++ lazily_emit_tydesc_glue TAKE %s", + debug2!("+++ lazily_emit_tydesc_glue TAKE {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "take"); ti.take_glue = Some(glue_fn); make_generic_glue(ccx, ti.ty, glue_fn, make_take_glue, "take"); - debug!("--- lazily_emit_tydesc_glue TAKE %s", + debug2!("--- lazily_emit_tydesc_glue TAKE {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); } } @@ -226,12 +226,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext, match ti.drop_glue { Some(_) => (), None => { - debug!("+++ lazily_emit_tydesc_glue DROP %s", + debug2!("+++ lazily_emit_tydesc_glue DROP {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "drop"); ti.drop_glue = Some(glue_fn); make_generic_glue(ccx, ti.ty, glue_fn, make_drop_glue, "drop"); - debug!("--- lazily_emit_tydesc_glue DROP %s", + debug2!("--- lazily_emit_tydesc_glue DROP {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); } } @@ -239,12 +239,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext, match ti.free_glue { Some(_) => (), None => { - debug!("+++ lazily_emit_tydesc_glue FREE %s", + debug2!("+++ lazily_emit_tydesc_glue FREE {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "free"); ti.free_glue = Some(glue_fn); make_generic_glue(ccx, ti.ty, glue_fn, make_free_glue, "free"); - debug!("--- lazily_emit_tydesc_glue FREE %s", + debug2!("--- lazily_emit_tydesc_glue FREE {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); } } @@ -252,12 +252,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext, match ti.visit_glue { Some(_) => (), None => { - debug!("+++ lazily_emit_tydesc_glue VISIT %s", + debug2!("+++ lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "visit"); ti.visit_glue = Some(glue_fn); make_generic_glue(ccx, ti.ty, glue_fn, make_visit_glue, "visit"); - debug!("--- lazily_emit_tydesc_glue VISIT %s", + debug2!("--- lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_str(ccx.tcx, ti.ty)); } } @@ -658,7 +658,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info { let llalign = llalign_of(ccx, llty); let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc").to_managed(); note_unique_llvm_symbol(ccx, name); - debug!("+++ declare_tydesc %s %s", ppaux::ty_to_str(ccx.tcx, t), name); + debug2!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx, t), name); let gvar = do name.with_c_str |buf| { unsafe { llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type.to_ref(), buf) @@ -679,7 +679,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info { free_glue: None, visit_glue: None }; - debug!("--- declare_tydesc %s", ppaux::ty_to_str(ccx.tcx, t)); + debug2!("--- declare_tydesc {}", ppaux::ty_to_str(ccx.tcx, t)); return inf; } @@ -689,7 +689,7 @@ pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type, name: &str) -> ValueRef { let _icx = push_ctxt("declare_generic_glue"); let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name)).to_managed(); - debug!("%s is for type %s", fn_nm, ppaux::ty_to_str(ccx.tcx, t)); + debug2!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx, t)); note_unique_llvm_symbol(ccx, fn_nm); let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty); set_glue_inlining(llfn, t); @@ -730,7 +730,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext, name: &str) -> ValueRef { let _icx = push_ctxt("make_generic_glue"); - let glue_name = fmt!("glue %s %s", name, ty_to_short_str(ccx.tcx, t)); + let glue_name = format!("glue {} {}", name, ty_to_short_str(ccx.tcx, t)); let _s = StatRecorder::new(ccx, glue_name); make_generic_glue_inner(ccx, t, llfn, helper) } @@ -789,8 +789,7 @@ pub fn emit_tydescs(ccx: &mut CrateContext) { } }; - debug!("ti.borrow_offset: %s", - ccx.tn.val_to_str(ti.borrow_offset)); + debug2!("ti.borrow_offset: {}", ccx.tn.val_to_str(ti.borrow_offset)); let tydesc = C_named_struct(ccx.tydesc_type, [ti.size, // size diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs index 8900b50b49df2..de117a7c037e9 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -29,7 +29,7 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId) match ccx.external.find(&fn_id) { Some(&Some(node_id)) => { // Already inline - debug!("maybe_instantiate_inline(%s): already inline as node id %d", + debug2!("maybe_instantiate_inline({}): already inline as node id {}", ty::item_path_str(ccx.tcx, fn_id), node_id); return local_def(node_id); } @@ -132,7 +132,7 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId) _ => { let self_ty = ty::node_id_to_type(ccx.tcx, mth.self_id); - debug!("calling inline trans_fn with self_ty %s", + debug2!("calling inline trans_fn with self_ty {}", ty_to_str(ccx.tcx, self_ty)); match mth.explicit_self.node { ast::sty_value => impl_self(self_ty, ty::ByRef), diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index 7933e97a6029e..da71e99badba3 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -39,7 +39,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext, substs: @param_substs, attributes: &[ast::Attribute], ref_id: Option) { - debug!("trans_intrinsic(item.ident=%s)", ccx.sess.str_of(item.ident)); + debug2!("trans_intrinsic(item.ident={})", ccx.sess.str_of(item.ident)); fn simple_llvm_intrinsic(bcx: @mut Block, name: &'static str, num_args: uint) { assert!(num_args <= 4); @@ -299,13 +299,13 @@ pub fn trans_intrinsic(ccx: @mut CrateContext, if in_type_size != out_type_size { let sp = match ccx.tcx.items.get_copy(&ref_id.unwrap()) { ast_map::node_expr(e) => e.span, - _ => fail!("transmute has non-expr arg"), + _ => fail2!("transmute has non-expr arg"), }; let pluralize = |n| if 1u == n { "" } else { "s" }; ccx.sess.span_fatal(sp, - fmt!("transmute called on types with \ - different sizes: %s (%u bit%s) to \ - %s (%u bit%s)", + format!("transmute called on types with \ + different sizes: {} ({} bit{}) to \ + {} ({} bit{})", ty_to_str(ccx.tcx, in_type), in_type_size, pluralize(in_type_size), diff --git a/src/librustc/middle/trans/llrepr.rs b/src/librustc/middle/trans/llrepr.rs index 43fd6625766ef..ffb70abcec5fc 100644 --- a/src/librustc/middle/trans/llrepr.rs +++ b/src/librustc/middle/trans/llrepr.rs @@ -19,7 +19,7 @@ pub trait LlvmRepr { impl<'self, T:LlvmRepr> LlvmRepr for &'self [T] { fn llrepr(&self, ccx: &CrateContext) -> ~str { let reprs = self.map(|t| t.llrepr(ccx)); - fmt!("[%s]", reprs.connect(",")) + format!("[{}]", reprs.connect(",")) } } diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 19e2e1d00f646..03eb4f18784d5 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -55,7 +55,7 @@ pub fn trans_impl(ccx: @mut CrateContext, let _icx = push_ctxt("impl::trans_impl"); let tcx = ccx.tcx; - debug!("trans_impl(path=%s, name=%s, id=%?)", + debug2!("trans_impl(path={}, name={}, id={:?})", path.repr(tcx), name.repr(tcx), id); // Both here and below with generic methods, be sure to recurse and look for @@ -117,7 +117,7 @@ pub fn trans_method(ccx: @mut CrateContext, ty::subst_tps(ccx.tcx, *tys, *self_sub, self_ty) } }; - debug!("calling trans_fn with self_ty %s", + debug2!("calling trans_fn with self_ty {}", self_ty.repr(ccx.tcx)); match method.explicit_self.node { ast::sty_value => impl_self(self_ty, ty::ByRef), @@ -161,7 +161,7 @@ pub fn trans_method_callee(bcx: @mut Block, -> Callee { let _icx = push_ctxt("impl::trans_method_callee"); - debug!("trans_method_callee(callee_id=%?, this=%s, mentry=%s)", + debug2!("trans_method_callee(callee_id={:?}, this={}, mentry={})", callee_id, bcx.expr_to_str(this), mentry.repr(bcx.tcx())); @@ -199,7 +199,7 @@ pub fn trans_method_callee(bcx: @mut Block, trait_id, off, vtbl) } // how to get rid of this? - None => fail!("trans_method_callee: missing param_substs") + None => fail2!("trans_method_callee: missing param_substs") } } @@ -220,8 +220,8 @@ pub fn trans_static_method_callee(bcx: @mut Block, let _icx = push_ctxt("impl::trans_static_method_callee"); let ccx = bcx.ccx(); - debug!("trans_static_method_callee(method_id=%?, trait_id=%s, \ - callee_id=%?)", + debug2!("trans_static_method_callee(method_id={:?}, trait_id={}, \ + callee_id={:?})", method_id, ty::item_path_str(bcx.tcx(), trait_id), callee_id); @@ -250,17 +250,17 @@ pub fn trans_static_method_callee(bcx: @mut Block, ast_map::node_trait_method(trait_method, _, _) => { ast_util::trait_method_to_ty_method(trait_method).ident } - _ => fail!("callee is not a trait method") + _ => fail2!("callee is not a trait method") } } else { let path = csearch::get_item_path(bcx.tcx(), method_id); match path[path.len()-1] { path_pretty_name(s, _) | path_name(s) => { s } - path_mod(_) => { fail!("path doesn't have a name?") } + path_mod(_) => { fail2!("path doesn't have a name?") } } }; - debug!("trans_static_method_callee: method_id=%?, callee_id=%?, \ - name=%s", method_id, callee_id, ccx.sess.str_of(mname)); + debug2!("trans_static_method_callee: method_id={:?}, callee_id={:?}, \ + name={}", method_id, callee_id, ccx.sess.str_of(mname)); let vtbls = resolve_vtables_in_fn_ctxt( bcx.fcx, ccx.maps.vtable_map.get_copy(&callee_id)); @@ -287,7 +287,7 @@ pub fn trans_static_method_callee(bcx: @mut Block, FnData {llfn: PointerCast(bcx, lval, llty)} } _ => { - fail!("vtable_param left in monomorphized \ + fail2!("vtable_param left in monomorphized \ function's vtable substs"); } } @@ -362,7 +362,7 @@ pub fn trans_monomorphized_callee(bcx: @mut Block, } } typeck::vtable_param(*) => { - fail!("vtable_param left in monomorphized function's vtable substs"); + fail2!("vtable_param left in monomorphized function's vtable substs"); } }; @@ -395,13 +395,13 @@ pub fn combine_impl_and_methods_tps(bcx: @mut Block, let method = ty::method(ccx.tcx, mth_did); let n_m_tps = method.generics.type_param_defs.len(); let node_substs = node_id_type_params(bcx, callee_id); - debug!("rcvr_substs=%?", rcvr_substs.repr(ccx.tcx)); + debug2!("rcvr_substs={:?}", rcvr_substs.repr(ccx.tcx)); let ty_substs = vec::append(rcvr_substs.to_owned(), node_substs.tailn(node_substs.len() - n_m_tps)); - debug!("n_m_tps=%?", n_m_tps); - debug!("node_substs=%?", node_substs.repr(ccx.tcx)); - debug!("ty_substs=%?", ty_substs.repr(ccx.tcx)); + debug2!("n_m_tps={:?}", n_m_tps); + debug2!("node_substs={:?}", node_substs.repr(ccx.tcx)); + debug2!("ty_substs={:?}", ty_substs.repr(ccx.tcx)); // Now, do the same work for the vtables. The vtables might not @@ -474,13 +474,13 @@ pub fn trans_trait_callee_from_llval(bcx: @mut Block, let ccx = bcx.ccx(); // Load the data pointer from the object. - debug!("(translating trait callee) loading second index from pair"); + debug2!("(translating trait callee) loading second index from pair"); let llboxptr = GEPi(bcx, llpair, [0u, abi::trt_field_box]); let llbox = Load(bcx, llboxptr); let llself = PointerCast(bcx, llbox, Type::opaque_box(ccx).ptr_to()); // Load the function from the vtable and cast it to the expected type. - debug!("(translating trait callee) loading method"); + debug2!("(translating trait callee) loading method"); let llcallee_ty = type_of_fn_from_ty(ccx, callee_ty); let llvtable = Load(bcx, PointerCast(bcx, @@ -524,7 +524,7 @@ pub fn vtable_id(ccx: @mut CrateContext, } // can't this be checked at the callee? - _ => fail!("vtable_id") + _ => fail2!("vtable_id") } } @@ -578,7 +578,7 @@ pub fn make_vtable(ccx: &mut CrateContext, let tbl = C_struct(components); let sym = token::gensym("vtable"); - let vt_gvar = do fmt!("vtable%u", sym).with_c_str |buf| { + let vt_gvar = do format!("vtable{}", sym).with_c_str |buf| { llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl).to_ref(), buf) }; llvm::LLVMSetInitializer(vt_gvar, tbl); @@ -611,7 +611,7 @@ fn emit_vtable_methods(bcx: @mut Block, // the method type from the impl to substitute into. let m_id = method_with_name(ccx, impl_id, ident.name); let m = ty::method(tcx, m_id); - debug!("(making impl vtable) emitting method %s at subst %s", + debug2!("(making impl vtable) emitting method {} at subst {}", m.repr(tcx), substs.repr(tcx)); let fty = ty::subst_tps(tcx, @@ -619,7 +619,7 @@ fn emit_vtable_methods(bcx: @mut Block, None, ty::mk_bare_fn(tcx, m.fty.clone())); if m.generics.has_type_params() || ty::type_has_self(fty) { - debug!("(making impl vtable) method has self or type params: %s", + debug2!("(making impl vtable) method has self or type params: {}", tcx.sess.str_of(ident)); C_null(Type::nil().ptr_to()) } else { diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index 034320008cd14..79b3453037d10 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -36,12 +36,12 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, ref_id: Option) -> (ValueRef, bool) { - debug!("monomorphic_fn(\ - fn_id=%s, \ - real_substs=%s, \ - vtables=%s, \ - self_vtable=%s, \ - ref_id=%?)", + debug2!("monomorphic_fn(\ + fn_id={}, \ + real_substs={}, \ + vtables={}, \ + self_vtable={}, \ + ref_id={:?})", fn_id.repr(ccx.tcx), real_substs.repr(ccx.tcx), vtables.repr(ccx.tcx), @@ -68,17 +68,17 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, must_cast = true; } - debug!("monomorphic_fn(\ - fn_id=%s, \ - psubsts=%s, \ - hash_id=%?)", + debug2!("monomorphic_fn(\ + fn_id={}, \ + psubsts={}, \ + hash_id={:?})", fn_id.repr(ccx.tcx), psubsts.repr(ccx.tcx), hash_id); match ccx.monomorphized.find(&hash_id) { Some(&val) => { - debug!("leaving monomorphic fn %s", + debug2!("leaving monomorphic fn {}", ty::item_path_str(ccx.tcx, fn_id)); return (val, must_cast); } @@ -95,7 +95,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, let map_node = session::expect( ccx.sess, ccx.tcx.items.find_copy(&fn_id.node), - || fmt!("While monomorphizing %?, couldn't find it in the item map \ + || format!("While monomorphizing {:?}, couldn't find it in the item map \ (may have attempted to monomorphize an item \ defined in a different crate?)", fn_id)); // Get the path so that we can create a symbol @@ -140,7 +140,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, ast_map::node_struct_ctor(_, i, pt) => (pt, i.ident, i.span) }; - debug!("monomorphic_fn about to subst into %s", llitem_ty.repr(ccx.tcx)); + debug2!("monomorphic_fn about to subst into {}", llitem_ty.repr(ccx.tcx)); let mono_ty = match is_static_provided { None => ty::subst_tps(ccx.tcx, psubsts.tys, psubsts.self_ty, llitem_ty), @@ -164,7 +164,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, (psubsts.tys.slice(0, idx) + &[psubsts.self_ty.unwrap()] + psubsts.tys.tailn(idx)); - debug!("static default: changed substitution to %s", + debug2!("static default: changed substitution to {}", substs.repr(ccx.tcx)); ty::subst_tps(ccx.tcx, substs, None, llitem_ty) @@ -176,7 +176,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, assert!(f.abis.is_rust() || f.abis.is_intrinsic()); f } - _ => fail!("expected bare rust fn or an intrinsic") + _ => fail2!("expected bare rust fn or an intrinsic") }; ccx.stats.n_monos += 1; @@ -197,7 +197,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, let mut pt = (*pt).clone(); pt.push(elt); let s = mangle_exported_name(ccx, pt.clone(), mono_ty); - debug!("monomorphize_fn mangled to %s", s); + debug2!("monomorphize_fn mangled to {}", s); let mk_lldecl = || { let lldecl = decl_internal_rust_fn(ccx, f.sig.inputs, f.sig.output, s); @@ -285,12 +285,12 @@ pub fn monomorphic_fn(ccx: @mut CrateContext, ast_map::node_block(*) | ast_map::node_callee_scope(*) | ast_map::node_local(*) => { - ccx.tcx.sess.bug(fmt!("Can't monomorphize a %?", map_node)) + ccx.tcx.sess.bug(format!("Can't monomorphize a {:?}", map_node)) } }; ccx.monomorphizing.insert(fn_id, depth); - debug!("leaving monomorphic fn %s", ty::item_path_str(ccx.tcx, fn_id)); + debug2!("leaving monomorphic fn {}", ty::item_path_str(ccx.tcx, fn_id)); (lldecl, must_cast) } @@ -302,7 +302,7 @@ pub fn make_mono_id(ccx: @mut CrateContext, let substs_iter = substs.self_ty.iter().chain(substs.tys.iter()); let precise_param_ids: ~[(ty::t, Option<@~[mono_id]>)] = match substs.vtables { Some(vts) => { - debug!("make_mono_id vtables=%s substs=%s", + debug2!("make_mono_id vtables={} substs={}", vts.repr(ccx.tcx), substs.tys.repr(ccx.tcx)); let vts_iter = substs.self_vtables.iter().chain(vts.iter()); vts_iter.zip(substs_iter).map(|(vtable, subst)| { diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index 23b87c63d6a2c..b63533b1559d3 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -93,15 +93,15 @@ impl Reflector { let tcx = self.bcx.tcx(); let mth_idx = ty::method_idx( tcx.sess.ident_of(~"visit_" + ty_name), - *self.visitor_methods).expect(fmt!("Couldn't find visit method \ - for %s", ty_name)); + *self.visitor_methods).expect(format!("Couldn't find visit method \ + for {}", ty_name)); let mth_ty = ty::mk_bare_fn(tcx, self.visitor_methods[mth_idx].fty.clone()); let v = self.visitor_val; - debug!("passing %u args:", args.len()); + debug2!("passing {} args:", args.len()); let mut bcx = self.bcx; for (i, a) in args.iter().enumerate() { - debug!("arg %u: %s", i, bcx.val_to_str(*a)); + debug2!("arg {}: {}", i, bcx.val_to_str(*a)); } let bool_ty = ty::mk_bool(); let result = unpack_result!(bcx, callee::trans_call_inner( @@ -151,7 +151,7 @@ impl Reflector { pub fn visit_ty(&mut self, t: ty::t) { let bcx = self.bcx; let tcx = bcx.ccx().tcx; - debug!("reflect::visit_ty %s", ty_to_str(bcx.ccx().tcx, t)); + debug2!("reflect::visit_ty {}", ty_to_str(bcx.ccx().tcx, t)); match ty::get(t).sty { ty::ty_bot => self.leaf("bot"), diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 6a9b221726603..896ce4be33726 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -149,7 +149,7 @@ pub struct VecTypes { impl VecTypes { pub fn to_str(&self, ccx: &CrateContext) -> ~str { - fmt!("VecTypes {vec_ty=%s, unit_ty=%s, llunit_ty=%s, llunit_size=%s}", + format!("VecTypes \\{vec_ty={}, unit_ty={}, llunit_ty={}, llunit_size={}\\}", ty_to_str(ccx.tcx, self.vec_ty), ty_to_str(ccx.tcx, self.unit_ty), ccx.tn.type_to_str(self.llunit_ty), @@ -169,7 +169,7 @@ pub fn trans_fixed_vstore(bcx: @mut Block, // to store the array of the suitable size, so all we have to do is // generate the content. - debug!("trans_fixed_vstore(vstore_expr=%s, dest=%?)", + debug2!("trans_fixed_vstore(vstore_expr={}, dest={:?})", bcx.expr_to_str(vstore_expr), dest.to_str(bcx.ccx())); let _indenter = indenter(); @@ -199,7 +199,7 @@ pub fn trans_slice_vstore(bcx: @mut Block, let ccx = bcx.ccx(); - debug!("trans_slice_vstore(vstore_expr=%s, dest=%s)", + debug2!("trans_slice_vstore(vstore_expr={}, dest={})", bcx.expr_to_str(vstore_expr), dest.to_str(ccx)); let _indenter = indenter(); @@ -214,7 +214,7 @@ pub fn trans_slice_vstore(bcx: @mut Block, // Handle the &[...] case: let vt = vec_types_from_expr(bcx, vstore_expr); let count = elements_required(bcx, content_expr); - debug!("vt=%s, count=%?", vt.to_str(ccx), count); + debug2!("vt={}, count={:?}", vt.to_str(ccx), count); // Make a fixed-length backing array and allocate it on the stack. let llcount = C_uint(ccx, count); @@ -256,7 +256,7 @@ pub fn trans_lit_str(bcx: @mut Block, // different from trans_slice_vstore() above because it does need to copy // the content anywhere. - debug!("trans_lit_str(lit_expr=%s, dest=%s)", + debug2!("trans_lit_str(lit_expr={}, dest={})", bcx.expr_to_str(lit_expr), dest.to_str(bcx.ccx())); let _indenter = indenter(); @@ -287,7 +287,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a // @[...] or ~[...] (also @"..." or ~"...") allocate boxes in the // appropriate heap and write the array elements into them. - debug!("trans_uniq_or_managed_vstore(vstore_expr=%s, heap=%?)", + debug2!("trans_uniq_or_managed_vstore(vstore_expr={}, heap={:?})", bcx.expr_to_str(vstore_expr), heap); let _indenter = indenter(); @@ -318,7 +318,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a _ => {} } } - heap_exchange_closure => fail!("vectors use exchange_alloc"), + heap_exchange_closure => fail2!("vectors use exchange_alloc"), heap_managed | heap_managed_unique => {} } @@ -330,7 +330,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a add_clean_free(bcx, val, heap); let dataptr = get_dataptr(bcx, get_bodyptr(bcx, val, vt.vec_ty)); - debug!("alloc_vec() returned val=%s, dataptr=%s", + debug2!("alloc_vec() returned val={}, dataptr={}", bcx.val_to_str(val), bcx.val_to_str(dataptr)); let bcx = write_content(bcx, &vt, vstore_expr, @@ -350,7 +350,7 @@ pub fn write_content(bcx: @mut Block, let _icx = push_ctxt("tvec::write_content"); let mut bcx = bcx; - debug!("write_content(vt=%s, dest=%s, vstore_expr=%?)", + debug2!("write_content(vt={}, dest={}, vstore_expr={:?})", vt.to_str(bcx.ccx()), dest.to_str(bcx.ccx()), bcx.expr_to_str(vstore_expr)); @@ -383,7 +383,7 @@ pub fn write_content(bcx: @mut Block, let mut temp_cleanups = ~[]; for (i, element) in elements.iter().enumerate() { let lleltptr = GEPi(bcx, lldest, [i]); - debug!("writing index %? with lleltptr=%?", + debug2!("writing index {:?} with lleltptr={:?}", i, bcx.val_to_str(lleltptr)); bcx = expr::trans_into(bcx, *element, SaveIn(lleltptr)); diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index 0954302ba81f4..4a7351c207dc6 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -364,7 +364,7 @@ impl Type { Double => 64, X86_FP80 => 80, FP128 | PPC_FP128 => 128, - _ => fail!("llvm_float_width called on a non-float type") + _ => fail2!("llvm_float_width called on a non-float type") } } } diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index aab24f8365b11..72b7281148c3d 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -162,7 +162,7 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type { } ty::ty_self(_) | ty::ty_infer(*) | ty::ty_param(*) | ty::ty_err(*) => { - cx.tcx.sess.bug(fmt!("fictitious type %? in sizing_type_of()", ty::get(t).sty)) + cx.tcx.sess.bug(format!("fictitious type {:?} in sizing_type_of()", ty::get(t).sty)) } }; @@ -172,7 +172,7 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type { // NB: If you update this, be sure to update `sizing_type_of()` as well. pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type { - debug!("type_of %?: %?", t, ty::get(t)); + debug2!("type_of {:?}: {:?}", t, ty::get(t)); // Check the cache. match cx.lltypes.find(&t) { @@ -335,9 +335,9 @@ pub fn llvm_type_name(cx: &CrateContext, let tstr = ppaux::parameterized(cx.tcx, ty::item_path_str(cx.tcx, did), &ty::NonerasedRegions(opt_vec::Empty), tps); if did.crate == 0 { - fmt!("%s.%s", name, tstr) + format!("{}.{}", name, tstr) } else { - fmt!("%s.%s[#%d]", name, tstr, did.crate) + format!("{}.{}[\\#{}]", name, tstr, did.crate) } } diff --git a/src/librustc/middle/trans/write_guard.rs b/src/librustc/middle/trans/write_guard.rs index ad999e0c1aabc..f6c1741a9bd6e 100644 --- a/src/librustc/middle/trans/write_guard.rs +++ b/src/librustc/middle/trans/write_guard.rs @@ -39,7 +39,7 @@ pub fn root_and_write_guard(datum: &Datum, expr_id: ast::NodeId, derefs: uint) -> @mut Block { let key = root_map_key { id: expr_id, derefs: derefs }; - debug!("write_guard::root_and_write_guard(key=%?)", key); + debug2!("write_guard::root_and_write_guard(key={:?})", key); // root the autoderef'd value, if necessary: // @@ -66,7 +66,7 @@ pub fn return_to_mut(mut bcx: @mut Block, bits_val_ref: ValueRef, filename_val: ValueRef, line_val: ValueRef) -> @mut Block { - debug!("write_guard::return_to_mut(root_key=%?, %s, %s, %s)", + debug2!("write_guard::return_to_mut(root_key={:?}, {}, {}, {})", root_key, bcx.to_str(), bcx.val_to_str(frozen_val_ref), @@ -111,13 +111,13 @@ fn root(datum: &Datum, //! case, we will call this function, which will stash a copy //! away until we exit the scope `scope_id`. - debug!("write_guard::root(root_key=%?, root_info=%?, datum=%?)", + debug2!("write_guard::root(root_key={:?}, root_info={:?}, datum={:?})", root_key, root_info, datum.to_str(bcx.ccx())); if bcx.sess().trace() { trans_trace( bcx, None, - (fmt!("preserving until end of scope %d", + (format!("preserving until end of scope {}", root_info.scope)).to_managed()); } @@ -184,7 +184,7 @@ fn root(datum: &Datum, fn perform_write_guard(datum: &Datum, bcx: @mut Block, span: Span) -> @mut Block { - debug!("perform_write_guard"); + debug2!("perform_write_guard"); let llval = datum.to_value_llval(bcx); let (filename, line) = filename_and_line_num_from_span(bcx, span); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ed103f669157b..ef6809c15c895 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -794,7 +794,7 @@ impl Vid for TyVid { } impl ToStr for TyVid { - fn to_str(&self) -> ~str { fmt!("", self.to_uint()) } + fn to_str(&self) -> ~str { format!("", self.to_uint()) } } impl Vid for IntVid { @@ -802,7 +802,7 @@ impl Vid for IntVid { } impl ToStr for IntVid { - fn to_str(&self) -> ~str { fmt!("", self.to_uint()) } + fn to_str(&self) -> ~str { format!("", self.to_uint()) } } impl Vid for FloatVid { @@ -810,7 +810,7 @@ impl Vid for FloatVid { } impl ToStr for FloatVid { - fn to_str(&self) -> ~str { fmt!("", self.to_uint()) } + fn to_str(&self) -> ~str { format!("", self.to_uint()) } } impl Vid for RegionVid { @@ -818,7 +818,7 @@ impl Vid for RegionVid { } impl ToStr for RegionVid { - fn to_str(&self) -> ~str { fmt!("%?", self.id) } + fn to_str(&self) -> ~str { format!("{:?}", self.id) } } impl ToStr for FnSig { @@ -1515,7 +1515,7 @@ pub fn fold_regions( fldr: &fn(r: Region, in_fn: bool) -> Region) -> t { fn do_fold(cx: ctxt, ty: t, in_fn: bool, fldr: &fn(Region, bool) -> Region) -> t { - debug!("do_fold(ty=%s, in_fn=%b)", ty_to_str(cx, ty), in_fn); + debug2!("do_fold(ty={}, in_fn={})", ty_to_str(cx, ty), in_fn); if !type_has_regions(ty) { return ty; } fold_regions_and_ty( cx, ty, @@ -1656,7 +1656,7 @@ pub fn simd_type(cx: ctxt, ty: t) -> t { let fields = lookup_struct_fields(cx, did); lookup_field_type(cx, did, fields[0].id, substs) } - _ => fail!("simd_type called on invalid type") + _ => fail2!("simd_type called on invalid type") } } @@ -1666,14 +1666,14 @@ pub fn simd_size(cx: ctxt, ty: t) -> uint { let fields = lookup_struct_fields(cx, did); fields.len() } - _ => fail!("simd_size called on invalid type") + _ => fail2!("simd_size called on invalid type") } } pub fn get_element_type(ty: t, i: uint) -> t { match get(ty).sty { ty_tup(ref ts) => return ts[i], - _ => fail!("get_element_type called on invalid type") + _ => fail2!("get_element_type called on invalid type") } } @@ -1950,7 +1950,7 @@ impl ops::Sub for TypeContents { impl ToStr for TypeContents { fn to_str(&self) -> ~str { - fmt!("TypeContents(%s)", self.bits.to_str_radix(2)) + format!("TypeContents({})", self.bits.to_str_radix(2)) } } @@ -2324,7 +2324,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { let mut tc = TC_ALL; do each_inherited_builtin_bound(cx, bounds, traits) |bound| { - debug!("tc = %s, bound = %?", tc.to_str(), bound); + debug2!("tc = {}, bound = {:?}", tc.to_str(), bound); tc = tc - match bound { BoundStatic => TypeContents::nonstatic(cx), BoundSend => TypeContents::nonsendable(cx), @@ -2334,7 +2334,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { }; } - debug!("result = %s", tc.to_str()); + debug2!("result = {}", tc.to_str()); return tc; // Iterates over all builtin bounds on the type parameter def, including @@ -2364,7 +2364,7 @@ pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool { pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn type_requires(cx: ctxt, seen: &mut ~[DefId], r_ty: t, ty: t) -> bool { - debug!("type_requires(%s, %s)?", + debug2!("type_requires({}, {})?", ::util::ppaux::ty_to_str(cx, r_ty), ::util::ppaux::ty_to_str(cx, ty)); @@ -2373,7 +2373,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool { subtypes_require(cx, seen, r_ty, ty) }; - debug!("type_requires(%s, %s)? %b", + debug2!("type_requires({}, {})? {}", ::util::ppaux::ty_to_str(cx, r_ty), ::util::ppaux::ty_to_str(cx, ty), r); @@ -2382,7 +2382,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn subtypes_require(cx: ctxt, seen: &mut ~[DefId], r_ty: t, ty: t) -> bool { - debug!("subtypes_require(%s, %s)?", + debug2!("subtypes_require({}, {})?", ::util::ppaux::ty_to_str(cx, r_ty), ::util::ppaux::ty_to_str(cx, ty)); @@ -2456,7 +2456,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool { } }; - debug!("subtypes_require(%s, %s)? %b", + debug2!("subtypes_require({}, {})? {}", ::util::ppaux::ty_to_str(cx, r_ty), ::util::ppaux::ty_to_str(cx, ty), r); @@ -2473,7 +2473,7 @@ pub fn type_structurally_contains(cx: ctxt, test: &fn(x: &sty) -> bool) -> bool { let sty = &get(ty).sty; - debug!("type_structurally_contains: %s", + debug2!("type_structurally_contains: {}", ::util::ppaux::ty_to_str(cx, ty)); if test(sty) { return true; } match *sty { @@ -2786,18 +2786,18 @@ pub fn node_id_to_trait_ref(cx: ctxt, id: ast::NodeId) -> @ty::TraitRef { match cx.trait_refs.find(&id) { Some(&t) => t, None => cx.sess.bug( - fmt!("node_id_to_trait_ref: no trait ref for node `%s`", + format!("node_id_to_trait_ref: no trait ref for node `{}`", ast_map::node_id_to_str(cx.items, id, token::get_ident_interner()))) } } pub fn node_id_to_type(cx: ctxt, id: ast::NodeId) -> t { - //printfln!("%?/%?", id, cx.node_types.len()); + //printfln!("{:?}/{:?}", id, cx.node_types.len()); match cx.node_types.find(&(id as uint)) { Some(&t) => t, None => cx.sess.bug( - fmt!("node_id_to_type: no type for node `%s`", + format!("node_id_to_type: no type for node `{}`", ast_map::node_id_to_str(cx.items, id, token::get_ident_interner()))) } @@ -2820,7 +2820,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig { ty_bare_fn(ref f) => f.sig.clone(), ty_closure(ref f) => f.sig.clone(), ref s => { - fail!("ty_fn_sig() called on non-fn type: %?", s) + fail2!("ty_fn_sig() called on non-fn type: {:?}", s) } } } @@ -2831,7 +2831,7 @@ pub fn ty_fn_args(fty: t) -> ~[t] { ty_bare_fn(ref f) => f.sig.inputs.clone(), ty_closure(ref f) => f.sig.inputs.clone(), ref s => { - fail!("ty_fn_args() called on non-fn type: %?", s) + fail2!("ty_fn_args() called on non-fn type: {:?}", s) } } } @@ -2840,7 +2840,7 @@ pub fn ty_closure_sigil(fty: t) -> Sigil { match get(fty).sty { ty_closure(ref f) => f.sigil, ref s => { - fail!("ty_closure_sigil() called on non-closure type: %?", s) + fail2!("ty_closure_sigil() called on non-closure type: {:?}", s) } } } @@ -2850,7 +2850,7 @@ pub fn ty_fn_purity(fty: t) -> ast::purity { ty_bare_fn(ref f) => f.purity, ty_closure(ref f) => f.purity, ref s => { - fail!("ty_fn_purity() called on non-fn type: %?", s) + fail2!("ty_fn_purity() called on non-fn type: {:?}", s) } } } @@ -2860,7 +2860,7 @@ pub fn ty_fn_ret(fty: t) -> t { ty_bare_fn(ref f) => f.sig.output, ty_closure(ref f) => f.sig.output, ref s => { - fail!("ty_fn_ret() called on non-fn type: %?", s) + fail2!("ty_fn_ret() called on non-fn type: {:?}", s) } } } @@ -2877,7 +2877,7 @@ pub fn ty_vstore(ty: t) -> vstore { match get(ty).sty { ty_evec(_, vstore) => vstore, ty_estr(vstore) => vstore, - ref s => fail!("ty_vstore() called on invalid sty: %?", s) + ref s => fail2!("ty_vstore() called on invalid sty: {:?}", s) } } @@ -2891,7 +2891,7 @@ pub fn ty_region(tcx: ctxt, ref s => { tcx.sess.span_bug( span, - fmt!("ty_region() invoked on in appropriate ty: %?", s)); + format!("ty_region() invoked on in appropriate ty: {:?}", s)); } } } @@ -2902,7 +2902,7 @@ pub fn replace_fn_sig(cx: ctxt, fsty: &sty, new_sig: FnSig) -> t { ty_closure(ref f) => mk_closure(cx, ClosureTy {sig: new_sig, ..*f}), ref s => { cx.sess.bug( - fmt!("ty_fn_sig() called on non-fn type: %?", s)); + format!("ty_fn_sig() called on non-fn type: {:?}", s)); } } } @@ -2921,8 +2921,8 @@ pub fn replace_closure_return_type(tcx: ctxt, fn_type: t, ret_type: t) -> t { }) } _ => { - tcx.sess.bug(fmt!( - "replace_fn_ret() invoked with non-fn-type: %s", + tcx.sess.bug(format!( + "replace_fn_ret() invoked with non-fn-type: {}", ty_to_str(tcx, fn_type))); } } @@ -3003,7 +3003,7 @@ pub fn adjust_ty(cx: ctxt, } ref b => { cx.sess.bug( - fmt!("add_env adjustment on non-bare-fn: %?", b)); + format!("add_env adjustment on non-bare-fn: {:?}", b)); } } } @@ -3018,7 +3018,7 @@ pub fn adjust_ty(cx: ctxt, None => { cx.sess.span_bug( span, - fmt!("The %uth autoderef failed: %s", + format!("The {}th autoderef failed: {}", i, ty_to_str(cx, adjusted_ty))); } @@ -3075,7 +3075,7 @@ pub fn adjust_ty(cx: ctxt, ref s => { cx.sess.span_bug( span, - fmt!("borrow-vec associated with bad sty: %?", + format!("borrow-vec associated with bad sty: {:?}", s)); } } @@ -3094,7 +3094,7 @@ pub fn adjust_ty(cx: ctxt, ref s => { cx.sess.span_bug( span, - fmt!("borrow-fn associated with bad sty: %?", + format!("borrow-fn associated with bad sty: {:?}", s)); } } @@ -3110,7 +3110,7 @@ pub fn adjust_ty(cx: ctxt, ref s => { cx.sess.span_bug( span, - fmt!("borrow-trait-obj associated with bad sty: %?", + format!("borrow-trait-obj associated with bad sty: {:?}", s)); } } @@ -3185,8 +3185,8 @@ pub fn resolve_expr(tcx: ctxt, expr: &ast::Expr) -> ast::Def { match tcx.def_map.find(&expr.id) { Some(&def) => def, None => { - tcx.sess.span_bug(expr.span, fmt!( - "No def-map entry for expr %?", expr.id)); + tcx.sess.span_bug(expr.span, format!( + "No def-map entry for expr {:?}", expr.id)); } } } @@ -3244,8 +3244,8 @@ pub fn expr_kind(tcx: ctxt, ast::DefSelf(*) => LvalueExpr, def => { - tcx.sess.span_bug(expr.span, fmt!( - "Uncategorized def for expr %?: %?", + tcx.sess.span_bug(expr.span, format!( + "Uncategorized def for expr {:?}: {:?}", expr.id, def)); } } @@ -3311,7 +3311,7 @@ pub fn expr_kind(tcx: ctxt, RvalueStmtExpr } - ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), ast::ExprLogLevel | ast::ExprLit(_) | // Note: lit_str is carved out above @@ -3339,7 +3339,7 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId { ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => { return id; } - ast::StmtMac(*) => fail!("unexpanded macro in trans") + ast::StmtMac(*) => fail2!("unexpanded macro in trans") } } @@ -3353,8 +3353,8 @@ pub fn field_idx_strict(tcx: ty::ctxt, name: ast::Name, fields: &[field]) -> uint { let mut i = 0u; for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; } - tcx.sess.bug(fmt!( - "No field named `%s` found in the list of fields `%?`", + tcx.sess.bug(format!( + "No field named `{}` found in the list of fields `{:?}`", token::interner_get(name), fields.map(|f| tcx.sess.str_of(f.ident)))); } @@ -3418,7 +3418,7 @@ pub fn ty_sort_str(cx: ctxt, t: t) -> ~str { ::util::ppaux::ty_to_str(cx, t) } - ty_enum(id, _) => fmt!("enum %s", item_path_str(cx, id)), + ty_enum(id, _) => format!("enum {}", item_path_str(cx, id)), ty_box(_) => ~"@-ptr", ty_uniq(_) => ~"~-ptr", ty_evec(_, _) => ~"vector", @@ -3427,8 +3427,8 @@ pub fn ty_sort_str(cx: ctxt, t: t) -> ~str { ty_rptr(_, _) => ~"&-ptr", ty_bare_fn(_) => ~"extern fn", ty_closure(_) => ~"fn", - ty_trait(id, _, _, _, _) => fmt!("trait %s", item_path_str(cx, id)), - ty_struct(id, _) => fmt!("struct %s", item_path_str(cx, id)), + ty_trait(id, _, _, _, _) => format!("trait {}", item_path_str(cx, id)), + ty_struct(id, _) => format!("struct {}", item_path_str(cx, id)), ty_tup(_) => ~"tuple", ty_infer(TyVar(_)) => ~"inferred type", ty_infer(IntVar(_)) => ~"integral variable", @@ -3461,19 +3461,19 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { match *err { terr_mismatch => ~"types differ", terr_purity_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + format!("expected {} fn but found {} fn", values.expected.to_str(), values.found.to_str()) } terr_abi_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + format!("expected {} fn but found {} fn", values.expected.to_str(), values.found.to_str()) } terr_onceness_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + format!("expected {} fn but found {} fn", values.expected.to_str(), values.found.to_str()) } terr_sigil_mismatch(values) => { - fmt!("expected %s closure, found %s closure", + format!("expected {} closure, found {} closure", values.expected.to_str(), values.found.to_str()) } @@ -3483,97 +3483,97 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { terr_ptr_mutability => ~"pointers differ in mutability", terr_ref_mutability => ~"references differ in mutability", terr_ty_param_size(values) => { - fmt!("expected a type with %u type params \ - but found one with %u type params", + format!("expected a type with {} type params \ + but found one with {} type params", values.expected, values.found) } terr_tuple_size(values) => { - fmt!("expected a tuple with %u elements \ - but found one with %u elements", + format!("expected a tuple with {} elements \ + but found one with {} elements", values.expected, values.found) } terr_record_size(values) => { - fmt!("expected a record with %u fields \ - but found one with %u fields", + format!("expected a record with {} fields \ + but found one with {} fields", values.expected, values.found) } terr_record_mutability => { ~"record elements differ in mutability" } terr_record_fields(values) => { - fmt!("expected a record with field `%s` but found one with field \ - `%s`", + format!("expected a record with field `{}` but found one with field \ + `{}`", cx.sess.str_of(values.expected), cx.sess.str_of(values.found)) } terr_arg_count => ~"incorrect number of function parameters", terr_regions_does_not_outlive(*) => { - fmt!("lifetime mismatch") + format!("lifetime mismatch") } terr_regions_not_same(*) => { - fmt!("lifetimes are not the same") + format!("lifetimes are not the same") } terr_regions_no_overlap(*) => { - fmt!("lifetimes do not intersect") + format!("lifetimes do not intersect") } terr_regions_insufficiently_polymorphic(br, _) => { - fmt!("expected bound lifetime parameter %s, \ + format!("expected bound lifetime parameter {}, \ but found concrete lifetime", bound_region_ptr_to_str(cx, br)) } terr_regions_overly_polymorphic(br, _) => { - fmt!("expected concrete lifetime, \ - but found bound lifetime parameter %s", + format!("expected concrete lifetime, \ + but found bound lifetime parameter {}", bound_region_ptr_to_str(cx, br)) } terr_vstores_differ(k, ref values) => { - fmt!("%s storage differs: expected %s but found %s", + format!("{} storage differs: expected {} but found {}", terr_vstore_kind_to_str(k), vstore_to_str(cx, (*values).expected), vstore_to_str(cx, (*values).found)) } terr_trait_stores_differ(_, ref values) => { - fmt!("trait storage differs: expected %s but found %s", + format!("trait storage differs: expected {} but found {}", trait_store_to_str(cx, (*values).expected), trait_store_to_str(cx, (*values).found)) } terr_in_field(err, fname) => { - fmt!("in field `%s`, %s", cx.sess.str_of(fname), + format!("in field `{}`, {}", cx.sess.str_of(fname), type_err_to_str(cx, err)) } terr_sorts(values) => { - fmt!("expected %s but found %s", + format!("expected {} but found {}", ty_sort_str(cx, values.expected), ty_sort_str(cx, values.found)) } terr_traits(values) => { - fmt!("expected trait %s but found trait %s", + format!("expected trait {} but found trait {}", item_path_str(cx, values.expected), item_path_str(cx, values.found)) } terr_builtin_bounds(values) => { if values.expected.is_empty() { - fmt!("expected no bounds but found `%s`", + format!("expected no bounds but found `{}`", values.found.user_string(cx)) } else if values.found.is_empty() { - fmt!("expected bounds `%s` but found no bounds", + format!("expected bounds `{}` but found no bounds", values.expected.user_string(cx)) } else { - fmt!("expected bounds `%s` but found bounds `%s`", + format!("expected bounds `{}` but found bounds `{}`", values.expected.user_string(cx), values.found.user_string(cx)) } } terr_integer_as_char => { - fmt!("expected an integral type but found char") + format!("expected an integral type but found char") } terr_int_mismatch(ref values) => { - fmt!("expected %s but found %s", + format!("expected {} but found {}", values.expected.to_str(), values.found.to_str()) } terr_float_mismatch(ref values) => { - fmt!("expected %s but found %s", + format!("expected {} but found {}", values.expected.to_str(), values.found.to_str()) } @@ -3633,7 +3633,7 @@ pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> ~[@Method] { match ast_util::split_trait_methods(*ms) { (_, p) => p.map(|m| method(cx, ast_util::local_def(m.id))) }, - _ => cx.sess.bug(fmt!("provided_trait_methods: %? is not a trait", + _ => cx.sess.bug(format!("provided_trait_methods: {:?} is not a trait", id)) } } else { @@ -3690,7 +3690,7 @@ fn lookup_locally_or_in_crate_store( } if def_id.crate == ast::LOCAL_CRATE { - fail!("No def'n found for %? in tcx.%s", def_id, descr); + fail2!("No def'n found for {:?} in tcx.{}", def_id, descr); } let v = load_external(); map.insert(def_id, v.clone()); @@ -3733,7 +3733,7 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> { None => {} } let ret = if id.crate == ast::LOCAL_CRATE { - debug!("(impl_trait_ref) searching for trait impl %?", id); + debug2!("(impl_trait_ref) searching for trait impl {:?}", id); match cx.items.find(&id.node) { Some(&ast_map::node_item(@ast::item { node: ast::item_impl(_, ref opt_trait, _, _), @@ -3979,7 +3979,7 @@ pub fn item_path(cx: ctxt, id: ast::DefId) -> ast_map::path { } ref node => { - cx.sess.bug(fmt!("cannot find item_path for node %?", node)); + cx.sess.bug(format!("cannot find item_path for node {:?}", node)); } } } @@ -4031,7 +4031,7 @@ pub fn enum_variants(cx: ctxt, id: ast::DefId) -> @~[@VariantInfo] { cx.sess.span_err(e.span, "expected signed integer constant"); } Err(ref err) => { - cx.sess.span_err(e.span, fmt!("expected constant: %s", (*err))); + cx.sess.span_err(e.span, format!("expected constant: {}", (*err))); } }, None => {} @@ -4111,7 +4111,7 @@ pub fn has_attr(tcx: ctxt, did: DefId, attr: &str) -> bool { attrs: ref attrs, _ }, _)) => attr::contains_name(*attrs, attr), - _ => tcx.sess.bug(fmt!("has_attr: %? is not an item", + _ => tcx.sess.bug(format!("has_attr: {:?} is not an item", did)) } } else { @@ -4182,7 +4182,7 @@ pub fn lookup_struct_fields(cx: ctxt, did: ast::DefId) -> ~[field_ty] { } _ => { cx.sess.bug( - fmt!("struct ID not bound to an item: %s", + format!("struct ID not bound to an item: {}", ast_map::node_id_to_str(cx.items, did.node, token::get_ident_interner()))); } @@ -4486,7 +4486,7 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt, // Add the given trait ty to the hash map while i < trait_refs.len() { - debug!("each_bound_trait_and_supertraits(i=%?, trait_ref=%s)", + debug2!("each_bound_trait_and_supertraits(i={:?}, trait_ref={})", i, trait_refs[i].repr(tcx)); if !f(trait_refs[i]) { @@ -4496,7 +4496,7 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt, // Add supertraits to supertrait_set let supertrait_refs = trait_ref_supertraits(tcx, trait_refs[i]); for &supertrait_ref in supertrait_refs.iter() { - debug!("each_bound_trait_and_supertraits(supertrait_ref=%s)", + debug2!("each_bound_trait_and_supertraits(supertrait_ref={})", supertrait_ref.repr(tcx)); let d_id = supertrait_ref.def_id; diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 024010e40dfad..91bb4df301707 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -92,12 +92,12 @@ pub fn get_region_reporting_err( result::Err(ref e) => { let descr = match a_r { &None => ~"anonymous lifetime", - &Some(ref a) => fmt!("lifetime %s", + &Some(ref a) => format!("lifetime {}", lifetime_to_str(a, tcx.sess.intr())) }; tcx.sess.span_err( span, - fmt!("Illegal %s: %s", + format!("Illegal {}: {}", descr, e.msg)); e.replacement } @@ -157,7 +157,7 @@ fn ast_path_substs( (&None, &Some(_)) => { tcx.sess.span_err( path.span, - fmt!("no region bound is allowed on `%s`, \ + format!("no region bound is allowed on `{}`, \ which is not declared as containing region pointers", ty::item_path_str(tcx, def_id))); opt_vec::Empty @@ -182,7 +182,7 @@ fn ast_path_substs( if decl_generics.type_param_defs.len() != supplied_type_parameter_count { this.tcx().sess.span_fatal( path.span, - fmt!("wrong number of type arguments: expected %u but found %u", + format!("wrong number of type arguments: expected {} but found {}", decl_generics.type_param_defs.len(), supplied_type_parameter_count)); } @@ -428,7 +428,7 @@ pub fn ast_ty_to_ty( ast::ty_path(ref path, ref bounds, id) => { let a_def = match tcx.def_map.find(&id) { None => tcx.sess.span_fatal( - ast_ty.span, fmt!("unbound path %s", + ast_ty.span, format!("unbound path {}", path_to_str(path, tcx.sess.intr()))), Some(&d) => d }; @@ -446,8 +446,8 @@ pub fn ast_ty_to_ty( let path_str = path_to_str(path, tcx.sess.intr()); tcx.sess.span_err( ast_ty.span, - fmt!("reference to trait `%s` where a type is expected; \ - try `@%s`, `~%s`, or `&%s`", + format!("reference to trait `{}` where a type is expected; \ + try `@{}`, `~{}`, or `&{}`", path_str, path_str, path_str, path_str)); ty::mk_err() } @@ -498,7 +498,7 @@ pub fn ast_ty_to_ty( } _ => { tcx.sess.span_fatal(ast_ty.span, - fmt!("found value name used as a type: %?", a_def)); + format!("found value name used as a type: {:?}", a_def)); } } } @@ -521,8 +521,7 @@ pub fn ast_ty_to_ty( Err(ref r) => { tcx.sess.span_fatal( ast_ty.span, - fmt!("expected constant expr for vector length: %s", - *r)); + format!("expected constant expr for vector length: {}", *r)); } } } @@ -583,7 +582,7 @@ pub fn bound_lifetimes( if special_idents.iter().any(|&i| i == ast_lifetime.ident) { this.tcx().sess.span_err( ast_lifetime.span, - fmt!("illegal lifetime parameter name: `%s`", + format!("illegal lifetime parameter name: `{}`", lifetime_to_str(ast_lifetime, this.tcx().sess.intr()))); } else { bound_lifetime_names.push(ast_lifetime.ident); @@ -637,7 +636,7 @@ fn ty_of_method_or_bare_fn( opt_self_info: Option<&SelfInfo>, decl: &ast::fn_decl) -> (Option>, ty::BareFnTy) { - debug!("ty_of_bare_fn"); + debug2!("ty_of_bare_fn"); // new region names that appear inside of the fn decl are bound to // that function type @@ -718,7 +717,7 @@ pub fn ty_of_closure( // names or they are provided, but not both. assert!(lifetimes.is_empty() || expected_sig.is_none()); - debug!("ty_of_fn_decl"); + debug2!("ty_of_fn_decl"); let _i = indenter(); // resolve the function bound region in the original region @@ -807,7 +806,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, ast_bounds: &Option { diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 606b0255cd705..f022f2b3c4bce 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -166,7 +166,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path, fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), ~"a structure pattern", None); @@ -215,7 +215,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path, fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), ~"an enum or structure pattern", None); @@ -241,7 +241,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path, if arg_len > 0 { // N-ary variant. if arg_len != subpats_len { - let s = fmt!("this pattern has %u field%s, but the corresponding %s has %u field%s", + let s = format!("this pattern has {} field{}, but the corresponding {} has {} field{}", subpats_len, if subpats_len == 1u { ~"" } else { ~"s" }, kind_name, @@ -260,7 +260,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path, } } else if subpats_len > 0 { tcx.sess.span_err(pat.span, - fmt!("this pattern has %u field%s, but the corresponding %s has no \ + format!("this pattern has {} field{}, but the corresponding {} has no \ fields", subpats_len, if subpats_len == 1u { "" } else { "s" }, @@ -319,7 +319,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt, // up its type won't fail check_pat(pcx, field.pat, ty::mk_err()); tcx.sess.span_err(span, - fmt!("struct `%s` does not have a field named `%s`", + format!("struct `{}` does not have a field named `{}`", name, tcx.sess.str_of(field.ident))); } @@ -333,7 +333,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt, loop; } tcx.sess.span_err(span, - fmt!("pattern does not mention field `%s`", + format!("pattern does not mention field `{}`", token::interner_get(field.name))); } } @@ -358,7 +358,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: Span, Some(&ast::DefStruct(*)) | Some(&ast::DefVariant(*)) => { let name = pprust::path_to_str(path, tcx.sess.intr()); tcx.sess.span_err(span, - fmt!("mismatched types: expected `%s` but found `%s`", + format!("mismatched types: expected `{}` but found `{}`", fcx.infcx().ty_to_str(expected), name)); } @@ -396,8 +396,8 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt, Some(&ast::DefStruct(*)) | Some(&ast::DefVariant(*)) => { let name = pprust::path_to_str(path, tcx.sess.intr()); tcx.sess.span_err(span, - fmt!("mismatched types: expected `%s` but \ - found `%s`", + format!("mismatched types: expected `{}` but \ + found `{}`", fcx.infcx().ty_to_str(expected), name)); } @@ -428,8 +428,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) { fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(begin)); let e_ty = fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(end)); - debug!("pat_range beginning type: %?", b_ty); - debug!("pat_range ending type: %?", e_ty); + debug2!("pat_range beginning type: {:?}", b_ty); + debug2!("pat_range ending type: {:?}", e_ty); if !require_same_types( tcx, Some(fcx.infcx()), false, pat.span, b_ty, e_ty, || ~"mismatched types in range") @@ -488,7 +488,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) { } fcx.write_ty(pat.id, typ); - debug!("(checking match) writing type for pat id %d", pat.id); + debug2!("(checking match) writing type for pat id {}", pat.id); match sub { Some(p) => check_pat(pcx, p, expected), @@ -520,7 +520,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) { fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), ~"a structure pattern", None); @@ -567,7 +567,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) { // See [Note-Type-error-reporting] in middle/typeck/infer/mod.rs fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), ~"tuple", Some(&type_error)); fcx.write_error(pat.id); } @@ -617,7 +617,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) { pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), ~"a vector pattern", @@ -676,10 +676,10 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + format!("mismatched types: expected `{}` but found {}", e, actual)})}, Some(expected), - fmt!("%s pattern", match pointer_kind { + format!("{} pattern", match pointer_kind { Managed => "an @-box", Send => "a ~-box", Borrowed => "an &-pointer" diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 3cc93d3fea928..a4538c961fd6d 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -151,18 +151,18 @@ pub fn lookup( }; let self_ty = structurally_resolved_type(fcx, self_expr.span, self_ty); - debug!("method lookup(self_ty=%s, expr=%s, self_expr=%s)", + debug2!("method lookup(self_ty={}, expr={}, self_expr={})", self_ty.repr(fcx.tcx()), expr.repr(fcx.tcx()), self_expr.repr(fcx.tcx())); - debug!("searching inherent candidates"); + debug2!("searching inherent candidates"); lcx.push_inherent_candidates(self_ty); let mme = lcx.search(self_ty); if mme.is_some() { return mme; } - debug!("searching extension candidates"); + debug2!("searching extension candidates"); lcx.reset_candidates(); lcx.push_bound_candidates(self_ty); lcx.push_extension_candidates(); @@ -215,7 +215,7 @@ impl<'self> LookupContext<'self> { let mut self_ty = self_ty; let mut autoderefs = 0; loop { - debug!("loop: self_ty=%s autoderefs=%u", + debug2!("loop: self_ty={} autoderefs={}", self.ty_to_str(self_ty), autoderefs); match self.deref_args { @@ -397,7 +397,7 @@ impl<'self> LookupContext<'self> { fn push_inherent_candidates_from_object(&self, did: DefId, substs: &ty::substs) { - debug!("push_inherent_candidates_from_object(did=%s, substs=%s)", + debug2!("push_inherent_candidates_from_object(did={}, substs={})", self.did_to_str(did), substs_to_str(self.tcx(), substs)); let _indenter = indenter(); @@ -446,7 +446,7 @@ impl<'self> LookupContext<'self> { fn push_inherent_candidates_from_param(&self, rcvr_ty: ty::t, param_ty: param_ty) { - debug!("push_inherent_candidates_from_param(param_ty=%?)", + debug2!("push_inherent_candidates_from_param(param_ty={:?})", param_ty); let _indenter = indenter(); @@ -456,7 +456,7 @@ impl<'self> LookupContext<'self> { None => { tcx.sess.span_bug( self.expr.span, - fmt!("No param def for %?", param_ty)); + format!("No param def for {:?}", param_ty)); } }; @@ -523,11 +523,11 @@ impl<'self> LookupContext<'self> { let cand = mk_cand(bound_trait_ref, method, pos, this_bound_idx); - debug!("pushing inherent candidate for param: %?", cand); + debug2!("pushing inherent candidate for param: {:?}", cand); self.inherent_candidates.push(cand); } None => { - debug!("trait doesn't contain method: %?", + debug2!("trait doesn't contain method: {:?}", bound_trait_ref.def_id); // check next trait or bound } @@ -557,7 +557,7 @@ impl<'self> LookupContext<'self> { if !self.impl_dups.insert(impl_info.did) { return; // already visited } - debug!("push_candidates_from_impl: %s %s %s", + debug2!("push_candidates_from_impl: {} {} {}", token::interner_get(self.m_name), impl_info.ident.repr(self.tcx()), impl_info.methods.map(|m| m.ident).repr(self.tcx())); @@ -603,8 +603,8 @@ impl<'self> LookupContext<'self> { match self.search_for_method(self_ty) { None => None, Some(mme) => { - debug!("(searching for autoderef'd method) writing \ - adjustment (%u) to %d", + debug2!("(searching for autoderef'd method) writing \ + adjustment ({}) to {}", autoderefs, self.self_expr.id); self.fcx.write_adjustment(self.self_expr.id, @autoadjust); @@ -795,7 +795,7 @@ impl<'self> LookupContext<'self> { ty_opaque_closure_ptr(_) | ty_unboxed_vec(_) | ty_opaque_box | ty_type | ty_infer(TyVar(_)) => { - self.bug(fmt!("Unexpected type: %s", + self.bug(format!("Unexpected type: {}", self.ty_to_str(self_ty))); } } @@ -832,14 +832,14 @@ impl<'self> LookupContext<'self> { fn search_for_method(&self, rcvr_ty: ty::t) -> Option { - debug!("search_for_method(rcvr_ty=%s)", self.ty_to_str(rcvr_ty)); + debug2!("search_for_method(rcvr_ty={})", self.ty_to_str(rcvr_ty)); let _indenter = indenter(); // I am not sure that inherent methods should have higher // priority, but it is necessary ATM to handle some of the // existing code. - debug!("searching inherent candidates"); + debug2!("searching inherent candidates"); match self.consider_candidates(rcvr_ty, self.inherent_candidates) { None => {} Some(mme) => { @@ -847,7 +847,7 @@ impl<'self> LookupContext<'self> { } } - debug!("searching extension candidates"); + debug2!("searching extension candidates"); match self.consider_candidates(rcvr_ty, self.extension_candidates) { None => { return None; @@ -896,7 +896,7 @@ impl<'self> LookupContext<'self> { let mut j = i + 1; while j < candidates.len() { let candidate_b = &candidates[j]; - debug!("attempting to merge %? and %?", + debug2!("attempting to merge {:?} and {:?}", candidate_a, candidate_b); let candidates_same = match (&candidate_a.origin, &candidate_b.origin) { @@ -936,7 +936,7 @@ impl<'self> LookupContext<'self> { let tcx = self.tcx(); let fty = ty::mk_bare_fn(tcx, candidate.method_ty.fty.clone()); - debug!("confirm_candidate(expr=%s, candidate=%s, fty=%s)", + debug2!("confirm_candidate(expr={}, candidate={}, fty={})", self.expr.repr(tcx), self.cand_to_str(candidate), self.ty_to_str(fty)); @@ -992,11 +992,11 @@ impl<'self> LookupContext<'self> { }; // Compute the method type with type parameters substituted - debug!("fty=%s all_substs=%s", + debug2!("fty={} all_substs={}", self.ty_to_str(fty), ty::substs_to_str(tcx, &all_substs)); let fty = ty::subst(tcx, &all_substs, fty); - debug!("after subst, fty=%s", self.ty_to_str(fty)); + debug2!("after subst, fty={}", self.ty_to_str(fty)); // Replace any bound regions that appear in the function // signature with region variables @@ -1005,7 +1005,7 @@ impl<'self> LookupContext<'self> { ref s => { tcx.sess.span_bug( self.expr.span, - fmt!("Invoking method with non-bare-fn ty: %?", s)); + format!("Invoking method with non-bare-fn ty: {:?}", s)); } }; let (_, opt_transformed_self_ty, fn_sig) = @@ -1019,7 +1019,7 @@ impl<'self> LookupContext<'self> { purity: bare_fn_ty.purity, abis: bare_fn_ty.abis.clone(), }); - debug!("after replacing bound regions, fty=%s", self.ty_to_str(fty)); + debug2!("after replacing bound regions, fty={}", self.ty_to_str(fty)); let self_mode = get_mode_from_explicit_self(candidate.method_ty.explicit_self); @@ -1032,7 +1032,7 @@ impl<'self> LookupContext<'self> { rcvr_ty, transformed_self_ty) { result::Ok(_) => (), result::Err(_) => { - self.bug(fmt!("%s was a subtype of %s but now is not?", + self.bug(format!("{} was a subtype of {} but now is not?", self.ty_to_str(rcvr_ty), self.ty_to_str(transformed_self_ty))); } @@ -1106,7 +1106,7 @@ impl<'self> LookupContext<'self> { } _ => { self.bug( - fmt!("'impossible' transformed_self_ty: %s", + format!("'impossible' transformed_self_ty: {}", transformed_self_ty.repr(self.tcx()))); } } @@ -1189,12 +1189,12 @@ impl<'self> LookupContext<'self> { // `rcvr_ty` is the type of the expression. It may be a subtype of a // candidate method's `self_ty`. fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool { - debug!("is_relevant(rcvr_ty=%s, candidate=%s)", + debug2!("is_relevant(rcvr_ty={}, candidate={})", self.ty_to_str(rcvr_ty), self.cand_to_str(candidate)); return match candidate.method_ty.explicit_self { sty_static => { - debug!("(is relevant?) explicit self is static"); + debug2!("(is relevant?) explicit self is static"); false } @@ -1203,7 +1203,7 @@ impl<'self> LookupContext<'self> { } sty_region(_, m) => { - debug!("(is relevant?) explicit self is a region"); + debug2!("(is relevant?) explicit self is a region"); match ty::get(rcvr_ty).sty { ty::ty_rptr(_, mt) => { mutability_matches(mt.mutbl, m) && @@ -1220,7 +1220,7 @@ impl<'self> LookupContext<'self> { } sty_box(m) => { - debug!("(is relevant?) explicit self is a box"); + debug2!("(is relevant?) explicit self is a box"); match ty::get(rcvr_ty).sty { ty::ty_box(mt) => { mutability_matches(mt.mutbl, m) && @@ -1237,7 +1237,7 @@ impl<'self> LookupContext<'self> { } sty_uniq => { - debug!("(is relevant?) explicit self is a unique pointer"); + debug2!("(is relevant?) explicit self is a unique pointer"); match ty::get(rcvr_ty).sty { ty::ty_uniq(mt) => { rcvr_matches_ty(self.fcx, mt.ty, candidate) @@ -1303,14 +1303,14 @@ impl<'self> LookupContext<'self> { let span = if did.crate == ast::LOCAL_CRATE { match self.tcx().items.find(&did.node) { Some(&ast_map::node_method(m, _, _)) => m.span, - _ => fail!("report_static_candidate: bad item %?", did) + _ => fail2!("report_static_candidate: bad item {:?}", did) } } else { self.expr.span }; self.tcx().sess.span_note( span, - fmt!("candidate #%u is `%s`", + format!("candidate \\#{} is `{}`", (idx+1u), ty::item_path_str(self.tcx(), did))); } @@ -1318,7 +1318,7 @@ impl<'self> LookupContext<'self> { fn report_param_candidate(&self, idx: uint, did: DefId) { self.tcx().sess.span_note( self.expr.span, - fmt!("candidate #%u derives from the bound `%s`", + format!("candidate \\#{} derives from the bound `{}`", (idx+1u), ty::item_path_str(self.tcx(), did))); } @@ -1326,8 +1326,8 @@ impl<'self> LookupContext<'self> { fn report_trait_candidate(&self, idx: uint, did: DefId) { self.tcx().sess.span_note( self.expr.span, - fmt!("candidate #%u derives from the type of the receiver, \ - which is the trait `%s`", + format!("candidate \\#{} derives from the type of the receiver, \ + which is the trait `{}`", (idx+1u), ty::item_path_str(self.tcx(), did))); } @@ -1345,7 +1345,7 @@ impl<'self> LookupContext<'self> { } fn cand_to_str(&self, cand: &Candidate) -> ~str { - fmt!("Candidate(rcvr_ty=%s, rcvr_substs=%s, origin=%?)", + format!("Candidate(rcvr_ty={}, rcvr_substs={}, origin={:?})", cand.rcvr_match_condition.repr(self.tcx()), ty::substs_to_str(self.tcx(), &cand.rcvr_substs), cand.origin) @@ -1371,10 +1371,10 @@ impl Repr for RcvrMatchCondition { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { RcvrMatchesIfObject(d) => { - fmt!("RcvrMatchesIfObject(%s)", d.repr(tcx)) + format!("RcvrMatchesIfObject({})", d.repr(tcx)) } RcvrMatchesIfSubtype(t) => { - fmt!("RcvrMatchesIfSubtype(%s)", t.repr(tcx)) + format!("RcvrMatchesIfSubtype({})", t.repr(tcx)) } } } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index b689090d3fd3e..54de7fc1bab99 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -110,7 +110,6 @@ use util::ppaux::{bound_region_ptr_to_str}; use util::ppaux; -use std::cast::transmute; use std::hashmap::HashMap; use std::result; use std::util::replace; @@ -363,7 +362,7 @@ impl Visitor<()> for GatherLocalsVisitor { _ => Some(self.fcx.to_ty(&local.ty)) }; self.assign(local.id, o_ty); - debug!("Local variable %s is assigned type %s", + debug2!("Local variable {} is assigned type {}", self.fcx.pat_to_str(local.pat), self.fcx.infcx().ty_to_str( self.fcx.inh.locals.get_copy(&local.id))); @@ -376,7 +375,7 @@ impl Visitor<()> for GatherLocalsVisitor { ast::PatIdent(_, ref path, _) if pat_util::pat_is_binding(self.fcx.ccx.tcx.def_map, p) => { self.assign(p.id, None); - debug!("Pattern binding %s is assigned to %s", + debug2!("Pattern binding {} is assigned to {}", self.tcx.sess.str_of(path.segments[0].identifier), self.fcx.infcx().ty_to_str( self.fcx.inh.locals.get_copy(&p.id))); @@ -451,7 +450,7 @@ pub fn check_fn(ccx: @mut CrateCtxt, let arg_tys = fn_sig.inputs.map(|a| *a); let ret_ty = fn_sig.output; - debug!("check_fn(arg_tys=%?, ret_ty=%?, opt_self_ty=%?)", + debug2!("check_fn(arg_tys={:?}, ret_ty={:?}, opt_self_ty={:?})", arg_tys.map(|&a| ppaux::ty_to_str(tcx, a)), ppaux::ty_to_str(tcx, ret_ty), opt_self_info.map(|si| ppaux::ty_to_str(tcx, si.self_ty))); @@ -511,7 +510,7 @@ pub fn check_fn(ccx: @mut CrateCtxt, // Add the self parameter for self_info in opt_self_info.iter() { visit.assign(self_info.self_id, Some(self_info.self_ty)); - debug!("self is assigned to %s", + debug2!("self is assigned to {}", fcx.infcx().ty_to_str( fcx.inh.locals.get_copy(&self_info.self_id))); } @@ -565,7 +564,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt, let orig_sp = field_names.find(&id).map_move(|x| *x); match orig_sp { Some(orig_sp) => { - tcx.sess.span_err(sp, fmt!("Duplicate field name %s in record type declaration", + tcx.sess.span_err(sp, format!("Duplicate field name {} in record type declaration", tcx.sess.str_of(id))); tcx.sess.span_note(orig_sp, "First declaration of this field occurred here"); break; @@ -589,7 +588,7 @@ pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: Span) { } pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) { - debug!("check_item(it.id=%d, it.ident=%s)", + debug2!("check_item(it.id={}, it.ident={})", it.id, ty::item_path_str(ccx.tcx, local_def(it.id))); let _indenter = indenter(); @@ -607,7 +606,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) { } ast::item_impl(_, _, _, ref ms) => { let rp = ccx.tcx.region_paramd_items.find(&it.id).map_move(|x| *x); - debug!("item_impl %s with id %d rp %?", + debug2!("item_impl {} with id {} rp {:?}", ccx.tcx.sess.str_of(it.ident), it.id, rp); for m in ms.iter() { check_method(ccx, *m); @@ -645,7 +644,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) { if tpt.generics.has_type_params() { ccx.tcx.sess.span_err( item.span, - fmt!("foreign items may not have type parameters")); + format!("foreign items may not have type parameters")); } } } @@ -691,7 +690,7 @@ impl FnCtxt { } else { result::Err(RegionError { msg: { - fmt!("named region `%s` not in scope here", + format!("named region `{}` not in scope here", bound_region_ptr_to_str(self.tcx(), br)) }, replacement: { @@ -722,7 +721,7 @@ impl RegionScope for FnCtxt { impl FnCtxt { pub fn tag(&self) -> ~str { unsafe { - fmt!("%x", transmute(self)) + format!("{}", self as *FnCtxt) } } @@ -732,7 +731,7 @@ impl FnCtxt { None => { self.tcx().sess.span_bug( span, - fmt!("No type for local variable %?", nid)); + format!("No type for local variable {:?}", nid)); } } } @@ -743,14 +742,14 @@ impl FnCtxt { #[inline] pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) { - debug!("write_ty(%d, %s) in fcx %s", + debug2!("write_ty({}, {}) in fcx {}", node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag()); self.inh.node_types.insert(node_id, ty); } pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::substs) { if !ty::substs_is_noop(&substs) { - debug!("write_substs(%d, %s) in fcx %s", + debug2!("write_substs({}, {}) in fcx {}", node_id, ty::substs_to_str(self.tcx(), &substs), self.tag()); @@ -782,7 +781,7 @@ impl FnCtxt { pub fn write_adjustment(&self, node_id: ast::NodeId, adj: @ty::AutoAdjustment) { - debug!("write_adjustment(node_id=%?, adj=%?)", node_id, adj); + debug2!("write_adjustment(node_id={:?}, adj={:?})", node_id, adj); self.inh.adjustments.insert(node_id, adj); } @@ -808,7 +807,7 @@ impl FnCtxt { match self.inh.node_types.find(&ex.id) { Some(&t) => t, None => { - self.tcx().sess.bug(fmt!("no type for expr in fcx %s", + self.tcx().sess.bug(format!("no type for expr in fcx {}", self.tag())); } } @@ -819,7 +818,7 @@ impl FnCtxt { Some(&t) => t, None => { self.tcx().sess.bug( - fmt!("no type for node %d: %s in fcx %s", + format!("no type for node {}: {} in fcx {}", id, ast_map::node_id_to_str( self.tcx().items, id, token::get_ident_interner()), @@ -833,7 +832,7 @@ impl FnCtxt { Some(ts) => (*ts).clone(), None => { self.tcx().sess.bug( - fmt!("no type substs for node %d: %s in fcx %s", + format!("no type substs for node {}: {} in fcx {}", id, ast_map::node_id_to_str( self.tcx().items, id, token::get_ident_interner()), @@ -1212,7 +1211,7 @@ fn check_type_parameter_positions_in_path(function_context: @mut FnCtxt, function_context.tcx() .sess .span_err(path.span, - fmt!("this %s has a lifetime \ + format!("this {} has a lifetime \ parameter but no \ lifetime was specified", name)) @@ -1221,7 +1220,7 @@ fn check_type_parameter_positions_in_path(function_context: @mut FnCtxt, function_context.tcx() .sess .span_err(path.span, - fmt!("this %s has no lifetime \ + format!("this {} has no lifetime \ parameter but a lifetime \ was specified", name)) @@ -1249,10 +1248,10 @@ fn check_type_parameter_positions_in_path(function_context: @mut FnCtxt, function_context.tcx() .sess .span_err(path.span, - fmt!("the %s referenced by this \ - path has %u type \ - parameter%s, but %u type \ - parameter%s were supplied", + format!("the {} referenced by this \ + path has {} type \ + parameter{}, but {} type \ + parameter{} were supplied", name, trait_type_parameter_count, trait_count_suffix, @@ -1283,7 +1282,7 @@ fn check_type_parameter_positions_in_path(function_context: @mut FnCtxt, function_context.tcx() .sess .span_note(typ.span, - fmt!("this is a %?", def)); + format!("this is a {:?}", def)); } } } @@ -1303,7 +1302,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, expr: @ast::Expr, expected: Option, unifier: &fn()) { - debug!(">> typechecking"); + debug2!(">> typechecking"); fn check_method_argument_types( fcx: @mut FnCtxt, @@ -1329,7 +1328,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, _ => { fcx.tcx().sess.span_bug( sp, - fmt!("Method without bare fn type")); + format!("Method without bare fn type")); } } } @@ -1366,8 +1365,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ast::ForSugar => " (including the closure passed by \ the `for` keyword)" }; - let msg = fmt!("this function takes %u parameter%s but \ - %u parameter%s supplied%s", + let msg = format!("this function takes {} parameter{} but \ + {} parameter{} supplied{}", expected_arg_count, if expected_arg_count == 1 {""} else {"s"}, @@ -1381,7 +1380,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, vec::from_elem(supplied_arg_count, ty::mk_err()) }; - debug!("check_argument_types: formal_tys=%?", + debug2!("check_argument_types: formal_tys={:?}", formal_tys.map(|t| fcx.infcx().ty_to_str(*t))); // Check the arguments. @@ -1393,7 +1392,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let xs = [false, true]; for check_blocks in xs.iter() { let check_blocks = *check_blocks; - debug!("check_blocks=%b", check_blocks); + debug2!("check_blocks={}", check_blocks); // More awful hacks: before we check the blocks, try to do // an "opportunistic" vtable resolution of any trait @@ -1410,7 +1409,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, }; if is_block == check_blocks { - debug!("checking the argument"); + debug2!("checking the argument"); let mut formal_ty = formal_tys[i]; match deref_args { @@ -1459,8 +1458,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, match ty::get(output).sty { ty::ty_bool => {} _ => fcx.type_error_message(call_expr.span, |actual| { - fmt!("expected `for` closure to return `bool`, \ - but found `%s`", actual) }, + format!("expected `for` closure to return `bool`, \ + but found `{}`", actual) }, output, None) } ty::mk_nil() @@ -1508,8 +1507,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => sig, _ => { fcx.type_error_message(call_expr.span, |actual| { - fmt!("expected function but \ - found `%s`", actual) }, fn_ty, None); + format!("expected function but \ + found `{}`", actual) }, fn_ty, None); &error_fn_sig } }; @@ -1564,12 +1563,12 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, method_map.insert(expr.id, (*entry)); } None => { - debug!("(checking method call) failing expr is %d", expr.id); + debug2!("(checking method call) failing expr is {}", expr.id); fcx.type_error_message(expr.span, |actual| { - fmt!("type `%s` does not implement any method in scope \ - named `%s`", + format!("type `{}` does not implement any method in scope \ + named `{}`", actual, fcx.ccx.tcx.sess.str_of(method_name)) }, @@ -1721,8 +1720,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fcx.write_error(expr.id); fcx.write_error(rhs.id); fcx.type_error_message(expr.span, |actual| { - fmt!("binary operation %s cannot be applied \ - to type `%s`", + format!("binary operation {} cannot be applied \ + to type `{}`", ast_util::binop_to_str(op), actual)}, lhs_t, None) @@ -1742,8 +1741,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } else { fcx.type_error_message(expr.span, |actual| { - fmt!("binary operation %s cannot be \ - applied to type `%s`", + format!("binary operation {} cannot be \ + applied to type `{}`", ast_util::binop_to_str(op), actual) }, @@ -1771,8 +1770,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, Some(ref name) => { let if_op_unbound = || { fcx.type_error_message(ex.span, |actual| { - fmt!("binary operation %s cannot be applied \ - to type `%s`", + format!("binary operation {} cannot be applied \ + to type `{}`", ast_util::binop_to_str(op), actual)}, lhs_resolved_t, None) }; @@ -1815,7 +1814,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, DoDerefArgs, DontAutoderefReceiver, || { fcx.type_error_message(ex.span, |actual| { - fmt!("cannot apply unary operator `%s` to type `%s`", + format!("cannot apply unary operator `{}` to type `{}`", op_str, actual) }, rhs_t, None); }, expected_t) @@ -1918,7 +1917,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::mk_closure(tcx, fn_ty_copy) }; - debug!("check_expr_fn_with_unifier fty=%s", + debug2!("check_expr_fn_with_unifier fty={}", fcx.infcx().ty_to_str(fty)); fcx.write_ty(expr.id, fty); @@ -1952,7 +1951,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, // (1) verify that the class id actually has a field called // field - debug!("class named %s", ppaux::ty_to_str(tcx, base_t)); + debug2!("class named {}", ppaux::ty_to_str(tcx, base_t)); let cls_items = ty::lookup_struct_fields(tcx, base_id); match lookup_field_ty(tcx, base_id, cls_items, field, &(*substs)) { @@ -1983,7 +1982,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fcx.type_error_message( expr.span, |actual| { - fmt!("attempted to take value of method `%s` on type `%s` \ + format!("attempted to take value of method `{}` on type `{}` \ (try writing an anonymous function)", token::interner_get(field), actual) }, @@ -1994,7 +1993,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fcx.type_error_message( expr.span, |actual| { - fmt!("attempted access of field `%s` on type `%s`, \ + format!("attempted access of field `{}` on type `{}`, \ but no field with that name was found", token::interner_get(field), actual) }, @@ -2032,14 +2031,14 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, None => { tcx.sess.span_err( field.span, - fmt!("structure has no field named `%s`", + format!("structure has no field named `{}`", tcx.sess.str_of(field.ident))); error_happened = true; } Some((_, true)) => { tcx.sess.span_err( field.span, - fmt!("field `%s` specified more than once", + format!("field `{}` specified more than once", tcx.sess.str_of(field.ident))); error_happened = true; } @@ -2079,7 +2078,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } tcx.sess.span_err(span, - fmt!("missing field%s: %s", + format!("missing field{}: {}", if missing_fields.len() == 1 { "" } else { @@ -2419,7 +2418,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, _ => { fcx.type_error_message(expr.span, |actual| { - fmt!("type %s cannot be dereferenced", actual) + format!("type {} cannot be dereferenced", actual) }, oprnd_t, None); } } @@ -2567,7 +2566,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } ast::ExprForLoop(*) => - fail!("non-desugared expr_for_loop"), + fail2!("non-desugared expr_for_loop"), ast::ExprLoop(ref body, _) => { check_block_no_value(fcx, (body)); if !may_break(tcx, expr.id, body) { @@ -2593,8 +2592,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, _ => match expected { Some(expected_t) => { fcx.type_error_message(expr.span, |actual| { - fmt!("last argument in `do` call \ - has non-closure type: %s", + format!("last argument in `do` call \ + has non-closure type: {}", actual) }, expected_t, None); let err_ty = ty::mk_err(); @@ -2615,7 +2614,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b)); } // argh - _ => fail!("expected fn ty") + _ => fail2!("expected fn ty") } fcx.write_ty(expr.id, fcx.node_ty(b.id)); } @@ -2659,8 +2658,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let t_1 = fcx.to_ty(t); let t_e = fcx.expr_ty(e); - debug!("t_1=%s", fcx.infcx().ty_to_str(t_1)); - debug!("t_e=%s", fcx.infcx().ty_to_str(t_e)); + debug2!("t_1={}", fcx.infcx().ty_to_str(t_1)); + debug2!("t_e={}", fcx.infcx().ty_to_str(t_e)); if ty::type_is_error(t_e) { fcx.write_error(id); @@ -2676,12 +2675,12 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, _ => { if ty::type_is_nil(t_e) { fcx.type_error_message(expr.span, |actual| { - fmt!("cast from nil: `%s` as `%s`", actual, + format!("cast from nil: `{}` as `{}`", actual, fcx.infcx().ty_to_str(t_1)) }, t_e, None); } else if ty::type_is_nil(t_1) { fcx.type_error_message(expr.span, |actual| { - fmt!("cast to nil: `%s` as `%s`", actual, + format!("cast to nil: `{}` as `{}`", actual, fcx.infcx().ty_to_str(t_1)) }, t_e, None); } @@ -2698,7 +2697,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } else if t_1_is_char { if ty::get(te).sty != ty::ty_uint(ast::ty_u8) { fcx.type_error_message(expr.span, |actual| { - fmt!("only `u8` can be cast as `char`, not `%s`", actual) + format!("only `u8` can be cast as `char`, not `{}`", actual) }, t_e, None); } } else if ty::get(t1).sty == ty::ty_bool { @@ -2752,7 +2751,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, record the issue number in this comment. */ fcx.type_error_message(expr.span, |actual| { - fmt!("non-scalar cast: `%s` as `%s`", actual, + format!("non-scalar cast: `{}` as `{}`", actual, fcx.infcx().ty_to_str(t_1)) }, t_e, None); } @@ -2864,8 +2863,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, let error_message = || { fcx.type_error_message(expr.span, |actual| { - fmt!("cannot index a value \ - of type `%s`", + format!("cannot index a value \ + of type `{}`", actual) }, base_t, @@ -2889,9 +2888,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } - debug!("type of expr(%d) %s is...", expr.id, + debug2!("type of expr({}) {} is...", expr.id, syntax::print::pprust::expr_to_str(expr, tcx.sess.intr())); - debug!("... %s, expected is %s", + debug2!("... {}, expected is {}", ppaux::ty_to_str(tcx, fcx.expr_ty(expr)), match expected { Some(t) => ppaux::ty_to_str(tcx, t), @@ -2904,7 +2903,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, pub fn require_integral(fcx: @mut FnCtxt, sp: Span, t: ty::t) { if !type_is_integral(fcx, sp, t) { fcx.type_error_message(sp, |actual| { - fmt!("mismatched types: expected integral type but found `%s`", + format!("mismatched types: expected integral type but found `{}`", actual) }, t, None); } @@ -3110,9 +3109,9 @@ pub fn check_instantiable(tcx: ty::ctxt, item_id: ast::NodeId) { let item_ty = ty::node_id_to_type(tcx, item_id); if !ty::is_instantiable(tcx, item_ty) { - tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \ + tcx.sess.span_err(sp, format!("this type cannot be instantiated \ without an instance of itself; \ - consider using `Option<%s>`", + consider using `Option<{}>`", ppaux::ty_to_str(tcx, item_ty))); } } @@ -3171,7 +3170,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, match v.node.disr_expr { Some(e) => { - debug!("disr expr, checking %s", pprust::expr_to_str(e, ccx.tcx.sess.intr())); + debug2!("disr expr, checking {}", pprust::expr_to_str(e, ccx.tcx.sess.intr())); let fcx = blank_fn_ctxt(ccx, rty, e.id); let declty = ty::mk_int_var(ccx.tcx, fcx.infcx().next_int_var_id()); @@ -3187,7 +3186,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, ccx.tcx.sess.span_err(e.span, "expected signed integer constant"); } Err(ref err) => { - ccx.tcx.sess.span_err(e.span, fmt!("expected constant: %s", (*err))); + ccx.tcx.sess.span_err(e.span, format!("expected constant: {}", (*err))); } } }, @@ -3301,7 +3300,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, def: ast::Def, span: Span, node_id: ast::NodeId) { - debug!(">>> instantiate_path"); + debug2!(">>> instantiate_path"); let ty_param_count = tpt.generics.type_param_defs.len(); let mut ty_substs_len = 0; @@ -3309,7 +3308,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, ty_substs_len += segment.types.len() } - debug!("tpt=%s ty_param_count=%? ty_substs_len=%?", + debug2!("tpt={} ty_param_count={:?} ty_substs_len={:?}", tpt.repr(fcx.tcx()), ty_param_count, ty_substs_len); @@ -3364,13 +3363,13 @@ pub fn instantiate_path(fcx: @mut FnCtxt, } else if ty_substs_len > user_type_parameter_count { fcx.ccx.tcx.sess.span_err (span, - fmt!("too many type parameters provided: expected %u, found %u", + format!("too many type parameters provided: expected {}, found {}", user_type_parameter_count, ty_substs_len)); fcx.infcx().next_ty_vars(ty_param_count) } else if ty_substs_len < user_type_parameter_count { fcx.ccx.tcx.sess.span_err (span, - fmt!("not enough type parameters provided: expected %u, found %u", + format!("not enough type parameters provided: expected {}, found {}", user_type_parameter_count, ty_substs_len)); fcx.infcx().next_ty_vars(ty_param_count) } else { @@ -3408,7 +3407,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, }; fcx.write_ty_substs(node_id, tpt.ty, substs); - debug!("<<<"); + debug2!("<<<"); } // Resolves `typ` by a single level if `typ` is a type variable. If no @@ -3504,7 +3503,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt, span: Span, tps: &OptVec, ty: ty::t) { - debug!("check_bounds_are_used(n_tps=%u, ty=%s)", + debug2!("check_bounds_are_used(n_tps={}, ty={})", tps.len(), ppaux::ty_to_str(ccx.tcx, ty)); // make a vector of booleans initially false, set to true when used @@ -3517,7 +3516,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt, |t| { match ty::get(t).sty { ty::ty_param(param_ty {idx, _}) => { - debug!("Found use of ty param #%u", idx); + debug2!("Found use of ty param \\#{}", idx); tps_used[idx] = true; } _ => () @@ -3528,7 +3527,7 @@ pub fn check_bounds_are_used(ccx: @mut CrateCtxt, for (i, b) in tps_used.iter().enumerate() { if !*b { ccx.tcx.sess.span_err( - span, fmt!("type parameter `%s` is unused", + span, format!("type parameter `{}` is unused", ccx.tcx.sess.str_of(tps.get(i).ident))); } } @@ -3577,7 +3576,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { } op => { tcx.sess.span_err(it.span, - fmt!("unrecognized atomic operation function: `%s`", + format!("unrecognized atomic operation function: `{}`", op)); return; } @@ -3860,7 +3859,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { ref other => { tcx.sess.span_err(it.span, - fmt!("unrecognized intrinsic function: `%s`", + format!("unrecognized intrinsic function: `{}`", *other)); return; } @@ -3876,14 +3875,14 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { let i_ty = ty::lookup_item_type(ccx.tcx, local_def(it.id)); let i_n_tps = i_ty.generics.type_param_defs.len(); if i_n_tps != n_tps { - tcx.sess.span_err(it.span, fmt!("intrinsic has wrong number \ - of type parameters: found %u, \ - expected %u", i_n_tps, n_tps)); + tcx.sess.span_err(it.span, format!("intrinsic has wrong number \ + of type parameters: found {}, \ + expected {}", i_n_tps, n_tps)); } else { require_same_types( tcx, None, false, it.span, i_ty.ty, fty, - || fmt!("intrinsic has wrong type: \ - expected `%s`", + || format!("intrinsic has wrong type: \ + expected `{}`", ppaux::ty_to_str(ccx.tcx, fty))); } } diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 78c20b5484547..edc2947d89004 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -68,7 +68,7 @@ fn encl_region_of_def(fcx: @mut FnCtxt, def: ast::Def) -> ty::Region { } } _ => { - tcx.sess.bug(fmt!("unexpected def in encl_region_of_def: %?", + tcx.sess.bug(format!("unexpected def in encl_region_of_def: {:?}", def)) } } @@ -211,7 +211,7 @@ fn visit_local(rcx: &mut Rcx, l: @ast::Local) { fn constrain_bindings_in_pat(pat: @ast::Pat, rcx: &mut Rcx) { let tcx = rcx.fcx.tcx(); - debug!("regionck::visit_pat(pat=%s)", pat.repr(tcx)); + debug2!("regionck::visit_pat(pat={})", pat.repr(tcx)); do pat_util::pat_bindings(tcx.def_map, pat) |_, id, span, _| { // If we have a variable that contains region'd data, that // data will be accessible from anywhere that the variable is @@ -244,7 +244,7 @@ fn constrain_bindings_in_pat(pat: @ast::Pat, rcx: &mut Rcx) { } fn visit_expr(rcx: &mut Rcx, expr: @ast::Expr) { - debug!("regionck::visit_expr(e=%s, repeating_scope=%?)", + debug2!("regionck::visit_expr(e={}, repeating_scope={:?})", expr.repr(rcx.fcx.tcx()), rcx.repeating_scope); let has_method_map = rcx.fcx.inh.method_map.contains_key(&expr.id); @@ -302,7 +302,7 @@ fn visit_expr(rcx: &mut Rcx, expr: @ast::Expr) { { let r = rcx.fcx.inh.adjustments.find(&expr.id); for &adjustment in r.iter() { - debug!("adjustment=%?", adjustment); + debug2!("adjustment={:?}", adjustment); match *adjustment { @ty::AutoDerefRef( ty::AutoDerefRef {autoderefs: autoderefs, autoref: opt_autoref}) => @@ -515,7 +515,7 @@ fn constrain_callee(rcx: &mut Rcx, // // tcx.sess.span_bug( // callee_expr.span, - // fmt!("Calling non-function: %s", callee_ty.repr(tcx))); + // format!("Calling non-function: {}", callee_ty.repr(tcx))); } } } @@ -535,7 +535,7 @@ fn constrain_call(rcx: &mut Rcx, //! appear in the arguments appropriately. let tcx = rcx.fcx.tcx(); - debug!("constrain_call(call_expr=%s, implicitly_ref_args=%?)", + debug2!("constrain_call(call_expr={}, implicitly_ref_args={:?})", call_expr.repr(tcx), implicitly_ref_args); let callee_ty = rcx.resolve_node_type(callee_id); if ty::type_is_error(callee_ty) { @@ -597,7 +597,7 @@ fn constrain_derefs(rcx: &mut Rcx, let tcx = rcx.fcx.tcx(); let r_deref_expr = ty::re_scope(deref_expr.id); for i in range(0u, derefs) { - debug!("constrain_derefs(deref_expr=?, derefd_ty=%s, derefs=%?/%?", + debug2!("constrain_derefs(deref_expr=?, derefd_ty={}, derefs={:?}/{:?}", rcx.fcx.infcx().ty_to_str(derefd_ty), i, derefs); @@ -638,7 +638,7 @@ fn constrain_index(rcx: &mut Rcx, * includes the deref expr. */ - debug!("constrain_index(index_expr=?, indexed_ty=%s", + debug2!("constrain_index(index_expr=?, indexed_ty={}", rcx.fcx.infcx().ty_to_str(indexed_ty)); let r_index_expr = ty::re_scope(index_expr.id); @@ -662,13 +662,13 @@ fn constrain_free_variables(rcx: &mut Rcx, */ let tcx = rcx.fcx.ccx.tcx; - debug!("constrain_free_variables(%s, %s)", + debug2!("constrain_free_variables({}, {})", region.repr(tcx), expr.repr(tcx)); for freevar in get_freevars(tcx, expr.id).iter() { - debug!("freevar def is %?", freevar.def); + debug2!("freevar def is {:?}", freevar.def); let def = freevar.def; let en_region = encl_region_of_def(rcx.fcx, def); - debug!("en_region = %s", en_region.repr(tcx)); + debug2!("en_region = {}", en_region.repr(tcx)); rcx.fcx.mk_subr(true, infer::FreeVariable(freevar.span), region, en_region); } @@ -692,8 +692,8 @@ fn constrain_regions_in_type_of_node( let ty0 = rcx.resolve_node_type(id); let adjustment = rcx.fcx.inh.adjustments.find_copy(&id); let ty = ty::adjust_ty(tcx, origin.span(), ty0, adjustment); - debug!("constrain_regions_in_type_of_node(\ - ty=%s, ty0=%s, id=%d, minimum_lifetime=%?, adjustment=%?)", + debug2!("constrain_regions_in_type_of_node(\ + ty={}, ty0={}, id={}, minimum_lifetime={:?}, adjustment={:?})", ty_to_str(tcx, ty), ty_to_str(tcx, ty0), id, minimum_lifetime, adjustment); constrain_regions_in_type(rcx, minimum_lifetime, origin, ty) @@ -722,12 +722,12 @@ fn constrain_regions_in_type( let e = rcx.errors_reported; let tcx = rcx.fcx.ccx.tcx; - debug!("constrain_regions_in_type(minimum_lifetime=%s, ty=%s)", + debug2!("constrain_regions_in_type(minimum_lifetime={}, ty={})", region_to_str(tcx, "", false, minimum_lifetime), ty_to_str(tcx, ty)); do relate_nested_regions(tcx, Some(minimum_lifetime), ty) |r_sub, r_sup| { - debug!("relate(r_sub=%s, r_sup=%s)", + debug2!("relate(r_sub={}, r_sup={})", region_to_str(tcx, "", false, r_sub), region_to_str(tcx, "", false, r_sup)); @@ -813,7 +813,7 @@ pub mod guarantor { * to the lifetime of its guarantor (if any). */ - debug!("guarantor::for_addr_of(base=?)"); + debug2!("guarantor::for_addr_of(base=?)"); let guarantor = guarantor(rcx, base); link(rcx, expr.span, expr.id, guarantor); @@ -826,9 +826,9 @@ pub mod guarantor { * linked to the lifetime of its guarantor (if any). */ - debug!("regionck::for_match()"); + debug2!("regionck::for_match()"); let discr_guarantor = guarantor(rcx, discr); - debug!("discr_guarantor=%s", discr_guarantor.repr(rcx.tcx())); + debug2!("discr_guarantor={}", discr_guarantor.repr(rcx.tcx())); for arm in arms.iter() { for pat in arm.pats.iter() { link_ref_bindings_in_pat(rcx, *pat, discr_guarantor); @@ -847,10 +847,10 @@ pub mod guarantor { * region pointers. */ - debug!("guarantor::for_autoref(autoref=%?)", autoref); + debug2!("guarantor::for_autoref(autoref={:?})", autoref); let mut expr_ct = categorize_unadjusted(rcx, expr); - debug!(" unadjusted cat=%?", expr_ct.cat); + debug2!(" unadjusted cat={:?}", expr_ct.cat); expr_ct = apply_autoderefs( rcx, expr, autoderefs, expr_ct); @@ -898,10 +898,10 @@ pub mod guarantor { */ let tcx = rcx.tcx(); - debug!("guarantor::for_by_ref(expr=%s, callee_scope=%?)", + debug2!("guarantor::for_by_ref(expr={}, callee_scope={:?})", expr.repr(tcx), callee_scope); let expr_cat = categorize(rcx, expr); - debug!("guarantor::for_by_ref(expr=%?, callee_scope=%?) category=%?", + debug2!("guarantor::for_by_ref(expr={:?}, callee_scope={:?}) category={:?}", expr.id, callee_scope, expr_cat); let minimum_lifetime = ty::re_scope(callee_scope); for guarantor in expr_cat.guarantor.iter() { @@ -921,7 +921,7 @@ pub mod guarantor { * to the lifetime of its guarantor (if any). */ - debug!("link(id=%?, guarantor=%?)", id, guarantor); + debug2!("link(id={:?}, guarantor={:?})", id, guarantor); let bound = match guarantor { None => { @@ -939,7 +939,7 @@ pub mod guarantor { let rptr_ty = rcx.resolve_node_type(id); if !ty::type_is_bot(rptr_ty) { let tcx = rcx.fcx.ccx.tcx; - debug!("rptr_ty=%s", ty_to_str(tcx, rptr_ty)); + debug2!("rptr_ty={}", ty_to_str(tcx, rptr_ty)); let r = ty::ty_region(tcx, span, rptr_ty); rcx.fcx.mk_subr(true, infer::Reborrow(span), r, bound); } @@ -977,7 +977,7 @@ pub mod guarantor { * `&expr`). */ - debug!("guarantor()"); + debug2!("guarantor()"); match expr.node { ast::ExprUnary(_, ast::UnDeref, b) => { let cat = categorize(rcx, b); @@ -1035,15 +1035,15 @@ pub mod guarantor { rcx.fcx.tcx(), rcx.fcx.inh.method_map, expr)); None } - ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"), + ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"), } } fn categorize(rcx: &mut Rcx, expr: @ast::Expr) -> ExprCategorization { - debug!("categorize()"); + debug2!("categorize()"); let mut expr_ct = categorize_unadjusted(rcx, expr); - debug!("before adjustments, cat=%?", expr_ct.cat); + debug2!("before adjustments, cat={:?}", expr_ct.cat); match rcx.fcx.inh.adjustments.find(&expr.id) { Some(&@ty::AutoAddEnv(*)) => { @@ -1056,7 +1056,7 @@ pub mod guarantor { } Some(&@ty::AutoDerefRef(ref adjustment)) => { - debug!("adjustment=%?", adjustment); + debug2!("adjustment={:?}", adjustment); expr_ct = apply_autoderefs( rcx, expr, adjustment.autoderefs, expr_ct); @@ -1067,7 +1067,7 @@ pub mod guarantor { Some(ty::AutoUnsafe(_)) => { expr_ct.cat.guarantor = None; expr_ct.cat.pointer = OtherPointer; - debug!("autoref, cat=%?", expr_ct.cat); + debug2!("autoref, cat={:?}", expr_ct.cat); } Some(ty::AutoPtr(r, _)) | Some(ty::AutoBorrowVec(r, _)) | @@ -1078,7 +1078,7 @@ pub mod guarantor { // expression will be some sort of borrowed pointer. expr_ct.cat.guarantor = None; expr_ct.cat.pointer = BorrowedPointer(r); - debug!("autoref, cat=%?", expr_ct.cat); + debug2!("autoref, cat={:?}", expr_ct.cat); } } } @@ -1086,14 +1086,14 @@ pub mod guarantor { None => {} } - debug!("result=%?", expr_ct.cat); + debug2!("result={:?}", expr_ct.cat); return expr_ct.cat; } fn categorize_unadjusted(rcx: &mut Rcx, expr: @ast::Expr) -> ExprCategorizationType { - debug!("categorize_unadjusted()"); + debug2!("categorize_unadjusted()"); let guarantor = { if rcx.fcx.inh.method_map.contains_key(&expr.id) { @@ -1138,12 +1138,12 @@ pub mod guarantor { None => { tcx.sess.span_bug( expr.span, - fmt!("Autoderef but type not derefable: %s", + format!("Autoderef but type not derefable: {}", ty_to_str(tcx, ct.ty))); } } - debug!("autoderef, cat=%?", ct.cat); + debug2!("autoderef, cat={:?}", ct.cat); } return ct; } @@ -1205,7 +1205,7 @@ pub mod guarantor { * other pointers. */ - debug!("link_ref_bindings_in_pat(pat=%s, guarantor=%?)", + debug2!("link_ref_bindings_in_pat(pat={}, guarantor={:?})", rcx.fcx.pat_to_str(pat), guarantor); match pat.node { diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index cb4827104b627..1aae00edf5193 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -38,15 +38,15 @@ pub fn replace_bound_regions_in_fn_sig( for &t in opt_self_ty.iter() { all_tys.push(t) } - debug!("replace_bound_regions_in_fn_sig(self_ty=%?, fn_sig=%s, \ - all_tys=%?)", + debug2!("replace_bound_regions_in_fn_sig(self_ty={:?}, fn_sig={}, \ + all_tys={:?})", opt_self_ty.map(|t| ppaux::ty_to_str(tcx, *t)), ppaux::fn_sig_to_str(tcx, fn_sig), all_tys.map(|t| ppaux::ty_to_str(tcx, *t))); let _i = indenter(); let isr = do create_bound_region_mapping(tcx, isr, all_tys) |br| { - debug!("br=%?", br); + debug2!("br={:?}", br); mapf(br) }; let new_fn_sig = ty::fold_sig(fn_sig, |t| { @@ -54,9 +54,9 @@ pub fn replace_bound_regions_in_fn_sig( }); let new_self_ty = opt_self_ty.map(|t| replace_bound_regions(tcx, isr, *t)); - debug!("result of replace_bound_regions_in_fn_sig: \ - new_self_ty=%?, \ - fn_sig=%s", + debug2!("result of replace_bound_regions_in_fn_sig: \ + new_self_ty={:?}, \ + fn_sig={}", new_self_ty.map(|t| ppaux::ty_to_str(tcx, *t)), ppaux::fn_sig_to_str(tcx, &new_fn_sig)); @@ -146,8 +146,8 @@ pub fn replace_bound_regions_in_fn_sig( None if in_fn => r, None => { tcx.sess.bug( - fmt!("Bound region not found in \ - in_scope_regions list: %s", + format!("Bound region not found in \ + in_scope_regions list: {}", region_to_str(tcx, "", false, r))); } } @@ -255,7 +255,7 @@ pub fn relate_free_regions( * Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs` */ - debug!("relate_free_regions >>"); + debug2!("relate_free_regions >>"); let mut all_tys = ~[]; for arg in fn_sig.inputs.iter() { @@ -266,7 +266,7 @@ pub fn relate_free_regions( } for &t in all_tys.iter() { - debug!("relate_free_regions(t=%s)", ppaux::ty_to_str(tcx, t)); + debug2!("relate_free_regions(t={})", ppaux::ty_to_str(tcx, t)); relate_nested_regions(tcx, None, t, |a, b| { match (&a, &b) { (&ty::re_free(free_a), &ty::re_free(free_b)) => { @@ -277,5 +277,5 @@ pub fn relate_free_regions( }) } - debug!("<< relate_free_regions"); + debug2!("<< relate_free_regions"); } diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 0e1536357207d..146be8b85ad97 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -87,9 +87,9 @@ fn lookup_vtables(vcx: &VtableContext, type_param_defs: &[ty::TypeParameterDef], substs: &ty::substs, is_early: bool) -> vtable_res { - debug!("lookup_vtables(location_info=%?, \ - type_param_defs=%s, \ - substs=%s", + debug2!("lookup_vtables(location_info={:?}, \ + type_param_defs={}, \ + substs={}", location_info, type_param_defs.repr(vcx.tcx()), substs.repr(vcx.tcx())); @@ -108,11 +108,11 @@ fn lookup_vtables(vcx: &VtableContext, result.reverse(); assert_eq!(substs.tps.len(), result.len()); - debug!("lookup_vtables result(\ - location_info=%?, \ - type_param_defs=%s, \ - substs=%s, \ - result=%s)", + debug2!("lookup_vtables result(\ + location_info={:?}, \ + type_param_defs={}, \ + substs={}, \ + result={})", location_info, type_param_defs.repr(vcx.tcx()), substs.repr(vcx.tcx()), @@ -142,20 +142,20 @@ fn lookup_vtables_for_param(vcx: &VtableContext, // Substitute the values of the type parameters that may // appear in the bound. let trait_ref = substs.map_default(trait_ref, |substs| { - debug!("about to subst: %s, %s", + debug2!("about to subst: {}, {}", trait_ref.repr(tcx), substs.repr(tcx)); trait_ref.subst(tcx, *substs) }); - debug!("after subst: %s", trait_ref.repr(tcx)); + debug2!("after subst: {}", trait_ref.repr(tcx)); match lookup_vtable(vcx, location_info, ty, trait_ref, is_early) { Some(vtable) => param_result.push(vtable), None => { vcx.tcx().sess.span_fatal( location_info.span, - fmt!("failed to find an implementation of \ - trait %s for %s", + format!("failed to find an implementation of \ + trait {} for {}", vcx.infcx.trait_ref_to_str(trait_ref), vcx.infcx.ty_to_str(ty))); } @@ -163,11 +163,11 @@ fn lookup_vtables_for_param(vcx: &VtableContext, true }; - debug!("lookup_vtables_for_param result(\ - location_info=%?, \ - type_param_bounds=%s, \ - ty=%s, \ - result=%s)", + debug2!("lookup_vtables_for_param result(\ + location_info={:?}, \ + type_param_bounds={}, \ + ty={}, \ + result={})", location_info, type_param_bounds.repr(vcx.tcx()), ty.repr(vcx.tcx()), @@ -211,7 +211,7 @@ fn relate_trait_refs(vcx: &VtableContext, let tcx = vcx.tcx(); tcx.sess.span_err( location_info.span, - fmt!("expected %s, but found %s (%s)", + format!("expected {}, but found {} ({})", ppaux::trait_ref_to_str(tcx, &r_exp_trait_ref), ppaux::trait_ref_to_str(tcx, &r_act_trait_ref), ty::type_err_to_str(tcx, err))); @@ -228,7 +228,7 @@ fn lookup_vtable(vcx: &VtableContext, is_early: bool) -> Option { - debug!("lookup_vtable(ty=%s, trait_ref=%s)", + debug2!("lookup_vtable(ty={}, trait_ref={})", vcx.infcx.ty_to_str(ty), vcx.infcx.trait_ref_to_str(trait_ref)); let _i = indenter(); @@ -291,7 +291,7 @@ fn lookup_vtable_from_bounds(vcx: &VtableContext, let mut n_bound = 0; let mut ret = None; do ty::each_bound_trait_and_supertraits(tcx, bounds) |bound_trait_ref| { - debug!("checking bounds trait %s", + debug2!("checking bounds trait {}", bound_trait_ref.repr(vcx.tcx())); if bound_trait_ref.def_id == trait_ref.def_id { @@ -300,7 +300,7 @@ fn lookup_vtable_from_bounds(vcx: &VtableContext, bound_trait_ref, trait_ref); let vtable = vtable_param(param, n_bound); - debug!("found param vtable: %?", + debug2!("found param vtable: {:?}", vtable); ret = Some(vtable); false @@ -383,7 +383,7 @@ fn search_for_vtable(vcx: &VtableContext, // Now, in the previous example, for_ty is bound to // the type self_ty, and substs is bound to [T]. - debug!("The self ty is %s and its substs are %s", + debug2!("The self ty is {} and its substs are {}", vcx.infcx.ty_to_str(for_ty), vcx.infcx.tys_to_str(substs.tps)); @@ -397,8 +397,8 @@ fn search_for_vtable(vcx: &VtableContext, // some value of U) with some_trait. This would fail if T // and U weren't compatible. - debug!("(checking vtable) @2 relating trait \ - ty %s to of_trait_ref %s", + debug2!("(checking vtable) @2 relating trait \ + ty {} to of_trait_ref {}", vcx.infcx.trait_ref_to_str(trait_ref), vcx.infcx.trait_ref_to_str(of_trait_ref)); @@ -435,9 +435,9 @@ fn search_for_vtable(vcx: &VtableContext, } }; - debug!("The fixed-up substs are %s - \ + debug2!("The fixed-up substs are {} - \ they will be unified with the bounds for \ - the target ty, %s", + the target ty, {}", vcx.infcx.tys_to_str(substs_f.tps), vcx.infcx.trait_ref_to_str(trait_ref)); @@ -487,7 +487,7 @@ fn fixup_substs(vcx: &VtableContext, do fixup_ty(vcx, location_info, t, is_early).map |t_f| { match ty::get(*t_f).sty { ty::ty_trait(_, ref substs_f, _, _, _) => (*substs_f).clone(), - _ => fail!("t_f should be a trait") + _ => fail2!("t_f should be a trait") } } } @@ -502,8 +502,8 @@ fn fixup_ty(vcx: &VtableContext, Err(e) if !is_early => { tcx.sess.span_fatal( location_info.span, - fmt!("cannot determine a type \ - for this bounded type parameter: %s", + format!("cannot determine a type \ + for this bounded type parameter: {}", fixup_err_to_str(e))) } Err(_) => { @@ -533,7 +533,7 @@ fn connect_trait_tps(vcx: &VtableContext, fn insert_vtables(fcx: @mut FnCtxt, callee_id: ast::NodeId, vtables: vtable_res) { - debug!("insert_vtables(callee_id=%d, vtables=%?)", + debug2!("insert_vtables(callee_id={}, vtables={:?})", callee_id, vtables.repr(fcx.tcx())); fcx.inh.vtable_map.insert(callee_id, vtables); } @@ -554,7 +554,7 @@ pub fn location_info_for_item(item: @ast::item) -> LocationInfo { pub fn early_resolve_expr(ex: @ast::Expr, fcx: @mut FnCtxt, is_early: bool) { - debug!("vtable: early_resolve_expr() ex with id %? (early: %b): %s", + debug2!("vtable: early_resolve_expr() ex with id {:?} (early: {}): {}", ex.id, is_early, expr_to_str(ex, fcx.tcx().sess.intr())); let _indent = indenter(); @@ -562,15 +562,15 @@ pub fn early_resolve_expr(ex: @ast::Expr, match ex.node { ast::ExprPath(*) => { do fcx.opt_node_ty_substs(ex.id) |substs| { - debug!("vtable resolution on parameter bounds for expr %s", + debug2!("vtable resolution on parameter bounds for expr {}", ex.repr(fcx.tcx())); let def = cx.tcx.def_map.get_copy(&ex.id); let did = ast_util::def_id_of_def(def); let item_ty = ty::lookup_item_type(cx.tcx, did); - debug!("early resolve expr: def %? %?, %?, %s", ex.id, did, def, + debug2!("early resolve expr: def {:?} {:?}, {:?}, {}", ex.id, did, def, fcx.infcx().ty_to_str(item_ty.ty)); if has_trait_bounds(*item_ty.generics.type_param_defs) { - debug!("early_resolve_expr: looking up vtables for type params %s", + debug2!("early_resolve_expr: looking up vtables for type params {}", item_ty.generics.type_param_defs.repr(fcx.tcx())); let vcx = VtableContext { ccx: fcx.ccx, infcx: fcx.infcx() }; let vtbls = lookup_vtables(&vcx, &location_info_for_expr(ex), @@ -596,7 +596,7 @@ pub fn early_resolve_expr(ex: @ast::Expr, ast::ExprMethodCall(callee_id, _, _, _, _, _) => { match ty::method_call_type_param_defs(cx.tcx, fcx.inh.method_map, ex.id) { Some(type_param_defs) => { - debug!("vtable resolution on parameter bounds for method call %s", + debug2!("vtable resolution on parameter bounds for method call {}", ex.repr(fcx.tcx())); if has_trait_bounds(*type_param_defs) { let substs = fcx.node_ty_substs(callee_id); @@ -612,7 +612,7 @@ pub fn early_resolve_expr(ex: @ast::Expr, } } ast::ExprCast(src, _) => { - debug!("vtable resolution on expr %s", ex.repr(fcx.tcx())); + debug2!("vtable resolution on expr {}", ex.repr(fcx.tcx())); let target_ty = fcx.expr_ty(ex); match ty::get(target_ty).sty { // Bounds of type's contents are not checked here, but in kind.rs. @@ -635,7 +635,7 @@ pub fn early_resolve_expr(ex: @ast::Expr, (&ty::ty_rptr(_, mt), ty::RegionTraitStore(*)) if !mutability_allowed(mt.mutbl, target_mutbl) => { fcx.tcx().sess.span_err(ex.span, - fmt!("types differ in mutability")); + format!("types differ in mutability")); } (&ty::ty_box(mt), ty::BoxTraitStore) | @@ -691,24 +691,24 @@ pub fn early_resolve_expr(ex: @ast::Expr, (_, ty::UniqTraitStore) => { fcx.ccx.tcx.sess.span_err( ex.span, - fmt!("can only cast an ~-pointer \ - to a ~-object, not a %s", + format!("can only cast an ~-pointer \ + to a ~-object, not a {}", ty::ty_sort_str(fcx.tcx(), ty))); } (_, ty::BoxTraitStore) => { fcx.ccx.tcx.sess.span_err( ex.span, - fmt!("can only cast an @-pointer \ - to an @-object, not a %s", + format!("can only cast an @-pointer \ + to an @-object, not a {}", ty::ty_sort_str(fcx.tcx(), ty))); } (_, ty::RegionTraitStore(_)) => { fcx.ccx.tcx.sess.span_err( ex.span, - fmt!("can only cast an &-pointer \ - to an &-object, not a %s", + format!("can only cast an &-pointer \ + to an &-object, not a {}", ty::ty_sort_str(fcx.tcx(), ty))); } } @@ -753,7 +753,7 @@ pub fn resolve_impl(ccx: @mut CrateCtxt, impl_item: @ast::item) { trait_bounds: ~[trait_ref] }; let t = ty::node_id_to_type(ccx.tcx, impl_item.id); - debug!("=== Doing a self lookup now."); + debug2!("=== Doing a self lookup now."); // Right now, we don't have any place to store this. // We will need to make one so we can use this information // for compiling default methods that refer to supertraits. diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 5e9ca576a560a..4f281ce5f4570 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -41,8 +41,8 @@ fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: Span, typ: ty::t) if !fcx.ccx.tcx.sess.has_errors() { fcx.ccx.tcx.sess.span_err( sp, - fmt!("cannot determine a type \ - for this expression: %s", + format!("cannot determine a type \ + for this expression: {}", infer::fixup_err_to_str(e))) } return None; @@ -70,8 +70,8 @@ fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) { for t in r.iter() { let method_map = fcx.ccx.method_map; let new_entry = method_map_entry { self_ty: *t, ..*mme }; - debug!("writeback::resolve_method_map_entry(id=%?, \ - new_entry=%?)", + debug2!("writeback::resolve_method_map_entry(id={:?}, \ + new_entry={:?})", id, new_entry); method_map.insert(id, new_entry); } @@ -88,7 +88,7 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) { let r_origins = resolve_origins(fcx, sp, *origins); let vtable_map = fcx.ccx.vtable_map; vtable_map.insert(id, r_origins); - debug!("writeback::resolve_vtable_map_entry(id=%d, vtables=%?)", + debug2!("writeback::resolve_vtable_map_entry(id={}, vtables={:?})", id, r_origins.repr(fcx.tcx())); } } @@ -128,12 +128,12 @@ fn resolve_type_vars_for_node(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId) Err(e) => { // This should not, I think, happen: fcx.ccx.tcx.sess.span_err( - sp, fmt!("cannot resolve bound for closure: %s", + sp, format!("cannot resolve bound for closure: {}", infer::fixup_err_to_str(e))); } Ok(r1) => { let resolved_adj = @ty::AutoAddEnv(r1, s); - debug!("Adjustments for node %d: %?", id, resolved_adj); + debug2!("Adjustments for node {}: {:?}", id, resolved_adj); fcx.tcx().adjustments.insert(id, resolved_adj); } } @@ -146,7 +146,7 @@ fn resolve_type_vars_for_node(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId) Err(e) => { // This should not, I think, happen. fcx.ccx.tcx.sess.span_err( - sp, fmt!("cannot resolve scope of borrow: %s", + sp, format!("cannot resolve scope of borrow: {}", infer::fixup_err_to_str(e))); r } @@ -162,7 +162,7 @@ fn resolve_type_vars_for_node(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId) autoderefs: adj.autoderefs, autoref: resolved_autoref, }); - debug!("Adjustments for node %d: %?", id, resolved_adj); + debug2!("Adjustments for node {}: {:?}", id, resolved_adj); fcx.tcx().adjustments.insert(id, resolved_adj); } } @@ -176,7 +176,7 @@ fn resolve_type_vars_for_node(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId) } Some(t) => { - debug!("resolve_type_vars_for_node(id=%d, n_ty=%s, t=%s)", + debug2!("resolve_type_vars_for_node(id={}, n_ty={}, t={})", id, ppaux::ty_to_str(tcx, n_ty), ppaux::ty_to_str(tcx, t)); write_ty_to_tcx(tcx, id, t); let mut ret = Some(t); @@ -284,7 +284,7 @@ fn visit_pat(p: @ast::Pat, wbcx: &mut WbCtxt) { } resolve_type_vars_for_node(wbcx, p.span, p.id); - debug!("Type for pattern binding %s (id %d) resolved to %s", + debug2!("Type for pattern binding {} (id {}) resolved to {}", pat_to_str(p, wbcx.fcx.ccx.tcx.sess.intr()), p.id, wbcx.fcx.infcx().ty_to_str( ty::node_id_to_type(wbcx.fcx.ccx.tcx, @@ -297,7 +297,7 @@ fn visit_local(l: @ast::Local, wbcx: &mut WbCtxt) { let var_ty = wbcx.fcx.local_ty(l.span, l.id); match resolve_type(wbcx.fcx.infcx(), var_ty, resolve_all | force_all) { Ok(lty) => { - debug!("Type for local %s (id %d) resolved to %s", + debug2!("Type for local {} (id {}) resolved to {}", pat_to_str(l.pat, wbcx.fcx.tcx().sess.intr()), l.id, wbcx.fcx.infcx().ty_to_str(lty)); @@ -306,8 +306,8 @@ fn visit_local(l: @ast::Local, wbcx: &mut WbCtxt) { Err(e) => { wbcx.fcx.ccx.tcx.sess.span_err( l.span, - fmt!("cannot determine a type \ - for this local variable: %s", + format!("cannot determine a type \ + for this local variable: {}", infer::fixup_err_to_str(e))); wbcx.success = false; } diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 61d00dff58465..f6c24e3cd231a 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -76,7 +76,7 @@ pub fn get_base_type(inference_context: @mut InferCtxt, match get(resolved_type).sty { ty_enum(*) | ty_trait(*) | ty_struct(*) => { - debug!("(getting base type) found base type"); + debug2!("(getting base type) found base type"); Some(resolved_type) } @@ -85,7 +85,7 @@ pub fn get_base_type(inference_context: @mut InferCtxt, ty_infer(*) | ty_param(*) | ty_self(*) | ty_type | ty_opaque_box | ty_opaque_closure_ptr(*) | ty_unboxed_vec(*) | ty_err | ty_box(_) | ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => { - debug!("(getting base type) no base type; found %?", + debug2!("(getting base type) no base type; found {:?}", get(original_type).sty); None } @@ -135,7 +135,7 @@ pub fn get_base_type_def_id(inference_context: @mut InferCtxt, return Some(def_id); } _ => { - fail!("get_base_type() returned a type that wasn't an \ + fail2!("get_base_type() returned a type that wasn't an \ enum, struct, or trait"); } } @@ -160,7 +160,7 @@ struct CoherenceCheckVisitor { cc: CoherenceChecker } impl visit::Visitor<()> for CoherenceCheckVisitor { fn visit_item(&mut self, item:@item, _:()) { -// debug!("(checking coherence) item '%s'", +// debug2!("(checking coherence) item '{}'", // self.cc.crate_context.tcx.sess.str_of(item.ident)); match item.node { @@ -266,8 +266,8 @@ impl CoherenceChecker { // base type. if associated_traits.len() == 0 { - debug!("(checking implementation) no associated traits for item \ - '%s'", + debug2!("(checking implementation) no associated traits for item \ + '{}'", self.crate_context.tcx.sess.str_of(item.ident)); match get_base_type_def_id(self.inference_context, @@ -290,7 +290,7 @@ impl CoherenceChecker { for associated_trait in associated_traits.iter() { let trait_ref = ty::node_id_to_trait_ref( self.crate_context.tcx, associated_trait.ref_id); - debug!("(checking implementation) adding impl for trait '%s', item '%s'", + debug2!("(checking implementation) adding impl for trait '{}', item '{}'", trait_ref.repr(self.crate_context.tcx), self.crate_context.tcx.sess.str_of(item.ident)); @@ -325,7 +325,7 @@ impl CoherenceChecker { trait_ref: &ty::TraitRef, all_methods: &mut ~[@Method]) { let tcx = self.crate_context.tcx; - debug!("instantiate_default_methods(impl_id=%?, trait_ref=%s)", + debug2!("instantiate_default_methods(impl_id={:?}, trait_ref={})", impl_id, trait_ref.repr(tcx)); let impl_poly_type = ty::lookup_item_type(tcx, impl_id); @@ -336,7 +336,7 @@ impl CoherenceChecker { let new_id = tcx.sess.next_node_id(); let new_did = local_def(new_id); - debug!("new_did=%? trait_method=%s", new_did, trait_method.repr(tcx)); + debug2!("new_did={:?} trait_method={}", new_did, trait_method.repr(tcx)); // Create substitutions for the various trait parameters. let new_method_ty = @@ -348,7 +348,7 @@ impl CoherenceChecker { *trait_method, Some(trait_method.def_id)); - debug!("new_method_ty=%s", new_method_ty.repr(tcx)); + debug2!("new_method_ty={}", new_method_ty.repr(tcx)); all_methods.push(new_method_ty); // construct the polytype for the method based on the method_ty @@ -364,7 +364,7 @@ impl CoherenceChecker { generics: new_generics, ty: ty::mk_bare_fn(tcx, new_method_ty.fty.clone()) }; - debug!("new_polytype=%s", new_polytype.repr(tcx)); + debug2!("new_polytype={}", new_polytype.repr(tcx)); tcx.tcache.insert(new_did, new_polytype); tcx.methods.insert(new_did, new_method_ty); @@ -440,7 +440,7 @@ impl CoherenceChecker { let session = self.crate_context.tcx.sess; session.span_err( self.span_of_impl(implementation_b), - fmt!("conflicting implementations for trait `%s`", + format!("conflicting implementations for trait `{}`", ty::item_path_str(self.crate_context.tcx, trait_def_id))); session.span_note(self.span_of_impl(implementation_a), @@ -557,11 +557,11 @@ impl CoherenceChecker { let r = ty::trait_methods(tcx, trait_did); for method in r.iter() { - debug!("checking for %s", method.ident.repr(tcx)); + debug2!("checking for {}", method.ident.repr(tcx)); if provided_names.contains(&method.ident.name) { loop; } tcx.sess.span_err(trait_ref_span, - fmt!("missing method `%s`", + format!("missing method `{}`", tcx.sess.str_of(method.ident))); } } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 3f5e1ef521088..e5b01fea0617b 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -129,8 +129,8 @@ impl AstConv for CrateCtxt { ty_of_foreign_item(self, foreign_item, abis) } ref x => { - self.tcx.sess.bug(fmt!("unexpected sort of item \ - in get_item_ty(): %?", (*x))); + self.tcx.sess.bug(format!("unexpected sort of item \ + in get_item_ty(): {:?}", (*x))); } } } @@ -347,7 +347,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, let substd_type_param_defs = m.generics.type_param_defs.subst(tcx, &substs); new_type_param_defs.push_all(*substd_type_param_defs); - debug!("static method %s type_param_defs=%s ty=%s, substs=%s", + debug2!("static method {} type_param_defs={} ty={}, substs={}", m.def_id.repr(tcx), new_type_param_defs.repr(tcx), ty.repr(tcx), @@ -453,7 +453,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, trait_m: &ty::Method, trait_substs: &ty::substs, self_ty: ty::t) { - debug!("compare_impl_method()"); + debug2!("compare_impl_method()"); let infcx = infer::new_infer_ctxt(tcx); let impl_m = &cm.mty; @@ -470,7 +470,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, (&ast::sty_static, _) => { tcx.sess.span_err( cm.span, - fmt!("method `%s` has a `%s` declaration in the impl, \ + format!("method `{}` has a `{}` declaration in the impl, \ but not in the trait", tcx.sess.str_of(trait_m.ident), explicit_self_to_str(&impl_m.explicit_self, tcx.sess.intr()))); @@ -479,7 +479,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, (_, &ast::sty_static) => { tcx.sess.span_err( cm.span, - fmt!("method `%s` has a `%s` declaration in the trait, \ + format!("method `{}` has a `{}` declaration in the trait, \ but not in the impl", tcx.sess.str_of(trait_m.ident), explicit_self_to_str(&trait_m.explicit_self, tcx.sess.intr()))); @@ -495,8 +495,8 @@ pub fn compare_impl_method(tcx: ty::ctxt, if num_impl_m_type_params != num_trait_m_type_params { tcx.sess.span_err( cm.span, - fmt!("method `%s` has %u type %s, but its trait \ - declaration has %u type %s", + format!("method `{}` has {} type {}, but its trait \ + declaration has {} type {}", tcx.sess.str_of(trait_m.ident), num_impl_m_type_params, pluralize(num_impl_m_type_params, ~"parameter"), @@ -508,8 +508,8 @@ pub fn compare_impl_method(tcx: ty::ctxt, if impl_m.fty.sig.inputs.len() != trait_m.fty.sig.inputs.len() { tcx.sess.span_err( cm.span, - fmt!("method `%s` has %u parameter%s \ - but the trait has %u", + format!("method `{}` has {} parameter{} \ + but the trait has {}", tcx.sess.str_of(trait_m.ident), impl_m.fty.sig.inputs.len(), if impl_m.fty.sig.inputs.len() == 1 { "" } else { "s" }, @@ -529,8 +529,8 @@ pub fn compare_impl_method(tcx: ty::ctxt, if !extra_bounds.is_empty() { tcx.sess.span_err( cm.span, - fmt!("in method `%s`, \ - type parameter %u requires `%s`, \ + format!("in method `{}`, \ + type parameter {} requires `{}`, \ which is not required by \ the corresponding type parameter \ in the trait declaration", @@ -548,10 +548,10 @@ pub fn compare_impl_method(tcx: ty::ctxt, { tcx.sess.span_err( cm.span, - fmt!("in method `%s`, \ - type parameter %u has %u trait %s, but the \ + format!("in method `{}`, \ + type parameter {} has {} trait {}, but the \ corresponding type parameter in \ - the trait declaration has %u trait %s", + the trait declaration has {} trait {}", tcx.sess.str_of(trait_m.ident), i, impl_param_def.bounds.trait_bounds.len(), pluralize(impl_param_def.bounds.trait_bounds.len(), @@ -632,10 +632,10 @@ pub fn compare_impl_method(tcx: ty::ctxt, // that correspond to the parameters we will find on the impl // - replace self region with a fresh, dummy region let impl_fty = { - debug!("impl_fty (pre-subst): %s", ppaux::ty_to_str(tcx, impl_fty)); + debug2!("impl_fty (pre-subst): {}", ppaux::ty_to_str(tcx, impl_fty)); replace_bound_self(tcx, impl_fty, dummy_self_r) }; - debug!("impl_fty (post-subst): %s", ppaux::ty_to_str(tcx, impl_fty)); + debug2!("impl_fty (post-subst): {}", ppaux::ty_to_str(tcx, impl_fty)); let trait_fty = { let num_trait_m_type_params = trait_m.generics.type_param_defs.len(); let dummy_tps = do vec::from_fn(num_trait_m_type_params) |i| { @@ -649,11 +649,11 @@ pub fn compare_impl_method(tcx: ty::ctxt, self_ty: Some(self_ty), tps: vec::append(trait_tps, dummy_tps) }; - debug!("trait_fty (pre-subst): %s substs=%s", + debug2!("trait_fty (pre-subst): {} substs={}", trait_fty.repr(tcx), substs.repr(tcx)); ty::subst(tcx, &substs, trait_fty) }; - debug!("trait_fty (post-subst): %s", trait_fty.repr(tcx)); + debug2!("trait_fty (post-subst): {}", trait_fty.repr(tcx)); match infer::mk_subty(infcx, false, infer::MethodCompatCheck(cm.span), impl_fty, trait_fty) { @@ -661,7 +661,7 @@ pub fn compare_impl_method(tcx: ty::ctxt, result::Err(ref terr) => { tcx.sess.span_err( cm.span, - fmt!("method `%s` has an incompatible type: %s", + format!("method `{}` has an incompatible type: {}", tcx.sess.str_of(trait_m.ident), ty::type_err_to_str(tcx, terr))); ty::note_and_explain_type_err(tcx, terr); @@ -709,7 +709,7 @@ pub fn check_methods_against_trait(ccx: &CrateCtxt, // This method is not part of the trait tcx.sess.span_err( impl_m.span, - fmt!("method `%s` is not a member of trait `%s`", + format!("method `{}` is not a member of trait `{}`", tcx.sess.str_of(impl_m.mty.ident), path_to_str(&a_trait_ty.path, tcx.sess.intr()))); } @@ -835,7 +835,7 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, if ty_param.bounds.len() > 0 { ccx.tcx.sess.span_err( span, - fmt!("trait bounds are not allowed in %s definitions", + format!("trait bounds are not allowed in {} definitions", thing)); } } @@ -844,7 +844,7 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, pub fn convert(ccx: &CrateCtxt, it: &ast::item) { let tcx = ccx.tcx; let rp = tcx.region_paramd_items.find(&it.id).map_move(|x| *x); - debug!("convert: item %s with id %d rp %?", + debug2!("convert: item {} with id {} rp {:?}", tcx.sess.str_of(it.ident), it.id, rp); match it.node { // These don't define types. @@ -1000,8 +1000,8 @@ pub fn convert_foreign(ccx: &CrateCtxt, i: &ast::foreign_item) { let abis = match ccx.tcx.items.find(&i.id) { Some(&ast_map::node_foreign_item(_, abis, _, _)) => abis, ref x => { - ccx.tcx.sess.bug(fmt!("unexpected sort of item \ - in get_item_ty(): %?", (*x))); + ccx.tcx.sess.bug(format!("unexpected sort of item \ + in get_item_ty(): {:?}", (*x))); } }; @@ -1038,7 +1038,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt, _ => { ccx.tcx.sess.span_fatal( ast_trait_ref.path.span, - fmt!("%s is not a trait", + format!("{} is not a trait", path_to_str(&ast_trait_ref.path, ccx.tcx.sess.intr()))); } @@ -1051,7 +1051,7 @@ fn get_trait_def(ccx: &CrateCtxt, trait_id: ast::DefId) -> @ty::TraitDef { } else { match ccx.tcx.items.get(&trait_id.node) { &ast_map::node_item(item, _) => trait_def_of_item(ccx, item), - _ => ccx.tcx.sess.bug(fmt!("get_trait_def(%d): not an item", + _ => ccx.tcx.sess.bug(format!("get_trait_def({}): not an item", trait_id.node)) } } @@ -1083,7 +1083,7 @@ pub fn trait_def_of_item(ccx: &CrateCtxt, it: &ast::item) -> @ty::TraitDef { ref s => { tcx.sess.span_bug( it.span, - fmt!("trait_def_of_item invoked on %?", s)); + format!("trait_def_of_item invoked on {:?}", s)); } } } @@ -1120,7 +1120,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item) }, ty: ty::mk_bare_fn(ccx.tcx, tofd) }; - debug!("type of %s (id %d) is %s", + debug2!("type of {} (id {}) is {}", tcx.sess.str_of(it.ident), it.id, ppaux::ty_to_str(tcx, tpt.ty)); @@ -1161,7 +1161,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item) ast::item_trait(*) => { tcx.sess.span_bug( it.span, - fmt!("Invoked ty_of_item on trait")); + format!("Invoked ty_of_item on trait")); } ast::item_struct(_, ref generics) => { let (ty_generics, substs) = mk_item_substs(ccx, generics, rp, None); @@ -1174,8 +1174,8 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item) return tpt; } ast::item_impl(*) | ast::item_mod(_) | - ast::item_foreign_mod(_) => fail!(), - ast::item_mac(*) => fail!("item macros unimplemented") + ast::item_foreign_mod(_) => fail2!(), + ast::item_mac(*) => fail2!("item macros unimplemented") } } @@ -1222,7 +1222,7 @@ pub fn ty_generics(ccx: &CrateCtxt, def_id: local_def(param.id), bounds: bounds }; - debug!("def for param: %s", def.repr(ccx.tcx)); + debug2!("def for param: {}", def.repr(ccx.tcx)); ccx.tcx.ty_param_defs.insert(param.id, def); def } diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs index 99c7725c7a2da..8d1eaf34256bd 100644 --- a/src/librustc/middle/typeck/infer/coercion.rs +++ b/src/librustc/middle/typeck/infer/coercion.rs @@ -87,7 +87,7 @@ pub struct Coerce(CombineFields); impl Coerce { pub fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult { - debug!("Coerce.tys(%s => %s)", + debug2!("Coerce.tys({} => {})", a.inf_str(self.infcx), b.inf_str(self.infcx)); let _indent = indenter(); @@ -172,8 +172,8 @@ impl Coerce { Err(e) => { self.infcx.tcx.sess.span_bug( self.trace.origin.span(), - fmt!("Failed to resolve even without \ - any force options: %?", e)); + format!("Failed to resolve even without \ + any force options: {:?}", e)); } } } @@ -184,7 +184,7 @@ impl Coerce { b: ty::t, mt_b: ty::mt) -> CoerceResult { - debug!("coerce_borrowed_pointer(a=%s, sty_a=%?, b=%s, mt_b=%?)", + debug2!("coerce_borrowed_pointer(a={}, sty_a={:?}, b={}, mt_b={:?})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx), mt_b); @@ -221,7 +221,7 @@ impl Coerce { sty_a: &ty::sty, b: ty::t) -> CoerceResult { - debug!("coerce_borrowed_string(a=%s, sty_a=%?, b=%s)", + debug2!("coerce_borrowed_string(a={}, sty_a={:?}, b={})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx)); @@ -248,7 +248,7 @@ impl Coerce { b: ty::t, mt_b: ty::mt) -> CoerceResult { - debug!("coerce_borrowed_vector(a=%s, sty_a=%?, b=%s)", + debug2!("coerce_borrowed_vector(a={}, sty_a={:?}, b={})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx)); @@ -277,7 +277,7 @@ impl Coerce { b: ty::t, b_mutbl: ast::Mutability) -> CoerceResult { - debug!("coerce_borrowed_object(a=%s, sty_a=%?, b=%s)", + debug2!("coerce_borrowed_object(a={}, sty_a={:?}, b={})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx)); @@ -306,7 +306,7 @@ impl Coerce { sty_a: &ty::sty, b: ty::t) -> CoerceResult { - debug!("coerce_borrowed_fn(a=%s, sty_a=%?, b=%s)", + debug2!("coerce_borrowed_fn(a={}, sty_a={:?}, b={})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx)); @@ -361,7 +361,7 @@ impl Coerce { * "rust" fn`) into a closure. */ - debug!("coerce_from_bare_fn(a=%s, b=%s)", + debug2!("coerce_from_bare_fn(a={}, b={})", a.inf_str(self.infcx), b.inf_str(self.infcx)); if !fn_ty_a.abis.is_rust() { @@ -389,7 +389,7 @@ impl Coerce { b: ty::t, mt_b: ty::mt) -> CoerceResult { - debug!("coerce_unsafe_ptr(a=%s, sty_a=%?, b=%s)", + debug2!("coerce_unsafe_ptr(a={}, sty_a={:?}, b={})", a.inf_str(self.infcx), sty_a, b.inf_str(self.infcx)); diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index cdfb8732a38aa..3f6248eae1236 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -116,7 +116,7 @@ pub trait Combine { // substs and one of them has a self_ty and one // doesn't...? I could be wrong about this. self.infcx().tcx.sess.bug( - fmt!("substitution a had a self_ty \ + format!("substitution a had a self_ty \ and substitution b didn't, \ or vice versa")); } @@ -270,7 +270,7 @@ pub trait Combine { fn vstores(&self, vk: ty::terr_vstore_kind, a: ty::vstore, b: ty::vstore) -> cres { - debug!("%s.vstores(a=%?, b=%?)", self.tag(), a, b); + debug2!("{}.vstores(a={:?}, b={:?})", self.tag(), a, b); match (a, b) { (ty::vstore_slice(a_r), ty::vstore_slice(b_r)) => { @@ -295,7 +295,7 @@ pub trait Combine { b: ty::TraitStore) -> cres { - debug!("%s.trait_stores(a=%?, b=%?)", self.tag(), a, b); + debug2!("{}.trait_stores(a={:?}, b={:?})", self.tag(), a, b); match (a, b) { (ty::RegionTraitStore(a_r), ty::RegionTraitStore(b_r)) => { @@ -365,7 +365,7 @@ pub fn eq_tys(this: &C, a: ty::t, b: ty::t) -> ures { pub fn eq_regions(this: &C, a: ty::Region, b: ty::Region) -> ures { - debug!("eq_regions(%s, %s)", + debug2!("eq_regions({}, {})", a.inf_str(this.infcx()), b.inf_str(this.infcx())); let sub = this.sub(); @@ -406,8 +406,8 @@ pub fn eq_opt_regions( // consistently have a region parameter or not have a // region parameter. this.infcx().tcx.sess.bug( - fmt!("substitution a had opt_region %s and \ - b had opt_region %s", + format!("substitution a had opt_region {} and \ + b had opt_region {}", a.inf_str(this.infcx()), b.inf_str(this.infcx()))); } @@ -446,7 +446,7 @@ pub fn super_tys( (&ty::ty_infer(TyVar(_)), _) | (_, &ty::ty_infer(TyVar(_))) => { tcx.sess.bug( - fmt!("%s: bot and var types should have been handled (%s,%s)", + format!("{}: bot and var types should have been handled ({},{})", this.tag(), a.inf_str(this.infcx()), b.inf_str(this.infcx()))); diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 2c8e7b280598e..3f38850c8ffda 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -163,7 +163,7 @@ impl ErrorReporting for InferCtxt { self.tcx.sess.span_err( trace.origin.span(), - fmt!("%s: %s (%s)", + format!("{}: {} ({})", message_root_str, expected_found_str, ty::type_err_to_str(tcx, terr))); @@ -173,7 +173,7 @@ impl ErrorReporting for InferCtxt { fn values_str(@mut self, values: &ValuePairs) -> Option<~str> { /*! - * Returns a string of the form "expected `%s` but found `%s`", + * Returns a string of the form "expected `{}` but found `{}`", * or None if this is a derived error. */ match *values { @@ -201,7 +201,7 @@ impl ErrorReporting for InferCtxt { return None; } - Some(fmt!("expected `%s` but found `%s`", + Some(format!("expected `{}` but found `{}`", expected.user_string(self.tcx), found.user_string(self.tcx))) } @@ -284,7 +284,7 @@ impl ErrorReporting for InferCtxt { infer::IndexSlice(span) => { self.tcx.sess.span_err( span, - fmt!("index of slice outside its lifetime")); + format!("index of slice outside its lifetime")); note_and_explain_region( self.tcx, "the slice is only valid for ", @@ -375,7 +375,7 @@ impl ErrorReporting for InferCtxt { infer::ReferenceOutlivesReferent(ty, span) => { self.tcx.sess.span_err( span, - fmt!("in type `%s`, pointer has a longer lifetime than \ + format!("in type `{}`, pointer has a longer lifetime than \ the data it references", ty.user_string(self.tcx))); note_and_explain_region( @@ -400,7 +400,7 @@ impl ErrorReporting for InferCtxt { sup_region: Region) { self.tcx.sess.span_err( var_origin.span(), - fmt!("cannot infer an appropriate lifetime \ + format!("cannot infer an appropriate lifetime \ due to conflicting requirements")); note_and_explain_region( @@ -411,7 +411,7 @@ impl ErrorReporting for InferCtxt { self.tcx.sess.span_note( sup_origin.span(), - fmt!("...due to the following expression")); + format!("...due to the following expression")); note_and_explain_region( self.tcx, @@ -421,7 +421,7 @@ impl ErrorReporting for InferCtxt { self.tcx.sess.span_note( sub_origin.span(), - fmt!("...due to the following expression")); + format!("...due to the following expression")); } fn report_sup_sup_conflict(@mut self, @@ -432,7 +432,7 @@ impl ErrorReporting for InferCtxt { region2: Region) { self.tcx.sess.span_err( var_origin.span(), - fmt!("cannot infer an appropriate lifetime \ + format!("cannot infer an appropriate lifetime \ due to conflicting requirements")); note_and_explain_region( @@ -443,7 +443,7 @@ impl ErrorReporting for InferCtxt { self.tcx.sess.span_note( origin1.span(), - fmt!("...due to the following expression")); + format!("...due to the following expression")); note_and_explain_region( self.tcx, @@ -453,7 +453,7 @@ impl ErrorReporting for InferCtxt { self.tcx.sess.span_note( origin2.span(), - fmt!("...due to the following expression")); + format!("...due to the following expression")); } } diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index af62da5fde033..5e9eb51cbb64d 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -44,7 +44,7 @@ impl Combine for Glb { fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres { let tcx = self.infcx.tcx; - debug!("%s.mts(%s, %s)", + debug2!("{}.mts({}, {})", self.tag(), mt_to_str(tcx, a), mt_to_str(tcx, b)); @@ -100,7 +100,7 @@ impl Combine for Glb { } fn regions(&self, a: ty::Region, b: ty::Region) -> cres { - debug!("%s.regions(%?, %?)", + debug2!("{}.regions({:?}, {:?})", self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx)); @@ -121,7 +121,7 @@ impl Combine for Glb { // Note: this is a subtle algorithm. For a full explanation, // please see the large comment in `region_inference.rs`. - debug!("%s.fn_sigs(%?, %?)", + debug2!("{}.fn_sigs({:?}, {:?})", self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx)); let _indenter = indenter(); @@ -143,7 +143,7 @@ impl Combine for Glb { // Collect constraints. let sig0 = if_ok!(super_fn_sigs(self, &a_with_fresh, &b_with_fresh)); - debug!("sig0 = %s", sig0.inf_str(self.infcx)); + debug2!("sig0 = {}", sig0.inf_str(self.infcx)); // Generalize the regions appearing in fn_ty0 if possible let new_vars = @@ -155,7 +155,7 @@ impl Combine for Glb { |r, _in_fn| generalize_region(self, snapshot, new_vars, a_isr, a_vars, b_vars, r)); - debug!("sig1 = %s", sig1.inf_str(self.infcx)); + debug2!("sig1 = {}", sig1.inf_str(self.infcx)); return Ok(sig1); fn generalize_region(this: &Glb, @@ -237,7 +237,7 @@ impl Combine for Glb { Some(x) => x, None => this.infcx.tcx.sess.span_bug( this.trace.origin.span(), - fmt!("could not find original bound region for %?", r)) + format!("could not find original bound region for {:?}", r)) } } diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 4cbdf9fa1fb8b..919ad68a818fa 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -131,7 +131,7 @@ impl CombineFieldsLatticeMethods for CombineFields { let a_bounds = node_a.possible_types.clone(); let b_bounds = node_b.possible_types.clone(); - debug!("vars(%s=%s <: %s=%s)", + debug2!("vars({}={} <: {}={})", a_id.to_str(), a_bounds.inf_str(self.infcx), b_id.to_str(), b_bounds.inf_str(self.infcx)); @@ -179,7 +179,7 @@ impl CombineFieldsLatticeMethods for CombineFields { let a_bounds = &node_a.possible_types; let b_bounds = &Bounds { lb: None, ub: Some(b.clone()) }; - debug!("var_sub_t(%s=%s <: %s)", + debug2!("var_sub_t({}={} <: {})", a_id.to_str(), a_bounds.inf_str(self.infcx), b.inf_str(self.infcx)); @@ -203,7 +203,7 @@ impl CombineFieldsLatticeMethods for CombineFields { let b_id = node_b.root.clone(); let b_bounds = &node_b.possible_types; - debug!("t_sub_var(%s <: %s=%s)", + debug2!("t_sub_var({} <: {}={})", a.inf_str(self.infcx), b_id.to_str(), b_bounds.inf_str(self.infcx)); @@ -222,7 +222,7 @@ impl CombineFieldsLatticeMethods for CombineFields { * * Combines two bounds into a more general bound. */ - debug!("merge_bnd(%s,%s)", + debug2!("merge_bnd({},{})", a.inf_str(self.infcx), b.inf_str(self.infcx)); let _r = indenter(); @@ -273,7 +273,7 @@ impl CombineFieldsLatticeMethods for CombineFields { // A \ / A // B - debug!("merge(%s,%s,%s)", + debug2!("merge({},{},{})", v_id.to_str(), a.inf_str(self.infcx), b.inf_str(self.infcx)); @@ -290,7 +290,7 @@ impl CombineFieldsLatticeMethods for CombineFields { let ub = if_ok!(self.merge_bnd(&a.ub, &b.ub, LatticeValue::glb)); let lb = if_ok!(self.merge_bnd(&a.lb, &b.lb, LatticeValue::lub)); let bounds = Bounds { lb: lb, ub: ub }; - debug!("merge(%s): bounds=%s", + debug2!("merge({}): bounds={}", v_id.to_str(), bounds.inf_str(self.infcx)); @@ -305,7 +305,7 @@ impl CombineFieldsLatticeMethods for CombineFields { a: &Bound, b: &Bound) -> ures { - debug!("bnds(%s <: %s)", a.inf_str(self.infcx), + debug2!("bnds({} <: {})", a.inf_str(self.infcx), b.inf_str(self.infcx)); let _r = indenter(); @@ -370,7 +370,7 @@ pub fn super_lattice_tys( this: &L, a: ty::t, b: ty::t) -> cres { - debug!("%s.lattice_tys(%s, %s)", this.tag(), + debug2!("{}.lattice_tys({}, {})", this.tag(), a.inf_str(this.infcx()), b.inf_str(this.infcx())); let _r = indenter(); @@ -448,7 +448,7 @@ pub fn lattice_vars { // If a has an upper bound, return the LUB(a.ub, b) - debug!("bnd=Some(%s)", a_bnd.inf_str(this.infcx())); + debug2!("bnd=Some({})", a_bnd.inf_str(this.infcx())); lattice_dir_op(a_bnd, b) } None => { // If a does not have an upper bound, make b the upper bound of a // and then return b. - debug!("bnd=None"); + debug2!("bnd=None"); let a_bounds = this.with_bnd(a_bounds, (*b).clone()); do this.combine_fields().bnds(&a_bounds.lb, &a_bounds.ub).then { this.infcx().set(a_id.clone(), @@ -532,7 +532,7 @@ pub fn var_ids(this: &T, isr: isr_alist) -> ~[RegionVid] { r => { this.infcx().tcx.sess.span_bug( this.trace().origin.span(), - fmt!("Found non-region-vid: %?", r)); + format!("Found non-region-vid: {:?}", r)); } } true diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 260bc93611e96..c8974a722fd88 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -50,7 +50,7 @@ impl Combine for Lub { fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres { let tcx = self.infcx.tcx; - debug!("%s.mts(%s, %s)", + debug2!("{}.mts({}, {})", self.tag(), mt_to_str(tcx, a), mt_to_str(tcx, b)); @@ -106,7 +106,7 @@ impl Combine for Lub { } fn regions(&self, a: ty::Region, b: ty::Region) -> cres { - debug!("%s.regions(%?, %?)", + debug2!("{}.regions({:?}, {:?})", self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx)); @@ -134,7 +134,7 @@ impl Combine for Lub { // Collect constraints. let sig0 = if_ok!(super_fn_sigs(self, &a_with_fresh, &b_with_fresh)); - debug!("sig0 = %s", sig0.inf_str(self.infcx)); + debug2!("sig0 = {}", sig0.inf_str(self.infcx)); // Generalize the regions appearing in sig0 if possible let new_vars = @@ -154,7 +154,7 @@ impl Combine for Lub { r0: ty::Region) -> ty::Region { // Regions that pre-dated the LUB computation stay as they are. if !is_var_in_set(new_vars, r0) { - debug!("generalize_region(r0=%?): not new variable", r0); + debug2!("generalize_region(r0={:?}): not new variable", r0); return r0; } @@ -164,8 +164,8 @@ impl Combine for Lub { // *related* to regions that pre-date the LUB computation // stay as they are. if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) { - debug!("generalize_region(r0=%?): \ - non-new-variables found in %?", + debug2!("generalize_region(r0={:?}): \ + non-new-variables found in {:?}", r0, tainted); return r0; } @@ -179,8 +179,8 @@ impl Combine for Lub { do list::each(a_isr) |pair| { let (a_br, a_r) = *pair; if tainted.iter().any(|x| x == &a_r) { - debug!("generalize_region(r0=%?): \ - replacing with %?, tainted=%?", + debug2!("generalize_region(r0={:?}): \ + replacing with {:?}, tainted={:?}", r0, a_br, tainted); ret = Some(ty::re_bound(a_br)); false @@ -193,7 +193,7 @@ impl Combine for Lub { Some(x) => x, None => this.infcx.tcx.sess.span_bug( this.trace.origin.span(), - fmt!("Region %? is not associated with \ + format!("Region {:?} is not associated with \ any bound region from A!", r0)) } } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index e73a36de143cc..89e9f626ca581 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -244,7 +244,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str { cyclic_ty(_) => ~"cyclic type of infinite size", unresolved_region(_) => ~"unconstrained region", region_var_bound_by_region_var(r1, r2) => { - fmt!("region var %? bound by another region var %?; this is \ + format!("region var {:?} bound by another region var {:?}; this is \ a bug in rustc", r1, r2) } } @@ -285,7 +285,7 @@ pub fn common_supertype(cx: @mut InferCtxt, * not possible, reports an error and returns ty::err. */ - debug!("common_supertype(%s, %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("common_supertype({}, {})", a.inf_str(cx), b.inf_str(cx)); let trace = TypeTrace { origin: origin, @@ -311,7 +311,7 @@ pub fn mk_subty(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures { - debug!("mk_subty(%s <: %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.commit { let trace = TypeTrace { @@ -324,7 +324,7 @@ pub fn mk_subty(cx: @mut InferCtxt, } pub fn can_mk_subty(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures { - debug!("can_mk_subty(%s <: %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("can_mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.probe { let trace = TypeTrace { @@ -341,7 +341,7 @@ pub fn mk_subr(cx: @mut InferCtxt, origin: SubregionOrigin, a: ty::Region, b: ty::Region) { - debug!("mk_subr(%s <: %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("mk_subr({} <: {})", a.inf_str(cx), b.inf_str(cx)); cx.region_vars.start_snapshot(); cx.region_vars.make_subregion(origin, a, b); cx.region_vars.commit(); @@ -353,7 +353,7 @@ pub fn mk_eqty(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures { - debug!("mk_eqty(%s <: %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("mk_eqty({} <: {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.commit { let trace = TypeTrace { @@ -373,7 +373,7 @@ pub fn mk_sub_trait_refs(cx: @mut InferCtxt, b: @ty::TraitRef) -> ures { - debug!("mk_sub_trait_refs(%s <: %s)", + debug2!("mk_sub_trait_refs({} <: {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.commit { @@ -403,7 +403,7 @@ pub fn mk_coercety(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> CoerceResult { - debug!("mk_coercety(%s -> %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.commit { let trace = TypeTrace { @@ -416,7 +416,7 @@ pub fn mk_coercety(cx: @mut InferCtxt, } pub fn can_mk_coercety(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures { - debug!("can_mk_coercety(%s -> %s)", a.inf_str(cx), b.inf_str(cx)); + debug2!("can_mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx)); do indent { do cx.probe { let trace = TypeTrace { @@ -539,7 +539,7 @@ impl InferCtxt { } pub fn rollback_to(&mut self, snapshot: &Snapshot) { - debug!("rollback!"); + debug2!("rollback!"); rollback_to(&mut self.ty_var_bindings, snapshot.ty_var_bindings_len); rollback_to(&mut self.int_var_bindings, @@ -554,7 +554,7 @@ impl InferCtxt { pub fn commit(@mut self, f: &fn() -> Result) -> Result { assert!(!self.in_snapshot()); - debug!("commit()"); + debug2!("commit()"); do indent { let r = self.try(|| f()); @@ -567,7 +567,7 @@ impl InferCtxt { /// Execute `f`, unroll bindings on failure pub fn try(@mut self, f: &fn() -> Result) -> Result { - debug!("try()"); + debug2!("try()"); do indent { let snapshot = self.start_snapshot(); let r = f(); @@ -581,7 +581,7 @@ impl InferCtxt { /// Execute `f` then unroll any bindings it creates pub fn probe(@mut self, f: &fn() -> Result) -> Result { - debug!("probe()"); + debug2!("probe()"); do indent { let snapshot = self.start_snapshot(); let r = f(); @@ -654,7 +654,7 @@ impl InferCtxt { pub fn tys_to_str(@mut self, ts: &[ty::t]) -> ~str { let tstrs = ts.map(|t| self.ty_to_str(*t)); - fmt!("(%s)", tstrs.connect(", ")) + format!("({})", tstrs.connect(", ")) } pub fn trait_ref_to_str(@mut self, t: &ty::TraitRef) -> ~str { @@ -690,8 +690,8 @@ impl InferCtxt { } _ => { self.tcx.sess.bug( - fmt!("resolve_type_vars_if_possible() yielded %s \ - when supplied with %s", + format!("resolve_type_vars_if_possible() yielded {} \ + when supplied with {}", self.ty_to_str(dummy0), self.ty_to_str(dummy1))); } @@ -725,10 +725,10 @@ impl InferCtxt { expected_ty: Option, actual_ty: ~str, err: Option<&ty::type_err>) { - debug!("hi! expected_ty = %?, actual_ty = %s", expected_ty, actual_ty); + debug2!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty); let error_str = do err.map_move_default(~"") |t_err| { - fmt!(" (%s)", ty::type_err_to_str(self.tcx, t_err)) + format!(" ({})", ty::type_err_to_str(self.tcx, t_err)) }; let resolved_expected = do expected_ty.map_move |e_ty| { self.resolve_type_vars_if_possible(e_ty) @@ -736,10 +736,10 @@ impl InferCtxt { if !resolved_expected.map_move_default(false, |e| { ty::type_is_error(e) }) { match resolved_expected { None => self.tcx.sess.span_err(sp, - fmt!("%s%s", mk_msg(None, actual_ty), error_str)), + format!("{}{}", mk_msg(None, actual_ty), error_str)), Some(e) => { self.tcx.sess.span_err(sp, - fmt!("%s%s", mk_msg(Some(self.ty_to_str(e)), actual_ty), error_str)); + format!("{}{}", mk_msg(Some(self.ty_to_str(e)), actual_ty), error_str)); } } for err in err.iter() { @@ -776,7 +776,7 @@ impl InferCtxt { _ => { // if I leave out : ~str, it infers &str and complains |actual: ~str| { - fmt!("mismatched types: expected `%s` but found `%s`", + format!("mismatched types: expected `{}` but found `{}`", self.ty_to_str(resolved_expected), actual) } } @@ -792,7 +792,7 @@ impl InferCtxt { replace_bound_regions_in_fn_sig(self.tcx, @Nil, None, fsig, |br| { let rvar = self.next_region_var( BoundRegionInFnType(trace.origin.span(), br)); - debug!("Bound region %s maps to %?", + debug2!("Bound region {} maps to {:?}", bound_region_to_str(self.tcx, "", false, br), rvar); rvar @@ -819,7 +819,7 @@ impl TypeTrace { impl Repr for TypeTrace { fn repr(&self, tcx: ty::ctxt) -> ~str { - fmt!("TypeTrace(%s)", self.origin.repr(tcx)) + format!("TypeTrace({})", self.origin.repr(tcx)) } } @@ -840,13 +840,13 @@ impl TypeOrigin { impl Repr for TypeOrigin { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { - MethodCompatCheck(a) => fmt!("MethodCompatCheck(%s)", a.repr(tcx)), - ExprAssignable(a) => fmt!("ExprAssignable(%s)", a.repr(tcx)), - Misc(a) => fmt!("Misc(%s)", a.repr(tcx)), - RelateTraitRefs(a) => fmt!("RelateTraitRefs(%s)", a.repr(tcx)), - RelateSelfType(a) => fmt!("RelateSelfType(%s)", a.repr(tcx)), - MatchExpression(a) => fmt!("MatchExpression(%s)", a.repr(tcx)), - IfExpression(a) => fmt!("IfExpression(%s)", a.repr(tcx)), + MethodCompatCheck(a) => format!("MethodCompatCheck({})", a.repr(tcx)), + ExprAssignable(a) => format!("ExprAssignable({})", a.repr(tcx)), + Misc(a) => format!("Misc({})", a.repr(tcx)), + RelateTraitRefs(a) => format!("RelateTraitRefs({})", a.repr(tcx)), + RelateSelfType(a) => format!("RelateSelfType({})", a.repr(tcx)), + MatchExpression(a) => format!("MatchExpression({})", a.repr(tcx)), + IfExpression(a) => format!("IfExpression({})", a.repr(tcx)), } } } @@ -876,21 +876,23 @@ impl SubregionOrigin { impl Repr for SubregionOrigin { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { - Subtype(a) => fmt!("Subtype(%s)", a.repr(tcx)), - InfStackClosure(a) => fmt!("InfStackClosure(%s)", a.repr(tcx)), - InvokeClosure(a) => fmt!("InvokeClosure(%s)", a.repr(tcx)), - DerefPointer(a) => fmt!("DerefPointer(%s)", a.repr(tcx)), - FreeVariable(a) => fmt!("FreeVariable(%s)", a.repr(tcx)), - IndexSlice(a) => fmt!("IndexSlice(%s)", a.repr(tcx)), - RelateObjectBound(a) => fmt!("RelateObjectBound(%s)", a.repr(tcx)), - Reborrow(a) => fmt!("Reborrow(%s)", a.repr(tcx)), - ReferenceOutlivesReferent(_, a) => fmt!("ReferenceOutlivesReferent(%s)", a.repr(tcx)), - BindingTypeIsNotValidAtDecl(a) => fmt!("BindingTypeIsNotValidAtDecl(%s)", a.repr(tcx)), - CallRcvr(a) => fmt!("CallRcvr(%s)", a.repr(tcx)), - CallArg(a) => fmt!("CallArg(%s)", a.repr(tcx)), - CallReturn(a) => fmt!("CallReturn(%s)", a.repr(tcx)), - AddrOf(a) => fmt!("AddrOf(%s)", a.repr(tcx)), - AutoBorrow(a) => fmt!("AutoBorrow(%s)", a.repr(tcx)), + Subtype(a) => format!("Subtype({})", a.repr(tcx)), + InfStackClosure(a) => format!("InfStackClosure({})", a.repr(tcx)), + InvokeClosure(a) => format!("InvokeClosure({})", a.repr(tcx)), + DerefPointer(a) => format!("DerefPointer({})", a.repr(tcx)), + FreeVariable(a) => format!("FreeVariable({})", a.repr(tcx)), + IndexSlice(a) => format!("IndexSlice({})", a.repr(tcx)), + RelateObjectBound(a) => format!("RelateObjectBound({})", a.repr(tcx)), + Reborrow(a) => format!("Reborrow({})", a.repr(tcx)), + ReferenceOutlivesReferent(_, a) => + format!("ReferenceOutlivesReferent({})", a.repr(tcx)), + BindingTypeIsNotValidAtDecl(a) => + format!("BindingTypeIsNotValidAtDecl({})", a.repr(tcx)), + CallRcvr(a) => format!("CallRcvr({})", a.repr(tcx)), + CallArg(a) => format!("CallArg({})", a.repr(tcx)), + CallReturn(a) => format!("CallReturn({})", a.repr(tcx)), + AddrOf(a) => format!("AddrOf({})", a.repr(tcx)), + AutoBorrow(a) => format!("AutoBorrow({})", a.repr(tcx)), } } } @@ -916,20 +918,20 @@ impl RegionVariableOrigin { impl Repr for RegionVariableOrigin { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { - MiscVariable(a) => fmt!("MiscVariable(%s)", a.repr(tcx)), - PatternRegion(a) => fmt!("PatternRegion(%s)", a.repr(tcx)), - AddrOfRegion(a) => fmt!("AddrOfRegion(%s)", a.repr(tcx)), - AddrOfSlice(a) => fmt!("AddrOfSlice(%s)", a.repr(tcx)), - Autoref(a) => fmt!("Autoref(%s)", a.repr(tcx)), - Coercion(a) => fmt!("Coercion(%s)", a.repr(tcx)), - BoundRegionInFnCall(a, b) => fmt!("BoundRegionInFnCall(%s,%s)", + MiscVariable(a) => format!("MiscVariable({})", a.repr(tcx)), + PatternRegion(a) => format!("PatternRegion({})", a.repr(tcx)), + AddrOfRegion(a) => format!("AddrOfRegion({})", a.repr(tcx)), + AddrOfSlice(a) => format!("AddrOfSlice({})", a.repr(tcx)), + Autoref(a) => format!("Autoref({})", a.repr(tcx)), + Coercion(a) => format!("Coercion({})", a.repr(tcx)), + BoundRegionInFnCall(a, b) => format!("BoundRegionInFnCall({},{})", a.repr(tcx), b.repr(tcx)), - BoundRegionInFnType(a, b) => fmt!("BoundRegionInFnType(%s,%s)", + BoundRegionInFnType(a, b) => format!("BoundRegionInFnType({},{})", a.repr(tcx), b.repr(tcx)), - BoundRegionInTypeOrImpl(a) => fmt!("BoundRegionInTypeOrImpl(%s)", + BoundRegionInTypeOrImpl(a) => format!("BoundRegionInTypeOrImpl({})", a.repr(tcx)), - BoundRegionInCoherence => fmt!("BoundRegionInCoherence"), - BoundRegionError(a) => fmt!("BoundRegionError(%s)", a.repr(tcx)), + BoundRegionInCoherence => format!("BoundRegionInCoherence"), + BoundRegionError(a) => format!("BoundRegionError({})", a.repr(tcx)), } } } diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index c14e49f37e5bf..e5492453b98e2 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -130,7 +130,7 @@ impl RegionVarBindings { } pub fn start_snapshot(&mut self) -> uint { - debug!("RegionVarBindings: snapshot()=%u", self.undo_log.len()); + debug2!("RegionVarBindings: snapshot()={}", self.undo_log.len()); if self.in_snapshot() { self.undo_log.len() } else { @@ -140,17 +140,17 @@ impl RegionVarBindings { } pub fn commit(&mut self) { - debug!("RegionVarBindings: commit()"); + debug2!("RegionVarBindings: commit()"); while self.undo_log.len() > 0 { self.undo_log.pop(); } } pub fn rollback_to(&mut self, snapshot: uint) { - debug!("RegionVarBindings: rollback_to(%u)", snapshot); + debug2!("RegionVarBindings: rollback_to({})", snapshot); while self.undo_log.len() > snapshot { let undo_item = self.undo_log.pop(); - debug!("undo_item=%?", undo_item); + debug2!("undo_item={:?}", undo_item); match undo_item { Snapshot => {} AddVar(vid) => { @@ -181,7 +181,7 @@ impl RegionVarBindings { if self.in_snapshot() { self.undo_log.push(AddVar(vid)); } - debug!("created new region variable %? with origin %?", + debug2!("created new region variable {:?} with origin {:?}", vid, origin.repr(self.tcx)); return vid; } @@ -218,7 +218,7 @@ impl RegionVarBindings { // cannot add constraints once regions are resolved assert!(self.values.is_empty()); - debug!("RegionVarBindings: add_constraint(%?)", constraint); + debug2!("RegionVarBindings: add_constraint({:?})", constraint); if self.constraints.insert(constraint, origin) { if self.in_snapshot() { @@ -234,7 +234,7 @@ impl RegionVarBindings { // cannot add constraints once regions are resolved assert!(self.values.is_empty()); - debug!("RegionVarBindings: make_subregion(%?, %?)", sub, sup); + debug2!("RegionVarBindings: make_subregion({:?}, {:?})", sub, sup); match (sub, sup) { (re_infer(ReVar(sub_id)), re_infer(ReVar(sup_id))) => { self.add_constraint(ConstrainVarSubVar(sub_id, sup_id), origin); @@ -248,12 +248,12 @@ impl RegionVarBindings { (re_bound(br), _) => { self.tcx.sess.span_bug( origin.span(), - fmt!("Cannot relate bound region as subregion: %?", br)); + format!("Cannot relate bound region as subregion: {:?}", br)); } (_, re_bound(br)) => { self.tcx.sess.span_bug( origin.span(), - fmt!("Cannot relate bound region as superregion: %?", br)); + format!("Cannot relate bound region as superregion: {:?}", br)); } _ => { self.add_constraint(ConstrainRegSubReg(sub, sup), origin); @@ -269,7 +269,7 @@ impl RegionVarBindings { // cannot add constraints once regions are resolved assert!(self.values.is_empty()); - debug!("RegionVarBindings: lub_regions(%?, %?)", a, b); + debug2!("RegionVarBindings: lub_regions({:?}, {:?})", a, b); match (a, b) { (re_static, _) | (_, re_static) => { re_static // nothing lives longer than static @@ -292,7 +292,7 @@ impl RegionVarBindings { // cannot add constraints once regions are resolved assert!(self.values.is_empty()); - debug!("RegionVarBindings: glb_regions(%?, %?)", a, b); + debug2!("RegionVarBindings: glb_regions({:?}, {:?})", a, b); match (a, b) { (re_static, r) | (r, re_static) => { // static lives longer than everything else @@ -312,12 +312,12 @@ impl RegionVarBindings { if self.values.is_empty() { self.tcx.sess.span_bug( self.var_origins[rid.to_uint()].span(), - fmt!("Attempt to resolve region variable before values have \ + format!("Attempt to resolve region variable before values have \ been computed!")); } let v = self.values.with_ref(|values| values[rid.to_uint()]); - debug!("RegionVarBindings: resolve_var(%?=%u)=%?", + debug2!("RegionVarBindings: resolve_var({:?}={})={:?}", rid, rid.to_uint(), v); match v { Value(r) => r, @@ -367,7 +367,7 @@ impl RegionVarBindings { } relate(self, a, re_infer(ReVar(c))); relate(self, b, re_infer(ReVar(c))); - debug!("combine_vars() c=%?", c); + debug2!("combine_vars() c={:?}", c); re_infer(ReVar(c)) } @@ -390,7 +390,7 @@ impl RegionVarBindings { * regions. */ - debug!("tainted(snapshot=%u, r0=%?)", snapshot, r0); + debug2!("tainted(snapshot={}, r0={:?})", snapshot, r0); let _indenter = indenter(); let undo_len = self.undo_log.len(); @@ -404,7 +404,7 @@ impl RegionVarBindings { // nb: can't use uint::range() here because result_set grows let r = result_set[result_index]; - debug!("result_index=%u, r=%?", result_index, r); + debug2!("result_index={}, r={:?}", result_index, r); let mut undo_index = snapshot; while undo_index < undo_len { @@ -469,7 +469,7 @@ impl RegionVarBindings { errors are reported. */ pub fn resolve_regions(&mut self) -> OptVec { - debug!("RegionVarBindings: resolve_regions()"); + debug2!("RegionVarBindings: resolve_regions()"); let mut errors = opt_vec::Empty; let v = self.infer_variable_values(&mut errors); self.values.put_back(v); @@ -496,8 +496,8 @@ impl RegionVarBindings { (re_infer(ReVar(v_id)), _) | (_, re_infer(ReVar(v_id))) => { self.tcx.sess.span_bug( self.var_origins[v_id.to_uint()].span(), - fmt!("lub_concrete_regions invoked with \ - non-concrete regions: %?, %?", a, b)); + format!("lub_concrete_regions invoked with \ + non-concrete regions: {:?}, {:?}", a, b)); } (f @ re_free(ref fr), re_scope(s_id)) | @@ -582,7 +582,7 @@ impl RegionVarBindings { a: Region, b: Region) -> cres { - debug!("glb_concrete_regions(%?, %?)", a, b); + debug2!("glb_concrete_regions({:?}, {:?})", a, b); match (a, b) { (re_static, r) | (r, re_static) => { // static lives longer than everything else @@ -598,8 +598,8 @@ impl RegionVarBindings { (_, re_infer(ReVar(v_id))) => { self.tcx.sess.span_bug( self.var_origins[v_id.to_uint()].span(), - fmt!("glb_concrete_regions invoked with \ - non-concrete regions: %?, %?", a, b)); + format!("glb_concrete_regions invoked with \ + non-concrete regions: {:?}, {:?}", a, b)); } (re_free(ref fr), s @ re_scope(s_id)) | @@ -691,7 +691,7 @@ impl RegionVarBindings { // scopes or two free regions. So, if one of // these scopes is a subscope of the other, return // it. Otherwise fail. - debug!("intersect_scopes(scope_a=%?, scope_b=%?, region_a=%?, region_b=%?)", + debug2!("intersect_scopes(scope_a={:?}, scope_b={:?}, region_a={:?}, region_b={:?})", scope_a, scope_b, region_a, region_b); let rm = self.tcx.region_maps; match rm.nearest_common_ancestor(scope_a, scope_b) { @@ -778,13 +778,13 @@ impl RegionVarBindings { b_vid: RegionVid, b_data: &mut VarData) -> bool { - debug!("expand_node(%?, %? == %?)", + debug2!("expand_node({:?}, {:?} == {:?})", a_region, b_vid, b_data.value); b_data.classification = Expanding; match b_data.value { NoValue => { - debug!("Setting initial value of %? to %?", b_vid, a_region); + debug2!("Setting initial value of {:?} to {:?}", b_vid, a_region); b_data.value = Value(a_region); return true; @@ -796,7 +796,7 @@ impl RegionVarBindings { return false; } - debug!("Expanding value of %? from %? to %?", + debug2!("Expanding value of {:?} from {:?} to {:?}", b_vid, cur_region, lub); b_data.value = Value(lub); @@ -843,7 +843,7 @@ impl RegionVarBindings { a_data: &mut VarData, b_region: Region) -> bool { - debug!("contract_node(%? == %?/%?, %?)", + debug2!("contract_node({:?} == {:?}/{:?}, {:?})", a_vid, a_data.value, a_data.classification, b_region); return match a_data.value { @@ -876,7 +876,7 @@ impl RegionVarBindings { b_region: Region) -> bool { if !this.is_subregion_of(a_region, b_region) { - debug!("Setting %? to ErrorValue: %? not subregion of %?", + debug2!("Setting {:?} to ErrorValue: {:?} not subregion of {:?}", a_vid, a_region, b_region); a_data.value = ErrorValue; } @@ -894,14 +894,14 @@ impl RegionVarBindings { if glb == a_region { false } else { - debug!("Contracting value of %? from %? to %?", + debug2!("Contracting value of {:?} from {:?} to {:?}", a_vid, a_region, glb); a_data.value = Value(glb); true } } Err(_) => { - debug!("Setting %? to ErrorValue: no glb of %?, %?", + debug2!("Setting {:?} to ErrorValue: no glb of {:?}, {:?}", a_vid, a_region, b_region); a_data.value = ErrorValue; false @@ -930,7 +930,7 @@ impl RegionVarBindings { loop; } - debug!("ConcreteFailure: !(sub <= sup): sub=%?, sup=%?", + debug2!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}", sub, sup); let origin = self.constraints.get_copy(constraint); errors.push(ConcreteFailure(origin, sub, sup)); @@ -943,7 +943,7 @@ impl RegionVarBindings { errors: &mut OptVec) -> ~[VarValue] { - debug!("extract_values_and_collect_conflicts()"); + debug2!("extract_values_and_collect_conflicts()"); // This is the best way that I have found to suppress // duplicate and related errors. Basically we keep a set of @@ -1095,8 +1095,8 @@ impl RegionVarBindings { self.tcx.sess.span_bug( self.var_origins[node_idx.to_uint()].span(), - fmt!("collect_error_for_expanding_node() could not find error \ - for var %?, lower_bounds=%s, upper_bounds=%s", + format!("collect_error_for_expanding_node() could not find error \ + for var {:?}, lower_bounds={}, upper_bounds={}", node_idx, lower_bounds.map(|x| x.region).repr(self.tcx), upper_bounds.map(|x| x.region).repr(self.tcx))); @@ -1140,8 +1140,8 @@ impl RegionVarBindings { self.tcx.sess.span_bug( self.var_origins[node_idx.to_uint()].span(), - fmt!("collect_error_for_contracting_node() could not find error \ - for var %?, upper_bounds=%s", + format!("collect_error_for_contracting_node() could not find error \ + for var {:?}, upper_bounds={}", node_idx, upper_bounds.map(|x| x.region).repr(self.tcx))); } @@ -1182,8 +1182,8 @@ impl RegionVarBindings { state.dup_found = true; } - debug!("collect_concrete_regions(orig_node_idx=%?, node_idx=%?, \ - classification=%?)", + debug2!("collect_concrete_regions(orig_node_idx={:?}, node_idx={:?}, \ + classification={:?})", orig_node_idx, node_idx, classification); // figure out the direction from which this node takes its @@ -1204,7 +1204,7 @@ impl RegionVarBindings { graph: &RegionGraph, source_vid: RegionVid, dir: Direction) { - debug!("process_edges(source_vid=%?, dir=%?)", source_vid, dir); + debug2!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir); let source_node_index = NodeIndex(source_vid.to_uint()); do graph.each_adjacent_edge(source_node_index, dir) |_, edge| { @@ -1240,17 +1240,17 @@ impl RegionVarBindings { while changed { changed = false; iteration += 1; - debug!("---- %s Iteration #%u", tag, iteration); + debug2!("---- {} Iteration \\#{}", tag, iteration); for (constraint, _) in self.constraints.iter() { let edge_changed = body(constraint); if edge_changed { - debug!("Updated due to constraint %s", + debug2!("Updated due to constraint {}", constraint.repr(self.tcx)); changed = true; } } } - debug!("---- %s Complete after %u iteration(s)", tag, iteration); + debug2!("---- {} Complete after {} iteration(s)", tag, iteration); } } @@ -1258,13 +1258,13 @@ impl RegionVarBindings { impl Repr for Constraint { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { - ConstrainVarSubVar(a, b) => fmt!("ConstrainVarSubVar(%s, %s)", + ConstrainVarSubVar(a, b) => format!("ConstrainVarSubVar({}, {})", a.repr(tcx), b.repr(tcx)), - ConstrainRegSubVar(a, b) => fmt!("ConstrainRegSubVar(%s, %s)", + ConstrainRegSubVar(a, b) => format!("ConstrainRegSubVar({}, {})", a.repr(tcx), b.repr(tcx)), - ConstrainVarSubReg(a, b) => fmt!("ConstrainVarSubReg(%s, %s)", + ConstrainVarSubReg(a, b) => format!("ConstrainVarSubReg({}, {})", a.repr(tcx), b.repr(tcx)), - ConstrainRegSubReg(a, b) => fmt!("ConstrainRegSubReg(%s, %s)", + ConstrainRegSubReg(a, b) => format!("ConstrainRegSubReg({}, {})", a.repr(tcx), b.repr(tcx)), } } diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 941431ce0e3d1..57e0ecf874532 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -104,7 +104,7 @@ impl ResolveState { pub fn resolve_type_chk(&mut self, typ: ty::t) -> fres { self.err = None; - debug!("Resolving %s (modes=%x)", + debug2!("Resolving {} (modes={:x})", ty_to_str(self.infcx.tcx, typ), self.modes); @@ -116,7 +116,7 @@ impl ResolveState { assert!(self.v_seen.is_empty()); match self.err { None => { - debug!("Resolved to %s + %s (modes=%x)", + debug2!("Resolved to {} + {} (modes={:x})", ty_to_str(self.infcx.tcx, rty), ty_to_str(self.infcx.tcx, rty), self.modes); @@ -137,7 +137,7 @@ impl ResolveState { } pub fn resolve_type(&mut self, typ: ty::t) -> ty::t { - debug!("resolve_type(%s)", typ.inf_str(self.infcx)); + debug2!("resolve_type({})", typ.inf_str(self.infcx)); let _i = indenter(); if !ty::type_needs_infer(typ) { @@ -179,7 +179,7 @@ impl ResolveState { } pub fn resolve_region(&mut self, orig: ty::Region) -> ty::Region { - debug!("Resolve_region(%s)", orig.inf_str(self.infcx)); + debug2!("Resolve_region({})", orig.inf_str(self.infcx)); match orig { ty::re_infer(ty::ReVar(rid)) => self.resolve_region_var(rid), _ => orig diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index 57ebb2185d165..ad251a5be9e95 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -56,7 +56,7 @@ impl Combine for Sub { } fn regions(&self, a: ty::Region, b: ty::Region) -> cres { - debug!("%s.regions(%s, %s)", + debug2!("{}.regions({}, {})", self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx)); @@ -65,7 +65,7 @@ impl Combine for Sub { } fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres { - debug!("mts(%s <: %s)", a.inf_str(self.infcx), b.inf_str(self.infcx)); + debug2!("mts({} <: {})", a.inf_str(self.infcx), b.inf_str(self.infcx)); if a.mutbl != b.mutbl { return Err(ty::terr_mutability); @@ -110,7 +110,7 @@ impl Combine for Sub { } fn tys(&self, a: ty::t, b: ty::t) -> cres { - debug!("%s.tys(%s, %s)", self.tag(), + debug2!("{}.tys({}, {})", self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx)); if a == b { return Ok(a); } let _indenter = indenter(); @@ -143,7 +143,7 @@ impl Combine for Sub { } fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres { - debug!("fn_sigs(a=%s, b=%s)", + debug2!("fn_sigs(a={}, b={})", a.inf_str(self.infcx), b.inf_str(self.infcx)); let _indenter = indenter(); @@ -172,15 +172,15 @@ impl Combine for Sub { do replace_bound_regions_in_fn_sig(self.infcx.tcx, @Nil, None, b) |br| { let skol = self.infcx.region_vars.new_skolemized(br); - debug!("Bound region %s skolemized to %?", + debug2!("Bound region {} skolemized to {:?}", bound_region_to_str(self.infcx.tcx, "", false, br), skol); skol } }; - debug!("a_sig=%s", a_sig.inf_str(self.infcx)); - debug!("b_sig=%s", b_sig.inf_str(self.infcx)); + debug2!("a_sig={}", a_sig.inf_str(self.infcx)); + debug2!("b_sig={}", b_sig.inf_str(self.infcx)); // Compare types now that bound regions have been replaced. let sig = if_ok!(super_fn_sigs(self, &a_sig, &b_sig)); diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index 3aeea2bcc3b96..8792a068671d3 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -100,7 +100,7 @@ impl Env { return match search_mod(self, &self.crate.node.module, 0, names) { Some(id) => id, None => { - fail!("No item found: `%s`", names.connect("::")); + fail2!("No item found: `%s`", names.connect("::")); } }; @@ -153,7 +153,7 @@ impl Env { pub fn assert_subtype(&self, a: ty::t, b: ty::t) { if !self.is_subtype(a, b) { - fail!("%s is not a subtype of %s, but it should be", + fail2!("%s is not a subtype of %s, but it should be", self.ty_to_str(a), self.ty_to_str(b)); } @@ -161,7 +161,7 @@ impl Env { pub fn assert_not_subtype(&self, a: ty::t, b: ty::t) { if self.is_subtype(a, b) { - fail!("%s is a subtype of %s, but it shouldn't be", + fail2!("%s is a subtype of %s, but it shouldn't be", self.ty_to_str(a), self.ty_to_str(b)); } @@ -223,14 +223,14 @@ impl Env { pub fn glb() -> Glb { Glb(self.infcx.combine_fields(true, dummy_sp())) } pub fn resolve_regions(exp_count: uint) { - debug!("resolve_regions(%u)", exp_count); + debug2!("resolve_regions(%u)", exp_count); self.infcx.resolve_regions(); if self.err_messages.len() != exp_count { for msg in self.err_messages.iter() { - debug!("Error encountered: %s", *msg); + debug2!("Error encountered: %s", *msg); } - fmt!("Resolving regions encountered %u errors but expected %u!", + format!("Resolving regions encountered %u errors but expected %u!", self.err_messages.len(), exp_count); } @@ -240,7 +240,7 @@ impl Env { pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) { match self.lub().tys(t1, t2) { Err(e) => { - fail!("Unexpected error computing LUB: %?", e) + fail2!("Unexpected error computing LUB: %?", e) } Ok(t) => { self.assert_eq(t, t_lub); @@ -256,13 +256,13 @@ impl Env { /// Checks that `GLB(t1,t2) == t_glb` pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) { - debug!("check_glb(t1=%s, t2=%s, t_glb=%s)", + debug2!("check_glb(t1=%s, t2=%s, t_glb=%s)", self.ty_to_str(t1), self.ty_to_str(t2), self.ty_to_str(t_glb)); match self.glb().tys(t1, t2) { Err(e) => { - fail!("Unexpected error computing LUB: %?", e) + fail2!("Unexpected error computing LUB: %?", e) } Ok(t) => { self.assert_eq(t, t_glb); @@ -281,7 +281,7 @@ impl Env { match self.lub().tys(t1, t2) { Err(_) => {} Ok(t) => { - fail!("Unexpected success computing LUB: %?", self.ty_to_str(t)) + fail2!("Unexpected success computing LUB: %?", self.ty_to_str(t)) } } } @@ -291,7 +291,7 @@ impl Env { match self.glb().tys(t1, t2) { Err(_) => {} Ok(t) => { - fail!("Unexpected success computing GLB: %?", self.ty_to_str(t)) + fail2!("Unexpected success computing GLB: %?", self.ty_to_str(t)) } } } diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index e2d6d588baed0..2bb7a994593d7 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -31,7 +31,7 @@ impl InferStr for ty::t { impl InferStr for FnSig { fn inf_str(&self, cx: &InferCtxt) -> ~str { - fmt!("(%s) -> %s", + format!("({}) -> {}", self.inputs.map(|a| a.inf_str(cx)).connect(", "), self.output.inf_str(cx)) } @@ -45,7 +45,7 @@ impl InferStr for ty::mt { impl InferStr for ty::Region { fn inf_str(&self, _cx: &InferCtxt) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } @@ -60,7 +60,7 @@ impl InferStr for Bound { impl InferStr for Bounds { fn inf_str(&self, cx: &InferCtxt) -> ~str { - fmt!("{%s <: %s}", + format!("\\{{} <: {}\\}", self.lb.inf_str(cx), self.ub.inf_str(cx)) } @@ -69,8 +69,8 @@ impl InferStr for Bounds { impl InferStr for VarValue { fn inf_str(&self, cx: &InferCtxt) -> ~str { match *self { - Redirect(ref vid) => fmt!("Redirect(%s)", vid.to_str()), - Root(ref pt, rk) => fmt!("Root(%s, %s)", pt.inf_str(cx), + Redirect(ref vid) => format!("Redirect({})", vid.to_str()), + Root(ref pt, rk) => format!("Root({}, {})", pt.inf_str(cx), rk.to_str_radix(10u)) } } diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 5ebbee8986b0b..c05306a27be42 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -85,8 +85,8 @@ impl UnifyInferCtxtMethods for InferCtxt { let var_val = match vb.vals.find(&vid_u) { Some(&ref var_val) => (*var_val).clone(), None => { - tcx.sess.bug(fmt!( - "failed lookup of vid `%u`", vid_u)); + tcx.sess.bug(format!( + "failed lookup of vid `{}`", vid_u)); } }; match var_val { @@ -116,7 +116,7 @@ impl UnifyInferCtxtMethods for InferCtxt { * Sets the value for `vid` to `new_v`. `vid` MUST be a root node! */ - debug!("Updating variable %s to %s", + debug2!("Updating variable {} to {}", vid.to_str(), new_v.inf_str(self)); let vb = UnifyVid::appropriate_vals_and_bindings(self); @@ -134,8 +134,8 @@ impl UnifyInferCtxtMethods for InferCtxt { // Rank optimization: if you don't know what it is, check // out - debug!("unify(node_a(id=%?, rank=%?), \ - node_b(id=%?, rank=%?))", + debug2!("unify(node_a(id={:?}, rank={:?}), \ + node_b(id={:?}, rank={:?}))", node_a.root, node_a.rank, node_b.root, node_b.rank); diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index fbd3088902fb6..5db706765e9b8 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -178,7 +178,7 @@ impl Repr for vtable_origin { fn repr(&self, tcx: ty::ctxt) -> ~str { match *self { vtable_static(def_id, ref tys, ref vtable_res) => { - fmt!("vtable_static(%?:%s, %s, %s)", + format!("vtable_static({:?}:{}, {}, {})", def_id, ty::item_path_str(tcx, def_id), tys.repr(tcx), @@ -186,7 +186,7 @@ impl Repr for vtable_origin { } vtable_param(x, y) => { - fmt!("vtable_param(%?, %?)", x, y) + format!("vtable_param({:?}, {:?})", x, y) } } } @@ -208,7 +208,7 @@ pub struct impl_res { impl Repr for impl_res { fn repr(&self, tcx: ty::ctxt) -> ~str { - fmt!("impl_res {trait_vtables=%s, self_vtables=%s}", + format!("impl_res \\{trait_vtables={}, self_vtables={}\\}", self.trait_vtables.repr(tcx), self.self_vtables.repr(tcx)) } @@ -226,7 +226,7 @@ pub struct CrateCtxt { // Functions that write types into the node type table pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::NodeId, ty: ty::t) { - debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty)); + debug2!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_str(tcx, ty)); assert!(!ty::type_needs_infer(ty)); tcx.node_types.insert(node_id as uint, ty); } @@ -234,7 +234,7 @@ pub fn write_substs_to_tcx(tcx: ty::ctxt, node_id: ast::NodeId, substs: ~[ty::t]) { if substs.len() > 0u { - debug!("write_substs_to_tcx(%d, %?)", node_id, + debug2!("write_substs_to_tcx({}, {:?})", node_id, substs.map(|t| ppaux::ty_to_str(tcx, *t))); assert!(substs.iter().all(|t| !ty::type_needs_infer(*t))); tcx.node_type_substs.insert(node_id, substs); @@ -361,12 +361,12 @@ fn check_main_fn_ty(ccx: &CrateCtxt, }); require_same_types(tcx, None, false, main_span, main_t, se_ty, - || fmt!("main function expects type: `%s`", + || format!("main function expects type: `{}`", ppaux::ty_to_str(ccx.tcx, se_ty))); } _ => { tcx.sess.span_bug(main_span, - fmt!("main has a non-function type: found `%s`", + format!("main has a non-function type: found `{}`", ppaux::ty_to_str(tcx, main_t))); } } @@ -409,12 +409,12 @@ fn check_start_fn_ty(ccx: &CrateCtxt, }); require_same_types(tcx, None, false, start_span, start_t, se_ty, - || fmt!("start function expects type: `%s`", ppaux::ty_to_str(ccx.tcx, se_ty))); + || format!("start function expects type: `{}`", ppaux::ty_to_str(ccx.tcx, se_ty))); } _ => { tcx.sess.span_bug(start_span, - fmt!("start has a non-function type: found `%s`", + format!("start has a non-function type: found `{}`", ppaux::ty_to_str(tcx, start_t))); } } diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 1967122745dad..f6483a48ed00d 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -235,7 +235,7 @@ impl RegionScope for TypeRscope { None => { // if the self region is used, region parameterization should // have inferred that this type is RP - fail!("region parameterization should have inferred that \ + fail2!("region parameterization should have inferred that \ this type is RP"); } Some(ref region_parameterization) => { diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs index 320feae2ce732..a706562439566 100644 --- a/src/librustc/rustc.rs +++ b/src/librustc/rustc.rs @@ -135,7 +135,7 @@ pub fn version(argv0: &str) { } pub fn usage(argv0: &str) { - let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); + let message = format!("Usage: {} [OPTIONS] INPUT", argv0); println!("{}\n\ Additional help: -W help Print 'lint' options and default settings @@ -388,7 +388,7 @@ pub fn monitor(f: ~fn(@diagnostic::Emitter)) { } } // Fail so the process returns a failure code - fail!(); + fail2!(); } } } diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 3ffbbdd83587d..5058be7c16623 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -29,9 +29,9 @@ pub fn time(do_it: bool, what: ~str, u: U, f: &fn(U) -> T) -> T { pub fn indent(op: &fn() -> R) -> R { // Use in conjunction with the log post-processor like `src/etc/indenter` // to make debug output more readable. - debug!(">>"); + debug2!(">>"); let r = op(); - debug!("<< (Result = %?)", r); + debug2!("<< (Result = {:?})", r); r } @@ -40,7 +40,7 @@ pub struct _indenter { } impl Drop for _indenter { - fn drop(&mut self) { debug!("<<"); } + fn drop(&mut self) { debug2!("<<"); } } pub fn _indenter(_i: ()) -> _indenter { @@ -50,7 +50,7 @@ pub fn _indenter(_i: ()) -> _indenter { } pub fn indenter() -> _indenter { - debug!(">>"); + debug2!(">>"); _indenter(()) } @@ -120,7 +120,7 @@ pub fn local_rhs_span(l: @ast::Local, def: Span) -> Span { pub fn pluralize(n: uint, s: ~str) -> ~str { if n == 1 { s } - else { fmt!("%ss", s) } + else { format!("{}s", s) } } // A set of node IDs (used to keep track of which node IDs are for statements) diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 9350bf8d3d9ad..bbca28f134f8d 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -51,11 +51,11 @@ pub fn note_and_explain_region(cx: ctxt, (ref str, Some(span)) => { cx.sess.span_note( span, - fmt!("%s%s%s", prefix, (*str), suffix)); + format!("{}{}{}", prefix, (*str), suffix)); } (ref str, None) => { cx.sess.note( - fmt!("%s%s%s", prefix, (*str), suffix)); + format!("{}{}{}", prefix, (*str), suffix)); } } } @@ -98,7 +98,7 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region) } Some(_) | None => { // this really should not happen - (fmt!("unknown scope: %d. Please report a bug.", node_id), + (format!("unknown scope: {}. Please report a bug.", node_id), None) } } @@ -106,21 +106,21 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region) re_free(ref fr) => { let prefix = match fr.bound_region { - br_anon(idx) => fmt!("the anonymous lifetime #%u defined on", + br_anon(idx) => format!("the anonymous lifetime \\#{} defined on", idx + 1), - br_fresh(_) => fmt!("an anonymous lifetime defined on"), - _ => fmt!("the lifetime %s as defined on", + br_fresh(_) => format!("an anonymous lifetime defined on"), + _ => format!("the lifetime {} as defined on", bound_region_ptr_to_str(cx, fr.bound_region)) }; match cx.items.find(&fr.scope_id) { Some(&ast_map::node_block(ref blk)) => { let (msg, opt_span) = explain_span(cx, "block", blk.span); - (fmt!("%s %s", prefix, msg), opt_span) + (format!("{} {}", prefix, msg), opt_span) } Some(_) | None => { // this really should not happen - (fmt!("%s node %d", prefix, fr.scope_id), None) + (format!("{} node {}", prefix, fr.scope_id), None) } } } @@ -132,7 +132,7 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region) // I believe these cases should not occur (except when debugging, // perhaps) re_infer(_) | re_bound(_) => { - (fmt!("lifetime %?", region), None) + (format!("lifetime {:?}", region), None) } }; @@ -140,7 +140,7 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region) -> (~str, Option) { let lo = cx.sess.codemap.lookup_char_pos_adj(span.lo); - (fmt!("the %s at %u:%u", heading, + (format!("the {} at {}:{}", heading, lo.line, lo.col.to_uint()), Some(span)) } } @@ -154,11 +154,11 @@ pub fn bound_region_to_str(cx: ctxt, br: bound_region) -> ~str { let space_str = if space { " " } else { "" }; - if cx.sess.verbose() { return fmt!("%s%?%s", prefix, br, space_str); } + if cx.sess.verbose() { return format!("{}{:?}{}", prefix, br, space_str); } match br { - br_named(id) => fmt!("%s'%s%s", prefix, cx.sess.str_of(id), space_str), - br_self => fmt!("%s'self%s", prefix, space_str), + br_named(id) => format!("{}'{}{}", prefix, cx.sess.str_of(id), space_str), + br_self => format!("{}'self{}", prefix, space_str), br_anon(_) => prefix.to_str(), br_fresh(_) => prefix.to_str(), br_cap_avoid(_, br) => bound_region_to_str(cx, prefix, space, *br) @@ -168,37 +168,37 @@ pub fn bound_region_to_str(cx: ctxt, pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::NodeId) -> ~str { match cx.items.find(&node_id) { Some(&ast_map::node_block(ref blk)) => { - fmt!("", + format!("", cx.sess.codemap.span_to_str(blk.span)) } Some(&ast_map::node_expr(expr)) => { match expr.node { ast::ExprCall(*) => { - fmt!("", + format!("", cx.sess.codemap.span_to_str(expr.span)) } ast::ExprMatch(*) => { - fmt!("", + format!("", cx.sess.codemap.span_to_str(expr.span)) } ast::ExprAssignOp(*) | ast::ExprUnary(*) | ast::ExprBinary(*) | ast::ExprIndex(*) => { - fmt!("", + format!("", cx.sess.codemap.span_to_str(expr.span)) } _ => { - fmt!("", + format!("", cx.sess.codemap.span_to_str(expr.span)) } } } None => { - fmt!("", node_id) + format!("", node_id) } _ => { cx.sess.bug( - fmt!("re_scope refers to %s", + format!("re_scope refers to {}", ast_map::node_id_to_str(cx.items, node_id, token::get_ident_interner()))) } } @@ -215,7 +215,7 @@ pub fn region_to_str(cx: ctxt, prefix: &str, space: bool, region: Region) -> ~st let space_str = if space { " " } else { "" }; if cx.sess.verbose() { - return fmt!("%s%?%s", prefix, region, space_str); + return format!("{}{:?}{}", prefix, region, space_str); } // These printouts are concise. They do not contain all the information @@ -230,8 +230,8 @@ pub fn region_to_str(cx: ctxt, prefix: &str, space: bool, region: Region) -> ~st bound_region_to_str(cx, prefix, space, br) } re_infer(ReVar(_)) => prefix.to_str(), - re_static => fmt!("%s'static%s", prefix, space_str), - re_empty => fmt!("%s'%s", prefix, space_str) + re_static => format!("{}'static{}", prefix, space_str), + re_empty => format!("{}'{}", prefix, space_str) } } @@ -248,12 +248,12 @@ pub fn mt_to_str(cx: ctxt, m: &mt) -> ~str { pub fn mt_to_str_wrapped(cx: ctxt, before: &str, m: &mt, after: &str) -> ~str { let mstr = mutability_to_str(m.mutbl); - return fmt!("%s%s%s%s", mstr, before, ty_to_str(cx, m.ty), after); + return format!("{}{}{}{}", mstr, before, ty_to_str(cx, m.ty), after); } pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str { match vs { - ty::vstore_fixed(n) => fmt!("%u", n), + ty::vstore_fixed(n) => format!("{}", n), ty::vstore_uniq => ~"~", ty::vstore_box => ~"@", ty::vstore_slice(r) => region_ptr_to_str(cx, r) @@ -271,17 +271,17 @@ pub fn trait_store_to_str(cx: ctxt, s: ty::TraitStore) -> ~str { pub fn vstore_ty_to_str(cx: ctxt, mt: &mt, vs: ty::vstore) -> ~str { match vs { ty::vstore_fixed(_) => { - fmt!("[%s, .. %s]", mt_to_str(cx, mt), vstore_to_str(cx, vs)) + format!("[{}, .. {}]", mt_to_str(cx, mt), vstore_to_str(cx, vs)) } _ => { - fmt!("%s%s", vstore_to_str(cx, vs), mt_to_str_wrapped(cx, "[", mt, "]")) + format!("{}{}", vstore_to_str(cx, vs), mt_to_str_wrapped(cx, "[", mt, "]")) } } } pub fn vec_map_to_str(ts: &[T], f: &fn(t: &T) -> ~str) -> ~str { let tstrs = ts.map(f); - fmt!("[%s]", tstrs.connect(", ")) + format!("[{}]", tstrs.connect(", ")) } pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str { @@ -289,7 +289,7 @@ pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str { } pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str { - fmt!("fn%s -> %s", + format!("fn{} -> {}", tys_to_str(cx, typ.inputs.map(|a| *a)), ty_to_str(cx, typ.output)) } @@ -397,7 +397,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { &m.fty.sig) + ";" } fn field_to_str(cx: ctxt, f: field) -> ~str { - return fmt!("%s: %s", cx.sess.str_of(f.ident), mt_to_str(cx, &f.mt)); + return format!("{}: {}", cx.sess.str_of(f.ident), mt_to_str(cx, &f.mt)); } // if there is an id, print that instead of the structural type: @@ -425,7 +425,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { ty_rptr(r, ref tm) => { region_ptr_to_str(cx, r) + mt_to_str(cx, tm) } - ty_unboxed_vec(ref tm) => { fmt!("unboxed_vec<%s>", mt_to_str(cx, tm)) } + ty_unboxed_vec(ref tm) => { format!("unboxed_vec<{}>", mt_to_str(cx, tm)) } ty_type => ~"type", ty_tup(ref elems) => { let strs = elems.map(|elem| ty_to_str(cx, *elem)); @@ -447,10 +447,10 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { } None => { // This should not happen... - fmt!("BUG[%?]", id) + format!("BUG[{:?}]", id) } }; - if !cx.sess.verbose() { ident } else { fmt!("%s:%?", ident, did) } + if !cx.sess.verbose() { ident } else { format!("{}:{:?}", ident, did) } } ty_self(*) => ~"Self", ty_enum(did, ref substs) | ty_struct(did, ref substs) => { @@ -464,13 +464,13 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { let ty = parameterized(cx, base, &substs.regions, substs.tps); let bound_sep = if bounds.is_empty() { "" } else { ":" }; let bound_str = bounds.repr(cx); - fmt!("%s%s%s%s%s", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty, + format!("{}{}{}{}{}", trait_store_to_str(cx, s), mutability_to_str(mutbl), ty, bound_sep, bound_str) } ty_evec(ref mt, vs) => { vstore_ty_to_str(cx, mt, vs) } - ty_estr(vs) => fmt!("%s%s", vstore_to_str(cx, vs), "str"), + ty_estr(vs) => format!("{}{}", vstore_to_str(cx, vs), "str"), ty_opaque_box => ~"@?", ty_opaque_closure_ptr(ast::BorrowedSigil) => ~"&closure", ty_opaque_closure_ptr(ast::ManagedSigil) => ~"@closure", @@ -498,9 +498,9 @@ pub fn parameterized(cx: ctxt, } if strs.len() > 0u { - fmt!("%s<%s>", base, strs.connect(",")) + format!("{}<{}>", base, strs.connect(",")) } else { - fmt!("%s", base) + format!("{}", base) } } @@ -514,7 +514,7 @@ impl Repr for Option { fn repr(&self, tcx: ctxt) -> ~str { match self { &None => ~"None", - &Some(ref t) => fmt!("Some(%s)", t.repr(tcx)) + &Some(ref t) => format!("Some({})", t.repr(tcx)) } } } @@ -560,7 +560,7 @@ impl Repr for ~[T] { impl Repr for ty::TypeParameterDef { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("TypeParameterDef {%?, bounds: %s}", + format!("TypeParameterDef \\{{:?}, bounds: {}\\}", self.def_id, self.bounds.repr(tcx)) } } @@ -573,7 +573,7 @@ impl Repr for ty::t { impl Repr for ty::substs { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("substs(regions=%s, self_ty=%s, tps=%s)", + format!("substs(regions={}, self_ty={}, tps={})", self.regions.repr(tcx), self.self_ty.repr(tcx), self.tps.repr(tcx)) @@ -615,7 +615,7 @@ impl Repr for ty::TraitRef { impl Repr for ast::Expr { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("expr(%d: %s)", + format!("expr({}: {})", self.id, pprust::expr_to_str(self, tcx.sess.intr())) } @@ -623,7 +623,7 @@ impl Repr for ast::Expr { impl Repr for ast::Pat { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("pat(%d: %s)", + format!("pat({}: {})", self.id, pprust::pat_to_str(self, tcx.sess.intr())) } @@ -654,18 +654,18 @@ impl Repr for ast::DefId { Some(&ast_map::node_trait_method(*)) | Some(&ast_map::node_variant(*)) | Some(&ast_map::node_struct_ctor(*)) => { - return fmt!("%?:%s", *self, ty::item_path_str(tcx, *self)); + return format!("{:?}:{}", *self, ty::item_path_str(tcx, *self)); } _ => {} } } - return fmt!("%?", *self); + return format!("{:?}", *self); } } impl Repr for ty::ty_param_bounds_and_ty { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("ty_param_bounds_and_ty {generics: %s, ty: %s}", + format!("ty_param_bounds_and_ty \\{generics: {}, ty: {}\\}", self.generics.repr(tcx), self.ty.repr(tcx)) } @@ -673,7 +673,7 @@ impl Repr for ty::ty_param_bounds_and_ty { impl Repr for ty::Generics { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("Generics {type_param_defs: %s, region_param: %?}", + format!("Generics \\{type_param_defs: {}, region_param: {:?}\\}", self.type_param_defs.repr(tcx), self.region_param) } @@ -681,8 +681,8 @@ impl Repr for ty::Generics { impl Repr for ty::Method { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("method {ident: %s, generics: %s, transformed_self_ty: %s, \ - fty: %s, explicit_self: %s, vis: %s, def_id: %s}", + format!("method \\{ident: {}, generics: {}, transformed_self_ty: {}, \ + fty: {}, explicit_self: {}, vis: {}, def_id: {}\\}", self.ident.repr(tcx), self.generics.repr(tcx), self.transformed_self_ty.repr(tcx), @@ -701,19 +701,19 @@ impl Repr for ast::Ident { impl Repr for ast::explicit_self_ { fn repr(&self, _tcx: ctxt) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } impl Repr for ast::visibility { fn repr(&self, _tcx: ctxt) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } impl Repr for ty::BareFnTy { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("BareFnTy {purity: %?, abis: %s, sig: %s}", + format!("BareFnTy \\{purity: {:?}, abis: {}, sig: {}\\}", self.purity, self.abis.to_str(), self.sig.repr(tcx)) @@ -728,9 +728,9 @@ impl Repr for ty::FnSig { impl Repr for typeck::method_map_entry { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("method_map_entry {self_arg: %s, \ - explicit_self: %s, \ - origin: %s}", + format!("method_map_entry \\{self_arg: {}, \ + explicit_self: {}, \ + origin: {}\\}", self.self_ty.repr(tcx), self.explicit_self.repr(tcx), self.origin.repr(tcx)) @@ -741,7 +741,7 @@ impl Repr for typeck::method_origin { fn repr(&self, tcx: ctxt) -> ~str { match self { &typeck::method_static(def_id) => { - fmt!("method_static(%s)", def_id.repr(tcx)) + format!("method_static({})", def_id.repr(tcx)) } &typeck::method_param(ref p) => { p.repr(tcx) @@ -755,7 +755,7 @@ impl Repr for typeck::method_origin { impl Repr for typeck::method_param { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("method_param(%s,%?,%?,%?)", + format!("method_param({},{:?},{:?},{:?})", self.trait_id.repr(tcx), self.method_num, self.param_num, @@ -765,7 +765,7 @@ impl Repr for typeck::method_param { impl Repr for typeck::method_object { fn repr(&self, tcx: ctxt) -> ~str { - fmt!("method_object(%s,%?,%?)", + format!("method_object({},{:?},{:?})", self.trait_id.repr(tcx), self.method_num, self.real_index) @@ -775,7 +775,7 @@ impl Repr for typeck::method_object { impl Repr for ty::RegionVid { fn repr(&self, _tcx: ctxt) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } @@ -784,7 +784,7 @@ impl Repr for ty::TraitStore { match self { &ty::BoxTraitStore => ~"@Trait", &ty::UniqTraitStore => ~"~Trait", - &ty::RegionTraitStore(r) => fmt!("&%s Trait", r.repr(tcx)) + &ty::RegionTraitStore(r) => format!("&{} Trait", r.repr(tcx)) } } } @@ -807,7 +807,7 @@ impl Repr for ast_map::path_elt { impl Repr for ty::BuiltinBound { fn repr(&self, _tcx: ctxt) -> ~str { - fmt!("%?", *self) + format!("{:?}", *self) } } From 4d47601a7e7324de1dd616a535248d908a1543fe Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 23:22:23 -0700 Subject: [PATCH 06/16] rusti: Remove usage of fmt! --- src/librusti/program.rs | 52 ++++++++++++++++++++--------------------- src/librusti/rusti.rs | 22 ++++++++--------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/librusti/program.rs b/src/librusti/program.rs index 4deaa458f194f..0053d7137768d 100644 --- a/src/librusti/program.rs +++ b/src/librusti/program.rs @@ -100,7 +100,7 @@ impl Program { // It's easy to initialize things if we don't run things... for (name, var) in self.local_vars.iter() { let mt = var.mt(); - code.push_str(fmt!("let%s %s: %s = fail!();\n", mt, *name, var.ty)); + code.push_str(format!("let{} {}: {} = fail!();\n", mt, *name, var.ty)); var.alter(*name, &mut code); } code.push_str("{\n"); @@ -115,7 +115,7 @@ impl Program { } for p in new_locals.iter() { - code.push_str(fmt!("assert_encodable(&%s);\n", *p.first_ref())); + code.push_str(format!("assert_encodable(&{});\n", *p.first_ref())); } code.push_str("};}"); return code; @@ -138,22 +138,22 @@ impl Program { // variables. This works by totally legitimately using the 'code' // pointer of the 'tls_key' function as a uint, and then casting it back // up to a function - code.push_str(fmt!(" - let __tls_map: @mut ::std::hashmap::HashMap<~str, @~[u8]> = unsafe { - let key = ::std::cast::transmute(%u); + code.push_str(format!(" + let __tls_map: @mut ::std::hashmap::HashMap<~str, @~[u8]> = unsafe \\{ + let key = ::std::cast::transmute({}); ::std::local_data::get(key, |k| k.map(|&x| *x)).unwrap() - };\n", key as uint)); + \\};\n", key)); // Using this __tls_map handle, deserialize each variable binding that // we know about for (name, var) in self.local_vars.iter() { let mt = var.mt(); - code.push_str(fmt!("let%s %s: %s = { - let data = __tls_map.get_copy(&~\"%s\"); + code.push_str(format!("let{} {}: {} = \\{ + let data = __tls_map.get_copy(&~\"{}\"); let doc = ::extra::ebml::reader::Doc(data); let mut decoder = ::extra::ebml::reader::Decoder(doc); ::extra::serialize::Decodable::decode(&mut decoder) - };\n", mt, *name, var.ty, *name)); + \\};\n", mt, *name, var.ty, *name)); var.alter(*name, &mut code); } @@ -162,7 +162,7 @@ impl Program { code.push_char('\n'); match *to_print { - Some(ref s) => { code.push_str(fmt!("pp({\n%s\n});", *s)); } + Some(ref s) => { code.push_str(format!("pp(\\{\n{}\n\\});", *s)); } None => {} } @@ -174,14 +174,14 @@ impl Program { // After the input code is run, we can re-serialize everything back out // into tls map (to be read later on by this task) for (name, var) in self.local_vars.iter() { - code.push_str(fmt!("{ - let local: %s = %s; - let bytes = do ::std::io::with_bytes_writer |io| { + code.push_str(format!("\\{ + let local: {} = {}; + let bytes = do ::std::io::with_bytes_writer |io| \\{ let mut enc = ::extra::ebml::writer::Encoder(io); local.encode(&mut enc); - }; - __tls_map.insert(~\"%s\", @bytes); - }\n", var.real_ty(), *name, *name)); + \\}; + __tls_map.insert(~\"{}\", @bytes); + \\}\n", var.real_ty(), *name, *name)); } // Close things up, and we're done. @@ -193,14 +193,14 @@ impl Program { fn program_header(&self) -> ~str { // up front, disable lots of annoying lints, then include all global // state such as items, view items, and extern mods. - let mut code = fmt!(" - #[allow(warnings)]; + let mut code = format!(" + \\#[allow(warnings)]; extern mod extra; - %s // extern mods + {} // extern mods use extra::serialize::*; - %s // view items + {} // view items ", self.externs, self.view_items); for (_, s) in self.structs.iter() { // The structs aren't really useful unless they're encodable @@ -236,7 +236,7 @@ impl Program { for (name, value) in cons_map.move_iter() { match self.local_vars.find_mut(&name) { Some(v) => { v.data = (*value).clone(); } - None => { fail!("unknown variable %s", name) } + None => { fail2!("unknown variable {}", name) } } } } @@ -272,7 +272,7 @@ impl Program { /// Once the types are known, they are inserted into the local_vars map in /// this Program (to be deserialized later on pub fn register_new_vars(&mut self, blk: &ast::Block, tcx: ty::ctxt) { - debug!("looking for new variables"); + debug2!("looking for new variables"); let newvars = @mut HashMap::new(); do each_user_local(blk) |local| { let mutable = local.is_mutbl; @@ -378,7 +378,7 @@ impl Program { _ => {} } } - fail!("couldn't find user block"); + fail2!("couldn't find user block"); } } } @@ -389,9 +389,9 @@ impl LocalVariable { fn alter(&self, name: &str, code: &mut ~str) { match self.alterations { Some((ref real_ty, ref prefix)) => { - code.push_str(fmt!("let%s %s: %s = %s%s;\n", - self.mt(), name, - *real_ty, *prefix, name)); + code.push_str(format!("let{} {}: {} = {}{};\n", + self.mt(), name, + *real_ty, *prefix, name)); } None => {} } diff --git a/src/librusti/rusti.rs b/src/librusti/rusti.rs index ebf939c8beaba..a3185ee943872 100644 --- a/src/librusti/rusti.rs +++ b/src/librusti/rusti.rs @@ -156,7 +156,7 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], // // Stage 1: parse the input and filter it into the program (as necessary) // - debug!("parsing: %s", input); + debug2!("parsing: {}", input); let crate = parse_input(sess, input); let mut to_run = ~[]; // statements to run (emitted back into code) let new_locals = @mut ~[]; // new locals being defined @@ -231,11 +231,11 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], // Stage 2: run everything up to typeck to learn the types of the new // variables introduced into the program // - info!("Learning about the new types in the program"); + info2!("Learning about the new types in the program"); program.set_cache(); // before register_new_vars (which changes them) let input = to_run.connect("\n"); let test = program.test_code(input, &result, *new_locals); - debug!("testing with ^^^^^^ %?", (||{ println(test) })()); + debug2!("testing with ^^^^^^ {:?}", (||{ println(test) })()); let dinput = driver::str_input(test.to_managed()); let cfg = driver::build_configuration(sess); @@ -252,9 +252,9 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], // // Stage 3: Actually run the code in the JIT // - info!("actually running code"); + info2!("actually running code"); let code = program.code(input, &result); - debug!("actually running ^^^^^^ %?", (||{ println(code) })()); + debug2!("actually running ^^^^^^ {:?}", (||{ println(code) })()); let input = driver::str_input(code.to_managed()); let cfg = driver::build_configuration(sess); let outputs = driver::build_output_filenames(&input, &None, &None, [], sess); @@ -272,7 +272,7 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], // Stage 4: Inform the program that computation is done so it can update all // local variable bindings. // - info!("cleaning up after code"); + info2!("cleaning up after code"); program.consume_cache(); // @@ -284,7 +284,7 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], return (program, jit::consume_engine()); fn parse_input(sess: session::Session, input: &str) -> ast::Crate { - let code = fmt!("fn main() {\n %s \n}", input); + let code = format!("fn main() \\{\n {} \n\\}", input); let input = driver::str_input(code.to_managed()); let cfg = driver::build_configuration(sess); driver::phase_1_parse_input(sess, cfg.clone(), &input) @@ -302,7 +302,7 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str], _ => {} } } - fail!("main function was expected somewhere..."); + fail2!("main function was expected somewhere..."); } } @@ -355,7 +355,7 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option { None => { }, } if (should_compile) { - println(fmt!("compiling %s...", src_filename)); + println(format!("compiling {}...", src_filename)); let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input); let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate); let analysis = driver::phase_3_run_analysis_passes(sess, &expanded_crate); @@ -429,7 +429,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer, for crate in loaded_crates.iter() { let crate_path = Path(*crate); let crate_dir = crate_path.dirname(); - repl.program.record_extern(fmt!("extern mod %s;", *crate)); + repl.program.record_extern(format!("extern mod {};", *crate)); if !repl.lib_search_paths.iter().any(|x| x == &crate_dir) { repl.lib_search_paths.push(crate_dir); } @@ -445,7 +445,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer, let mut end_multiline = false; while (!end_multiline) { match get_line(use_rl, "rusti| ") { - None => fail!("unterminated multiline command :{ .. :}"), + None => fail2!("unterminated multiline command :\\{ .. :\\}"), Some(line) => { if line.trim() == ":}" { end_multiline = true; From a7f19f36be81cfc04d013fec80598193638fe55b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 23:22:34 -0700 Subject: [PATCH 07/16] rustdoc: Remove usage of fmt! --- src/librustdoc/clean.rs | 34 +++++++++++++++++----------------- src/librustdoc/core.rs | 6 +++--- src/librustdoc/html/render.rs | 2 +- src/librustdoc/passes.rs | 2 +- src/librustdoc/rustdoc.rs | 2 +- src/librustdoc/visit_ast.rs | 10 +++++----- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index b4b086f3df0bc..b0f2ba286e691 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -71,7 +71,7 @@ impl Clean for visit_ast::RustdocVisitor { Crate { name: match maybe_meta { Some(x) => x.to_owned(), - None => fail!("rustdoc_ng requires a #[link(name=\"foo\")] crate attribute"), + None => fail2!("rustdoc_ng requires a \\#[link(name=\"foo\")] crate attribute"), }, module: Some(self.module.clean()), } @@ -575,9 +575,9 @@ pub enum Type { impl Clean for ast::Ty { fn clean(&self) -> Type { use syntax::ast::*; - debug!("cleaning type `%?`", self); + debug2!("cleaning type `{:?}`", self); let codemap = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap; - debug!("span corresponds to `%s`", codemap.span_to_str(self.span)); + debug2!("span corresponds to `{}`", codemap.span_to_str(self.span)); match self.node { ty_nil => Unit, ty_ptr(ref m) => RawPointer(m.mutbl.clean(), ~m.ty.clean()), @@ -595,7 +595,7 @@ impl Clean for ast::Ty { ty_closure(ref c) => Closure(~c.clean()), ty_bare_fn(ref barefn) => BareFunction(~barefn.clean()), ty_bot => Bottom, - ref x => fail!("Unimplemented type %?", x), + ref x => fail2!("Unimplemented type {:?}", x), } } } @@ -873,7 +873,7 @@ pub struct Static { impl Clean for doctree::Static { fn clean(&self) -> Item { - debug!("claning static %s: %?", self.name.clean(), self); + debug2!("claning static {}: {:?}", self.name.clean(), self); Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), @@ -1053,13 +1053,13 @@ trait ToSource { impl ToSource for syntax::codemap::Span { fn to_src(&self) -> ~str { - debug!("converting span %? to snippet", self.clean()); + debug2!("converting span {:?} to snippet", self.clean()); let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap.clone(); let sn = match cm.span_to_snippet(*self) { Some(x) => x, None => ~"" }; - debug!("got snippet %s", sn); + debug2!("got snippet {}", sn); sn } } @@ -1084,17 +1084,17 @@ fn name_from_pat(p: &ast::Pat) -> ~str { PatWild => ~"_", PatIdent(_, ref p, _) => path_to_str(p), PatEnum(ref p, _) => path_to_str(p), - PatStruct(*) => fail!("tried to get argument name from pat_struct, \ + PatStruct(*) => fail2!("tried to get argument name from pat_struct, \ which is not allowed in function arguments"), PatTup(*) => ~"(tuple arg NYI)", PatBox(p) => name_from_pat(p), PatUniq(p) => name_from_pat(p), PatRegion(p) => name_from_pat(p), - PatLit(*) => fail!("tried to get argument name from pat_lit, \ + PatLit(*) => fail2!("tried to get argument name from pat_lit, \ which is not allowed in function arguments"), - PatRange(*) => fail!("tried to get argument name from pat_range, \ + PatRange(*) => fail2!("tried to get argument name from pat_range, \ which is not allowed in function arguments"), - PatVec(*) => fail!("tried to get argument name from pat_vec, \ + PatVec(*) => fail2!("tried to get argument name from pat_vec, \ which is not allowed in function arguments") } } @@ -1117,14 +1117,14 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, use syntax::ast::*; let dm = local_data::get(super::ctxtkey, |x| *x.unwrap()).tycx.def_map; - debug!("searching for %? in defmap", id); + debug2!("searching for {:?} in defmap", id); let d = match dm.find(&id) { Some(k) => k, None => { let ctxt = local_data::get(super::ctxtkey, |x| *x.unwrap()); - debug!("could not find %? in defmap (`%s`)", id, + debug2!("could not find {:?} in defmap (`{}`)", id, syntax::ast_map::node_id_to_str(ctxt.tycx.items, id, ctxt.sess.intr())); - fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)") + fail2!("Unexpected failure: unresolved id not in defmap (this is a bug!)") } }; @@ -1133,7 +1133,7 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, DefSelf(i) | DefSelfTy(i) => return Self(i), DefTy(i) => i, DefTrait(i) => { - debug!("saw DefTrait in def_to_id"); + debug2!("saw DefTrait in def_to_id"); i }, DefPrimTy(p) => match p { @@ -1144,10 +1144,10 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, DefTyParam(i, _) => return Generic(i.node), DefStruct(i) => i, DefTyParamBinder(i) => { - debug!("found a typaram_binder, what is it? %d", i); + debug2!("found a typaram_binder, what is it? {}", i); return TyParamBinder(i); }, - x => fail!("resolved type maps to a weird def %?", x), + x => fail2!("resolved type maps to a weird def {:?}", x), }; ResolvedPath{ path: path, typarams: tpbs, did: def_id } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index ff60241056c35..7537366014e05 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -62,15 +62,15 @@ fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext { crate = phase_2_configure_and_expand(sess, cfg, crate); let analysis = phase_3_run_analysis_passes(sess, &crate); - debug!("crate: %?", crate); + debug2!("crate: {:?}", crate); DocContext { crate: crate, tycx: analysis.ty_cx, sess: sess } } pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate { let ctxt = @get_ast_and_resolve(path, libs); - debug!("defmap:"); + debug2!("defmap:"); for (k, v) in ctxt.tycx.def_map.iter() { - debug!("%?: %?", k, v); + debug2!("{:?}: {:?}", k, v); } local_data::set(super::ctxtkey, ctxt); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 4702cb0f73d86..441f25f33e6af 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -205,7 +205,7 @@ fn mkdir(path: &Path) { do io::io_error::cond.trap(|err| { error2!("Couldn't create directory `{}`: {}", path.to_str(), err.desc); - fail!() + fail2!() }).inside { if !path.is_dir() { file::mkdir(path); diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index bbb20b31272ad..8f1955fb42320 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -32,7 +32,7 @@ pub fn strip_hidden(crate: clean::Crate) -> plugins::PluginResult { for innerattr in l.iter() { match innerattr { &clean::Word(ref s) if "hidden" == *s => { - debug!("found one in strip_hidden; removing"); + debug2!("found one in strip_hidden; removing"); return None; }, _ => (), diff --git a/src/librustdoc/rustdoc.rs b/src/librustdoc/rustdoc.rs index 2405acd76b6cb..57aa62d313cc7 100644 --- a/src/librustdoc/rustdoc.rs +++ b/src/librustdoc/rustdoc.rs @@ -238,7 +238,7 @@ fn jsonify(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) { }; let crate_json = match extra::json::from_str(crate_json_str) { Ok(j) => j, - Err(_) => fail!("Rust generated JSON is invalid??") + Err(_) => fail2!("Rust generated JSON is invalid??") }; json.insert(~"crate", crate_json); diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 8e89c07ef001c..9fd4c43c25437 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -37,7 +37,7 @@ impl RustdocVisitor { self.attrs = crate.attrs.clone(); fn visit_struct_def(item: &ast::item, sd: @ast::struct_def, generics: &ast::Generics) -> Struct { - debug!("Visiting struct"); + debug2!("Visiting struct"); let struct_type = struct_type_from_def(sd); Struct { id: item.id, @@ -52,7 +52,7 @@ impl RustdocVisitor { } fn visit_enum_def(it: &ast::item, def: &ast::enum_def, params: &ast::Generics) -> Enum { - debug!("Visiting enum"); + debug2!("Visiting enum"); let mut vars: ~[Variant] = ~[]; for x in def.variants.iter() { vars.push(Variant { @@ -77,7 +77,7 @@ impl RustdocVisitor { fn visit_fn(item: &ast::item, fd: &ast::fn_decl, purity: &ast::purity, _abi: &AbiSet, gen: &ast::Generics) -> Function { - debug!("Visiting fn"); + debug2!("Visiting fn"); Function { id: item.id, vis: item.vis, @@ -96,7 +96,7 @@ impl RustdocVisitor { let name = match am.find(&id) { Some(m) => match m { &ast_map::node_item(ref it, _) => Some(it.ident), - _ => fail!("mod id mapped to non-item in the ast map") + _ => fail2!("mod id mapped to non-item in the ast map") }, None => None }; @@ -113,7 +113,7 @@ impl RustdocVisitor { } fn visit_item(item: &ast::item, om: &mut Module) { - debug!("Visiting item %?", item); + debug2!("Visiting item {:?}", item); match item.node { ast::item_mod(ref m) => { om.mods.push(visit_mod_contents(item.span, item.attrs.clone(), From da24c0d32f8a5ce74268f416bbdab2e61a34976d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Sep 2013 23:37:25 -0700 Subject: [PATCH 08/16] rustpkg: Remove uses of fmt! --- src/librustpkg/api.rs | 2 +- src/librustpkg/context.rs | 6 +- src/librustpkg/installed_packages.rs | 10 +- src/librustpkg/package_id.rs | 14 +- src/librustpkg/package_source.rs | 68 ++++----- src/librustpkg/path_util.rs | 70 ++++----- src/librustpkg/rustpkg.rs | 89 ++++++------ src/librustpkg/search.rs | 3 +- src/librustpkg/source_control.rs | 33 ++--- src/librustpkg/tests.rs | 205 ++++++++++++++------------- src/librustpkg/util.rs | 76 +++++----- src/librustpkg/version.rs | 28 ++-- src/librustpkg/workcache_support.rs | 10 +- src/librustpkg/workspace.rs | 4 +- 14 files changed, 313 insertions(+), 305 deletions(-) diff --git a/src/librustpkg/api.rs b/src/librustpkg/api.rs index 4f6848525c9ac..de673972932d3 100644 --- a/src/librustpkg/api.rs +++ b/src/librustpkg/api.rs @@ -52,7 +52,7 @@ fn binary_is_fresh(path: &str, in_hash: &str) -> bool { pub fn new_workcache_context(p: &Path) -> workcache::Context { let db_file = p.push("rustpkg_db.json"); // ??? probably wrong - debug!("Workcache database file: %s", db_file.to_str()); + debug2!("Workcache database file: {}", db_file.to_str()); let db = RWArc::new(Database::new(db_file)); let lg = RWArc::new(Logger::new()); let cfg = Arc::new(TreeMap::new()); diff --git a/src/librustpkg/context.rs b/src/librustpkg/context.rs index 1b1f3f14214fd..b7a295f00707a 100644 --- a/src/librustpkg/context.rs +++ b/src/librustpkg/context.rs @@ -150,7 +150,7 @@ impl Context { /// rustpkg from a Rust target directory. This is part of a /// kludgy hack used to adjust the sysroot. pub fn in_target(sysroot: &Path) -> bool { - debug!("Checking whether %s is in target", sysroot.to_str()); + debug2!("Checking whether {} is in target", sysroot.to_str()); os::path_is_dir(&sysroot.pop().pop().push("rustc")) } @@ -214,8 +214,8 @@ pub fn flags_ok_for_cmd(flags: &RustcFlags, cfgs: &[~str], cmd: &str, user_supplied_opt_level: bool) -> bool { let complain = |s| { - io::println(fmt!("The %s option can only be used with the build command: - rustpkg [options..] build %s [package-ID]", s, s)); + println!("The {} option can only be used with the build command: + rustpkg [options..] build {} [package-ID]", s, s); }; if flags.linker.is_some() && cmd != "build" && cmd != "install" { diff --git a/src/librustpkg/installed_packages.rs b/src/librustpkg/installed_packages.rs index 984527eb56a0e..a3b807d1fc5b3 100644 --- a/src/librustpkg/installed_packages.rs +++ b/src/librustpkg/installed_packages.rs @@ -28,15 +28,15 @@ pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool { let libfiles = os::list_dir(&p.push("lib")); for lib in libfiles.iter() { let lib = Path(*lib); - debug!("Full name: %s", lib.to_str()); + debug2!("Full name: {}", lib.to_str()); match has_library(&lib) { Some(basename) => { - debug!("parent = %s, child = %s", - p.push("lib").to_str(), lib.to_str()); + debug2!("parent = {}, child = {}", + p.push("lib").to_str(), lib.to_str()); let rel_p = p.push("lib/").get_relative_to(&lib); - debug!("Rel: %s", rel_p.to_str()); + debug2!("Rel: {}", rel_p.to_str()); let rel_path = rel_p.push(basename).to_str(); - debug!("Rel name: %s", rel_path); + debug2!("Rel name: {}", rel_path); f(&PkgId::new(rel_path)); } None => () diff --git a/src/librustpkg/package_id.rs b/src/librustpkg/package_id.rs index 52b986cb6e7e6..68cfa3220f228 100644 --- a/src/librustpkg/package_id.rs +++ b/src/librustpkg/package_id.rs @@ -66,7 +66,7 @@ impl PkgId { if path.components.len() < 1 { return cond.raise((path, ~"0-length pkgid")); } - let short_name = path.filestem().expect(fmt!("Strange path! %s", s)); + let short_name = path.filestem().expect(format!("Strange path! {}", s)); let version = match given_version { Some(v) => v, @@ -87,13 +87,13 @@ impl PkgId { } pub fn hash(&self) -> ~str { - fmt!("%s-%s-%s", self.path.to_str(), - hash(self.path.to_str() + self.version.to_str()), - self.version.to_str()) + format!("{}-{}-{}", self.path.to_str(), + hash(self.path.to_str() + self.version.to_str()), + self.version.to_str()) } pub fn short_name_with_version(&self) -> ~str { - fmt!("%s%s", self.short_name, self.version.to_str()) + format!("{}{}", self.short_name, self.version.to_str()) } /// True if the ID has multiple components @@ -112,7 +112,7 @@ impl PkgId { // binaries for this package (as opposed to the built ones, // which are per-crate). pub fn install_tag(&self) -> ~str { - fmt!("install(%s)", self.to_str()) + format!("install({})", self.to_str()) } } @@ -139,7 +139,7 @@ impl Iterator<(Path, Path)> for Prefixes { impl ToStr for PkgId { fn to_str(&self) -> ~str { // should probably use the filestem and not the whole path - fmt!("%s-%s", self.path.to_str(), self.version.to_str()) + format!("{}-{}", self.path.to_str(), self.version.to_str()) } } diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs index 006a58e042f8c..d7e755b89754f 100644 --- a/src/librustpkg/package_source.rs +++ b/src/librustpkg/package_source.rs @@ -43,9 +43,9 @@ pub struct PkgSrc { impl ToStr for PkgSrc { fn to_str(&self) -> ~str { - fmt!("Package ID %s in start dir %s [workspace = %s]", - self.id.to_str(), - self.start_dir.to_str(), self.workspace.to_str()) + format!("Package ID {} in start dir {} [workspace = {}]", + self.id.to_str(), + self.start_dir.to_str(), self.workspace.to_str()) } } condition! { @@ -58,21 +58,21 @@ impl PkgSrc { pub fn new(workspace: Path, use_rust_path_hack: bool, id: PkgId) -> PkgSrc { use conditions::nonexistent_package::cond; - debug!("Checking package source for package ID %s, \ - workspace = %s use_rust_path_hack = %?", + debug2!("Checking package source for package ID {}, \ + workspace = {} use_rust_path_hack = {:?}", id.to_str(), workspace.to_str(), use_rust_path_hack); let mut to_try = ~[]; if use_rust_path_hack { to_try.push(workspace.clone()); } else { - let result = workspace.push("src").push_rel(&id.path.pop()).push(fmt!("%s-%s", + let result = workspace.push("src").push_rel(&id.path.pop()).push(format!("{}-{}", id.short_name, id.version.to_str())); to_try.push(result); to_try.push(workspace.push("src").push_rel(&id.path)); } - debug!("Checking dirs: %?", to_try.map(|s| s.to_str()).connect(":")); + debug2!("Checking dirs: {:?}", to_try.map(|s| s.to_str()).connect(":")); let path = to_try.iter().find(|&d| os::path_exists(d)); @@ -84,13 +84,13 @@ impl PkgSrc { for (prefix, suffix) in id.prefixes_iter() { let package_id = PkgId::new(prefix.to_str()); let path = workspace.push("src").push_rel(&package_id.path); - debug!("in loop: checking if %s is a directory", path.to_str()); + debug2!("in loop: checking if {} is a directory", path.to_str()); if os::path_is_dir(&path) { let ps = PkgSrc::new(workspace.clone(), use_rust_path_hack, PkgId::new(prefix.to_str())); - debug!("pkgsrc: Returning [%s|%s|%s]", workspace.to_str(), - ps.start_dir.push_rel(&suffix).to_str(), ps.id.to_str()); + debug2!("pkgsrc: Returning [{}|{}|{}]", workspace.to_str(), + ps.start_dir.push_rel(&suffix).to_str(), ps.id.to_str()); return PkgSrc { workspace: workspace, @@ -108,7 +108,7 @@ impl PkgSrc { // Ok, no prefixes work, so try fetching from git let mut ok_d = None; for w in to_try.iter() { - debug!("Calling fetch_git on %s", w.to_str()); + debug2!("Calling fetch_git on {}", w.to_str()); let gf = PkgSrc::fetch_git(w, &id); for p in gf.iter() { ok_d = Some(p.clone()); @@ -138,14 +138,14 @@ impl PkgSrc { } } }; - debug!("For package id %s, returning %s", id.to_str(), dir.to_str()); + debug2!("For package id {}, returning {}", id.to_str(), dir.to_str()); if !os::path_is_dir(&dir) { cond.raise((id.clone(), ~"supplied path for package dir is a \ non-directory")); } - debug!("pkgsrc: Returning {%s|%s|%s}", workspace.to_str(), + debug2!("pkgsrc: Returning \\{{}|{}|{}\\}", workspace.to_str(), dir.to_str(), id.to_str()); PkgSrc { @@ -176,13 +176,13 @@ impl PkgSrc { None => cond.raise(~"Failed to create temporary directory for fetching git sources") }; - debug!("Checking whether %s (path = %s) exists locally. Cwd = %s, does it? %?", + debug2!("Checking whether {} (path = {}) exists locally. Cwd = {}, does it? {:?}", pkgid.to_str(), pkgid.path.to_str(), os::getcwd().to_str(), os::path_exists(&pkgid.path)); if os::path_exists(&pkgid.path) { - debug!("%s exists locally! Cloning it into %s", + debug2!("{} exists locally! Cloning it into {}", pkgid.path.to_str(), local.to_str()); // Ok to use local here; we know it will succeed git_clone(&pkgid.path, local, &pkgid.version); @@ -194,8 +194,8 @@ impl PkgSrc { return None; } - let url = fmt!("https://%s", pkgid.path.to_str()); - debug!("Fetching package: git clone %s %s [version=%s]", + let url = format!("https://{}", pkgid.path.to_str()); + debug2!("Fetching package: git clone {} {} [version={}]", url, clone_target.to_str(), pkgid.version.to_str()); if git_clone_general(url, &clone_target, &pkgid.version) { @@ -219,7 +219,7 @@ impl PkgSrc { // return the path for it. Otherwise, None pub fn package_script_option(&self) -> Option { let maybe_path = self.start_dir.push("pkg.rs"); - debug!("package_script_option: checking whether %s exists", maybe_path.to_str()); + debug2!("package_script_option: checking whether {} exists", maybe_path.to_str()); if os::path_exists(&maybe_path) { Some(maybe_path) } @@ -239,7 +239,7 @@ impl PkgSrc { for c in p.components.slice(prefix, p.components.len()).iter() { sub = sub.push(*c); } - debug!("Will compile crate %s", sub.to_str()); + debug2!("Will compile crate {}", sub.to_str()); cs.push(Crate::new(&sub)); } @@ -253,7 +253,7 @@ impl PkgSrc { use conditions::missing_pkg_files::cond; let prefix = self.start_dir.components.len(); - debug!("Matching against %s", self.id.short_name); + debug2!("Matching against {}", self.id.short_name); do os::walk_dir(&self.start_dir) |pth| { let maybe_known_crate_set = match pth.filename() { Some(filename) if filter(filename) => match filename { @@ -282,7 +282,7 @@ impl PkgSrc { cond.raise(self.id.clone()); } - debug!("In %s, found %u libs, %u mains, %u tests, %u benchs", + debug2!("In {}, found {} libs, {} mains, {} tests, {} benchs", self.start_dir.to_str(), self.libs.len(), self.mains.len(), @@ -298,12 +298,12 @@ impl PkgSrc { what: OutputType) { for crate in crates.iter() { let path = self.start_dir.push_rel(&crate.file).normalize(); - debug!("build_crates: compiling %s", path.to_str()); + debug2!("build_crates: compiling {}", path.to_str()); let path_str = path.to_str(); let cfgs = crate.cfgs + cfgs; do ctx.workcache_context.with_prep(crate_tag(&path)) |prep| { - debug!("Building crate %s, declaring it as an input", path.to_str()); + debug2!("Building crate {}, declaring it as an input", path.to_str()); prep.declare_input("file", path.to_str(), workcache_support::digest_file_with_date(&path)); let subpath = path.clone(); @@ -323,7 +323,7 @@ impl PkgSrc { subcfgs, false, what).to_str(); - debug!("Result of compiling %s was %s", subpath_str, result); + debug2!("Result of compiling {} was {}", subpath_str, result); result } }; @@ -335,11 +335,11 @@ impl PkgSrc { pub fn declare_inputs(&self, prep: &mut workcache::Prep) { let to_do = ~[self.libs.clone(), self.mains.clone(), self.tests.clone(), self.benchs.clone()]; - debug!("In declare inputs, self = %s", self.to_str()); + debug2!("In declare inputs, self = {}", self.to_str()); for cs in to_do.iter() { for c in cs.iter() { let path = self.start_dir.push_rel(&c.file).normalize(); - debug!("Declaring input: %s", path.to_str()); + debug2!("Declaring input: {}", path.to_str()); prep.declare_input("file", path.to_str(), workcache_support::digest_file_with_date(&path.clone())); @@ -357,17 +357,17 @@ impl PkgSrc { // Determine the destination workspace (which depends on whether // we're using the rust_path_hack) let destination_workspace = if is_workspace(&self.workspace) { - debug!("%s is indeed a workspace", self.workspace.to_str()); + debug2!("{} is indeed a workspace", self.workspace.to_str()); self.workspace.clone() } else { // It would be nice to have only one place in the code that checks // for the use_rust_path_hack flag... if build_context.context.use_rust_path_hack { let rs = default_workspace(); - debug!("Using hack: %s", rs.to_str()); + debug2!("Using hack: {}", rs.to_str()); rs } else { - cond.raise(fmt!("Package root %s is not a workspace; pass in --rust_path_hack \ + cond.raise(format!("Package root {} is not a workspace; pass in --rust_path_hack \ if you want to treat it as a package source", self.workspace.to_str())) } @@ -377,14 +377,14 @@ impl PkgSrc { let mains = self.mains.clone(); let tests = self.tests.clone(); let benchs = self.benchs.clone(); - debug!("Building libs in %s, destination = %s", + debug2!("Building libs in {}, destination = {}", destination_workspace.to_str(), destination_workspace.to_str()); self.build_crates(build_context, &destination_workspace, libs, cfgs, Lib); - debug!("Building mains"); + debug2!("Building mains"); self.build_crates(build_context, &destination_workspace, mains, cfgs, Main); - debug!("Building tests"); + debug2!("Building tests"); self.build_crates(build_context, &destination_workspace, tests, cfgs, Test); - debug!("Building benches"); + debug2!("Building benches"); self.build_crates(build_context, &destination_workspace, benchs, cfgs, Bench); destination_workspace.to_str() } @@ -394,7 +394,7 @@ impl PkgSrc { let crate_sets = [&self.libs, &self.mains, &self.tests, &self.benchs]; for crate_set in crate_sets.iter() { for c in crate_set.iter() { - debug!("Built crate: %s", c.file.to_str()) + debug2!("Built crate: {}", c.file.to_str()) } } } diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs index 7061345341f9c..9a440cb5f8ff0 100644 --- a/src/librustpkg/path_util.rs +++ b/src/librustpkg/path_util.rs @@ -24,7 +24,7 @@ use messages::*; pub fn default_workspace() -> Path { let p = rust_path(); if p.is_empty() { - fail!("Empty RUST_PATH"); + fail2!("Empty RUST_PATH"); } let result = p[0]; if !os::path_is_dir(&result) { @@ -88,9 +88,9 @@ pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path, }; if found.is_some() { - debug!("Found %s in %s", pkgid.to_str(), workspace.to_str()); + debug2!("Found {} in {}", pkgid.to_str(), workspace.to_str()); } else { - debug!("Didn't find %s in %s", pkgid.to_str(), workspace.to_str()); + debug2!("Didn't find {} in {}", pkgid.to_str(), workspace.to_str()); } found } @@ -119,13 +119,13 @@ fn target_bin_dir(workspace: &Path) -> Path { pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option { let mut result = target_build_dir(workspace); result = mk_output_path(Main, Build, pkgid, result); - debug!("built_executable_in_workspace: checking whether %s exists", + debug2!("built_executable_in_workspace: checking whether {} exists", result.to_str()); if os::path_exists(&result) { Some(result) } else { - debug!("built_executable_in_workspace: %s does not exist", result.to_str()); + debug2!("built_executable_in_workspace: {} does not exist", result.to_str()); None } } @@ -146,13 +146,13 @@ fn output_in_workspace(pkgid: &PkgId, workspace: &Path, what: OutputType) -> Opt let mut result = target_build_dir(workspace); // should use a target-specific subdirectory result = mk_output_path(what, Build, pkgid, result); - debug!("output_in_workspace: checking whether %s exists", + debug2!("output_in_workspace: checking whether {} exists", result.to_str()); if os::path_exists(&result) { Some(result) } else { - error!(fmt!("output_in_workspace: %s does not exist", result.to_str())); + error2!("output_in_workspace: {} does not exist", result.to_str()); None } } @@ -181,14 +181,14 @@ pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Opti /// `short_name` is taken as the link name of the library. pub fn library_in_workspace(path: &Path, short_name: &str, where: Target, workspace: &Path, prefix: &str, version: &Version) -> Option { - debug!("library_in_workspace: checking whether a library named %s exists", + debug2!("library_in_workspace: checking whether a library named {} exists", short_name); // We don't know what the hash is, so we have to search through the directory // contents - debug!("short_name = %s where = %? workspace = %s \ - prefix = %s", short_name, where, workspace.to_str(), prefix); + debug2!("short_name = {} where = {:?} workspace = {} \ + prefix = {}", short_name, where, workspace.to_str(), prefix); let dir_to_search = match where { Build => target_build_dir(workspace).push_rel(path), @@ -204,14 +204,14 @@ pub fn system_library(sysroot: &Path, lib_name: &str) -> Option { } fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option { - debug!("Listing directory %s", dir_to_search.to_str()); + debug2!("Listing directory {}", dir_to_search.to_str()); let dir_contents = os::list_dir(dir_to_search); - debug!("dir has %? entries", dir_contents.len()); + debug2!("dir has {:?} entries", dir_contents.len()); - let lib_prefix = fmt!("%s%s", os::consts::DLL_PREFIX, short_name); + let lib_prefix = format!("{}{}", os::consts::DLL_PREFIX, short_name); let lib_filetype = os::consts::DLL_SUFFIX; - debug!("lib_prefix = %s and lib_filetype = %s", lib_prefix, lib_filetype); + debug2!("lib_prefix = {} and lib_filetype = {}", lib_prefix, lib_filetype); // Find a filename that matches the pattern: // (lib_prefix)-hash-(version)(lib_suffix) @@ -221,7 +221,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti let mut libraries = do paths.filter |p| { let extension = p.filetype(); - debug!("p = %s, p's extension is %?", p.to_str(), extension); + debug2!("p = {}, p's extension is {:?}", p.to_str(), extension); match extension { None => false, Some(ref s) => lib_filetype == *s @@ -242,12 +242,12 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti if f_name.is_empty() { break; } match f_name.rfind('-') { Some(i) => { - debug!("Maybe %s is a version", f_name.slice(i + 1, f_name.len())); + debug2!("Maybe {} is a version", f_name.slice(i + 1, f_name.len())); match try_parsing_version(f_name.slice(i + 1, f_name.len())) { Some(ref found_vers) if version == found_vers => { match f_name.slice(0, i).rfind('-') { Some(j) => { - debug!("Maybe %s equals %s", f_name.slice(0, j), lib_prefix); + debug2!("Maybe {} equals {}", f_name.slice(0, j), lib_prefix); if f_name.slice(0, j) == lib_prefix { result_filename = Some(p_path.clone()); } @@ -265,7 +265,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti } // for if result_filename.is_none() { - debug!("warning: library_in_workspace didn't find a library in %s for %s", + debug2!("warning: library_in_workspace didn't find a library in {} for {}", dir_to_search.to_str(), short_name); } @@ -273,7 +273,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti // (if result_filename != None) let abs_path = do result_filename.map |result_filename| { let absolute_path = dir_to_search.push_rel(result_filename); - debug!("result_filename = %s", absolute_path.to_str()); + debug2!("result_filename = {}", absolute_path.to_str()); absolute_path }; @@ -295,8 +295,8 @@ pub fn target_library_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path { use conditions::bad_path::cond; if !os::path_is_dir(workspace) { cond.raise(((*workspace).clone(), - fmt!("Workspace supplied to target_library_in_workspace \ - is not a directory! %s", workspace.to_str()))); + format!("Workspace supplied to target_library_in_workspace \ + is not a directory! {}", workspace.to_str()))); } target_file_in_workspace(pkgid, workspace, Lib, Install) } @@ -333,8 +333,8 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path, (Install, _) => target_bin_dir(workspace) }; if !os::path_exists(&result) && !mkdir_recursive(&result, U_RWX) { - cond.raise((result.clone(), fmt!("target_file_in_workspace couldn't \ - create the %s dir (pkgid=%s, workspace=%s, what=%?, where=%?", + cond.raise((result.clone(), format!("target_file_in_workspace couldn't \ + create the {} dir (pkgid={}, workspace={}, what={:?}, where={:?}", subdir, pkgid.to_str(), workspace.to_str(), what, where))); } mk_output_path(what, where, pkgid, result) @@ -347,13 +347,13 @@ pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path { let mut result = target_build_dir(workspace); result = result.push_rel(&pkgid.path); - debug!("Creating build dir %s for package id %s", result.to_str(), + debug2!("Creating build dir {} for package id {}", result.to_str(), pkgid.to_str()); if os::path_exists(&result) || os::mkdir_recursive(&result, U_RWX) { result } else { - cond.raise((result, fmt!("Could not create directory for package %s", pkgid.to_str()))) + cond.raise((result, format!("Could not create directory for package {}", pkgid.to_str()))) } } @@ -361,8 +361,8 @@ pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path { /// given whether we're building a library and whether we're building tests pub fn mk_output_path(what: OutputType, where: Target, pkg_id: &PkgId, workspace: Path) -> Path { - let short_name_with_version = fmt!("%s-%s", pkg_id.short_name, - pkg_id.version.to_str()); + let short_name_with_version = format!("{}-{}", pkg_id.short_name, + pkg_id.version.to_str()); // Not local_path.dir_path()! For package foo/bar/blat/, we want // the executable blat-0.5 to live under blat/ let dir = match where { @@ -371,14 +371,14 @@ pub fn mk_output_path(what: OutputType, where: Target, // and if we're just building, it goes in a package-specific subdir Build => workspace.push_rel(&pkg_id.path) }; - debug!("[%?:%?] mk_output_path: short_name = %s, path = %s", what, where, + debug2!("[{:?}:{:?}] mk_output_path: short_name = {}, path = {}", what, where, if what == Lib { short_name_with_version.clone() } else { pkg_id.short_name.clone() }, dir.to_str()); let mut output_path = match what { // this code is duplicated from elsewhere; fix this Lib => dir.push(os::dll_filename(short_name_with_version)), // executable names *aren't* versioned - _ => dir.push(fmt!("%s%s%s", pkg_id.short_name, + _ => dir.push(format!("{}{}{}", pkg_id.short_name, match what { Test => "test", Bench => "bench", @@ -389,7 +389,7 @@ pub fn mk_output_path(what: OutputType, where: Target, if !output_path.is_absolute() { output_path = os::getcwd().push_rel(&output_path).normalize(); } - debug!("mk_output_path: returning %s", output_path.to_str()); + debug2!("mk_output_path: returning {}", output_path.to_str()); output_path } @@ -407,7 +407,7 @@ pub fn uninstall_package_from(workspace: &Path, pkgid: &PkgId) { did_something = true; } if !did_something { - warn(fmt!("Warning: there don't seem to be any files for %s installed in %s", + warn(format!("Warning: there don't seem to be any files for {} installed in {}", pkgid.to_str(), workspace.to_str())); } @@ -425,14 +425,14 @@ pub fn find_dir_using_rust_path_hack(p: &PkgId) -> Option { // Note that this only matches if the package ID being searched for // has a name that's a single component if dir.is_parent_of(&p.path) || dir.is_parent_of(&versionize(&p.path, &p.version)) { - debug!("In find_dir_using_rust_path_hack: checking dir %s", dir.to_str()); + debug2!("In find_dir_using_rust_path_hack: checking dir {}", dir.to_str()); if dir_has_file(dir, "lib.rs") || dir_has_file(dir, "main.rs") || dir_has_file(dir, "test.rs") || dir_has_file(dir, "bench.rs") { - debug!("Did find id %s in dir %s", p.to_str(), dir.to_str()); + debug2!("Did find id {} in dir {}", p.to_str(), dir.to_str()); return Some(dir.clone()); } } - debug!("Didn't find id %s in dir %s", p.to_str(), dir.to_str()) + debug2!("Didn't find id {} in dir {}", p.to_str(), dir.to_str()) } None } @@ -449,7 +449,7 @@ pub fn user_set_rust_path() -> bool { /// Append the version string onto the end of the path's filename fn versionize(p: &Path, v: &Version) -> Path { let q = p.file_path().to_str(); - p.with_filename(fmt!("%s-%s", q, v.to_str())) + p.with_filename(format!("{}-{}", q, v.to_str())) } diff --git a/src/librustpkg/rustpkg.rs b/src/librustpkg/rustpkg.rs index 2945b75128e43..1ece56df60a3e 100644 --- a/src/librustpkg/rustpkg.rs +++ b/src/librustpkg/rustpkg.rs @@ -102,7 +102,7 @@ impl<'self> PkgScript<'self> { let binary = os::args()[0].to_managed(); // Build the rustc session data structures to pass // to the compiler - debug!("pkgscript parse: %s", sysroot.to_str()); + debug2!("pkgscript parse: {}", sysroot.to_str()); let options = @session::options { binary: binary, maybe_sysroot: Some(sysroot), @@ -118,7 +118,7 @@ impl<'self> PkgScript<'self> { let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate); let work_dir = build_pkg_id_in_workspace(id, workspace); - debug!("Returning package script with id %s", id.to_str()); + debug2!("Returning package script with id {}", id.to_str()); PkgScript { id: id, @@ -138,10 +138,10 @@ impl<'self> PkgScript<'self> { sysroot: &Path) -> (~[~str], ExitCode) { let sess = self.sess; - debug!("Working directory = %s", self.build_dir.to_str()); + debug2!("Working directory = {}", self.build_dir.to_str()); // Collect together any user-defined commands in the package script let crate = util::ready_crate(sess, self.crate.take_unwrap()); - debug!("Building output filenames with script name %s", + debug2!("Building output filenames with script name {}", driver::source_name(&driver::file_input(self.input.clone()))); let exe = self.build_dir.push(~"pkg" + util::exe_suffix()); util::compile_crate_from_input(&self.input, @@ -150,7 +150,7 @@ impl<'self> PkgScript<'self> { &self.build_dir, sess, crate); - debug!("Running program: %s %s %s", exe.to_str(), + debug2!("Running program: {} {} {}", exe.to_str(), sysroot.to_str(), "install"); // Discover the output exec.discover_output("binary", exe.to_str(), digest_only_date(&exe)); @@ -160,7 +160,7 @@ impl<'self> PkgScript<'self> { return (~[], status); } else { - debug!("Running program (configs): %s %s %s", + debug2!("Running program (configs): {} {} {}", exe.to_str(), sysroot.to_str(), "configs"); let output = run::process_output(exe.to_str(), [sysroot.to_str(), ~"configs"]); // Run the configs() function to get the configs @@ -223,7 +223,7 @@ impl CtxMethods for BuildContext { let pkgid = PkgId::new(args[0].clone()); let mut dest_ws = None; do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| { - debug!("found pkg %s in workspace %s, trying to build", + debug2!("found pkg {} in workspace {}, trying to build", pkgid.to_str(), workspace.to_str()); let mut pkg_src = PkgSrc::new(workspace.clone(), false, pkgid.clone()); dest_ws = Some(self.build(&mut pkg_src, what)); @@ -290,7 +290,7 @@ impl CtxMethods for BuildContext { // argument let pkgid = PkgId::new(args[0]); let workspaces = pkg_parent_workspaces(&self.context, &pkgid); - debug!("package ID = %s, found it in %? workspaces", + debug2!("package ID = {}, found it in {:?} workspaces", pkgid.to_str(), workspaces.len()); if workspaces.is_empty() { let rp = rust_path(); @@ -349,7 +349,8 @@ impl CtxMethods for BuildContext { let pkgid = PkgId::new(args[0]); if !installed_packages::package_is_installed(&pkgid) { - warn(fmt!("Package %s doesn't seem to be installed! Doing nothing.", args[0])); + warn(format!("Package {} doesn't seem to be installed! \ + Doing nothing.", args[0])); return; } else { @@ -357,7 +358,7 @@ impl CtxMethods for BuildContext { assert!(!rp.is_empty()); do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| { path_util::uninstall_package_from(workspace, &pkgid); - note(fmt!("Uninstalled package %s (was installed in %s)", + note(format!("Uninstalled package {} (was installed in {})", pkgid.to_str(), workspace.to_str())); true }; @@ -370,13 +371,13 @@ impl CtxMethods for BuildContext { self.unprefer(args[0], None); } - _ => fail!(fmt!("I don't know the command `%s`", cmd)) + _ => fail2!("I don't know the command `{}`", cmd) } } fn do_cmd(&self, _cmd: &str, _pkgname: &str) { // stub - fail!("`do` not yet implemented"); + fail2!("`do` not yet implemented"); } /// Returns the destination workspace @@ -387,8 +388,8 @@ impl CtxMethods for BuildContext { let workspace = pkg_src.workspace.clone(); let pkgid = pkg_src.id.clone(); - debug!("build: workspace = %s (in Rust path? %? is git dir? %? \ - pkgid = %s pkgsrc start_dir = %s", workspace.to_str(), + debug2!("build: workspace = {} (in Rust path? {:?} is git dir? {:?} \ + pkgid = {} pkgsrc start_dir = {}", workspace.to_str(), in_rust_path(&workspace), is_git_dir(&workspace.push_rel(&pkgid.path)), pkgid.to_str(), pkg_src.start_dir.to_str()); @@ -399,16 +400,16 @@ impl CtxMethods for BuildContext { source_control::git_clone(&workspace.push_rel(&pkgid.path), &out_dir, &pkgid.version); let default_ws = default_workspace(); - debug!("Calling build recursively with %? and %?", default_ws.to_str(), + debug2!("Calling build recursively with {:?} and {:?}", default_ws.to_str(), pkgid.to_str()); return self.build(&mut PkgSrc::new(default_ws, false, pkgid.clone()), what_to_build); } // Is there custom build logic? If so, use it let mut custom = false; - debug!("Package source directory = %s", pkg_src.to_str()); + debug2!("Package source directory = {}", pkg_src.to_str()); let opt = pkg_src.package_script_option(); - debug!("Calling pkg_script_option on %?", opt); + debug2!("Calling pkg_script_option on {:?}", opt); let cfgs = match pkg_src.package_script_option() { Some(package_script_path) => { let sysroot = self.sysroot_to_use(); @@ -428,16 +429,16 @@ impl CtxMethods for BuildContext { pscript.run_custom(exec, &sub_sysroot) } }; - debug!("Command return code = %?", hook_result); + debug2!("Command return code = {:?}", hook_result); if hook_result != 0 { - fail!("Error running custom build command") + fail2!("Error running custom build command") } custom = true; // otherwise, the package script succeeded cfgs } None => { - debug!("No package script, continuing"); + debug2!("No package script, continuing"); ~[] } } + self.context.cfgs; @@ -454,7 +455,7 @@ impl CtxMethods for BuildContext { &JustOne(ref p) => { // We expect that p is relative to the package source's start directory, // so check that assumption - debug!("JustOne: p = %s", p.to_str()); + debug2!("JustOne: p = {}", p.to_str()); assert!(os::path_exists(&pkg_src.start_dir.push_rel(p))); if is_lib(p) { PkgSrc::push_crate(&mut pkg_src.libs, 0, p); @@ -465,7 +466,7 @@ impl CtxMethods for BuildContext { } else if is_bench(p) { PkgSrc::push_crate(&mut pkg_src.benchs, 0, p); } else { - warn(fmt!("Not building any crates for dependency %s", p.to_str())); + warn(format!("Not building any crates for dependency {}", p.to_str())); return workspace.clone(); } } @@ -486,19 +487,19 @@ impl CtxMethods for BuildContext { // Do something reasonable for now let dir = build_pkg_id_in_workspace(id, workspace); - note(fmt!("Cleaning package %s (removing directory %s)", + note(format!("Cleaning package {} (removing directory {})", id.to_str(), dir.to_str())); if os::path_exists(&dir) { os::remove_dir_recursive(&dir); - note(fmt!("Removed directory %s", dir.to_str())); + note(format!("Removed directory {}", dir.to_str())); } - note(fmt!("Cleaned package %s", id.to_str())); + note(format!("Cleaned package {}", id.to_str())); } fn info(&self) { // stub - fail!("info not yet implemented"); + fail2!("info not yet implemented"); } fn install(&self, mut pkg_src: PkgSrc, what: &WhatToBuild) -> (~[Path], ~[(~str, ~str)]) { @@ -514,11 +515,11 @@ impl CtxMethods for BuildContext { let to_do = ~[pkg_src.libs.clone(), pkg_src.mains.clone(), pkg_src.tests.clone(), pkg_src.benchs.clone()]; - debug!("In declare inputs for %s", id.to_str()); + debug2!("In declare inputs for {}", id.to_str()); for cs in to_do.iter() { for c in cs.iter() { let path = pkg_src.start_dir.push_rel(&c.file).normalize(); - debug!("Recording input: %s", path.to_str()); + debug2!("Recording input: {}", path.to_str()); installed_files.push(path); } } @@ -532,15 +533,15 @@ impl CtxMethods for BuildContext { else { Path(destination_workspace) }; - debug!("install: destination workspace = %s, id = %s, installing to %s", + debug2!("install: destination workspace = {}, id = {}, installing to {}", destination_workspace, id.to_str(), actual_workspace.to_str()); let result = self.install_no_build(&Path(destination_workspace), &actual_workspace, &id).map(|s| Path(*s)); - debug!("install: id = %s, about to call discover_outputs, %?", + debug2!("install: id = {}, about to call discover_outputs, {:?}", id.to_str(), result.to_str()); installed_files = installed_files + result; - note(fmt!("Installed package %s to %s", id.to_str(), actual_workspace.to_str())); + note(format!("Installed package {} to {}", id.to_str(), actual_workspace.to_str())); (installed_files, inputs) } @@ -557,8 +558,8 @@ impl CtxMethods for BuildContext { let target_exec = target_executable_in_workspace(id, target_workspace); let target_lib = maybe_library.map(|_p| target_library_in_workspace(id, target_workspace)); - debug!("target_exec = %s target_lib = %? \ - maybe_executable = %? maybe_library = %?", + debug2!("target_exec = {} target_lib = {:?} \ + maybe_executable = {:?} maybe_library = {:?}", target_exec.to_str(), target_lib, maybe_executable, maybe_library); @@ -582,7 +583,7 @@ impl CtxMethods for BuildContext { let mut outputs = ~[]; for exec in subex.iter() { - debug!("Copying: %s -> %s", exec.to_str(), sub_target_ex.to_str()); + debug2!("Copying: {} -> {}", exec.to_str(), sub_target_ex.to_str()); if !(os::mkdir_recursive(&sub_target_ex.dir_path(), U_RWX) && os::copy_file(exec, &sub_target_ex)) { cond.raise(((*exec).clone(), sub_target_ex.clone())); @@ -594,11 +595,11 @@ impl CtxMethods for BuildContext { } for lib in sublib.iter() { let target_lib = sub_target_lib - .clone().expect(fmt!("I built %s but apparently \ + .clone().expect(format!("I built {} but apparently \ didn't install it!", lib.to_str())); let target_lib = target_lib .pop().push(lib.filename().expect("weird target lib")); - debug!("Copying: %s -> %s", lib.to_str(), sub_target_lib.to_str()); + debug2!("Copying: {} -> {}", lib.to_str(), sub_target_lib.to_str()); if !(os::mkdir_recursive(&target_lib.dir_path(), U_RWX) && os::copy_file(lib, &target_lib)) { cond.raise(((*lib).clone(), target_lib.clone())); @@ -614,18 +615,18 @@ impl CtxMethods for BuildContext { } fn prefer(&self, _id: &str, _vers: Option<~str>) { - fail!("prefer not yet implemented"); + fail2!("prefer not yet implemented"); } fn test(&self, pkgid: &PkgId, workspace: &Path) { match built_test_in_workspace(pkgid, workspace) { Some(test_exec) => { - debug!("test: test_exec = %s", test_exec.to_str()); + debug2!("test: test_exec = {}", test_exec.to_str()); let status = run::process_status(test_exec.to_str(), [~"--test"]); os::set_exit_status(status); } None => { - error(fmt!("Internal error: test executable for package ID %s in workspace %s \ + error(format!("Internal error: test executable for package ID {} in workspace {} \ wasn't built! Please report this as a bug.", pkgid.to_str(), workspace.to_str())); } @@ -640,11 +641,11 @@ impl CtxMethods for BuildContext { } fn uninstall(&self, _id: &str, _vers: Option<~str>) { - fail!("uninstall not yet implemented"); + fail2!("uninstall not yet implemented"); } fn unprefer(&self, _id: &str, _vers: Option<~str>) { - fail!("unprefer not yet implemented"); + fail2!("unprefer not yet implemented"); } } @@ -677,7 +678,7 @@ pub fn main_args(args: &[~str]) -> int { let matches = &match getopts::getopts(args, opts) { result::Ok(m) => m, result::Err(f) => { - error(fmt!("%s", f.to_err_msg())); + error(format!("{}", f.to_err_msg())); return 1; } @@ -812,8 +813,8 @@ pub fn main_args(args: &[~str]) -> int { _ => filesearch::get_or_default_sysroot() }; - debug!("Using sysroot: %s", sroot.to_str()); - debug!("Will store workcache in %s", default_workspace().to_str()); + debug2!("Using sysroot: {}", sroot.to_str()); + debug2!("Will store workcache in {}", default_workspace().to_str()); let rm_args = remaining_args.clone(); let sub_cmd = cmd.clone(); diff --git a/src/librustpkg/search.rs b/src/librustpkg/search.rs index 37976ea5c488d..f0042e1f8e2d7 100644 --- a/src/librustpkg/search.rs +++ b/src/librustpkg/search.rs @@ -17,7 +17,8 @@ use version::Version; /// FIXME #8711: This ignores the desired version. pub fn find_installed_library_in_rust_path(pkg_path: &Path, _version: &Version) -> Option { let rp = rust_path(); - debug!("find_installed_library_in_rust_path: looking for path %s", pkg_path.to_str()); + debug2!("find_installed_library_in_rust_path: looking for path {}", + pkg_path.to_str()); for p in rp.iter() { match installed_library_in_workspace(pkg_path, p) { Some(path) => return Some(path), diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs index 92b749f278739..3d03d89bc20ab 100644 --- a/src/librustpkg/source_control.rs +++ b/src/librustpkg/source_control.rs @@ -19,26 +19,26 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) { assert!(os::path_is_dir(source)); assert!(is_git_dir(source)); if !os::path_exists(target) { - debug!("Running: git clone %s %s", source.to_str(), target.to_str()); + debug2!("Running: git clone {} {}", source.to_str(), target.to_str()); let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]); if outp.status != 0 { io::println(str::from_utf8_owned(outp.output.clone())); io::println(str::from_utf8_owned(outp.error)); - fail!("Couldn't `git clone` %s", source.to_str()); + fail2!("Couldn't `git clone` {}", source.to_str()); } else { match v { &ExactRevision(ref s) => { - debug!("`Running: git --work-tree=%s --git-dir=%s checkout %s", + debug2!("`Running: git --work-tree={} --git-dir={} checkout {}", *s, target.to_str(), target.push(".git").to_str()); let outp = run::process_output("git", - [fmt!("--work-tree=%s", target.to_str()), - fmt!("--git-dir=%s", target.push(".git").to_str()), - ~"checkout", fmt!("%s", *s)]); + [format!("--work-tree={}", target.to_str()), + format!("--git-dir={}", target.push(".git").to_str()), + ~"checkout", format!("{}", *s)]); if outp.status != 0 { io::println(str::from_utf8_owned(outp.output.clone())); io::println(str::from_utf8_owned(outp.error)); - fail!("Couldn't `git checkout %s` in %s", + fail2!("Couldn't `git checkout {}` in {}", *s, target.to_str()); } } @@ -50,11 +50,12 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) { // Check that no version was specified. There's no reason to not handle the // case where a version was requested, but I haven't implemented it. assert!(*v == NoVersion); - debug!("Running: git --work-tree=%s --git-dir=%s pull --no-edit %s", + debug2!("Running: git --work-tree={} --git-dir={} pull --no-edit {}", target.to_str(), target.push(".git").to_str(), source.to_str()); - let outp = run::process_output("git", [fmt!("--work-tree=%s", target.to_str()), - fmt!("--git-dir=%s", target.push(".git").to_str()), - ~"pull", ~"--no-edit", source.to_str()]); + let args = [format!("--work-tree={}", target.to_str()), + format!("--git-dir={}", target.push(".git").to_str()), + ~"pull", ~"--no-edit", source.to_str()]; + let outp = run::process_output("git", args); assert!(outp.status == 0); } } @@ -64,18 +65,18 @@ pub fn git_clone(source: &Path, target: &Path, v: &Version) { pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool { let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]); if outp.status != 0 { - debug!(str::from_utf8_owned(outp.output.clone())); - debug!(str::from_utf8_owned(outp.error)); + debug2!("{}", str::from_utf8_owned(outp.output.clone())); + debug2!("{}", str::from_utf8_owned(outp.error)); false } else { match v { &ExactRevision(ref s) | &Tagged(ref s) => { - let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)], + let outp = process_output_in_cwd("git", [~"checkout", format!("{}", *s)], target); if outp.status != 0 { - debug!(str::from_utf8_owned(outp.output.clone())); - debug!(str::from_utf8_owned(outp.error)); + debug2!("{}", str::from_utf8_owned(outp.output.clone())); + debug2!("{}", str::from_utf8_owned(outp.error)); false } else { diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 604620d4ea456..5b56c312226c0 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -91,24 +91,24 @@ fn mk_empty_workspace(short_name: &Path, version: &Version, tag: &str) -> Path { fn mk_workspace(workspace: &Path, short_name: &Path, version: &Version) -> Path { // include version number in directory name - let package_dir = workspace.push_many([~"src", fmt!("%s-%s", - short_name.to_str(), version.to_str())]); + let package_dir = workspace.push_many([~"src", format!("{}-{}", + short_name.to_str(), version.to_str())]); assert!(os::mkdir_recursive(&package_dir, U_RWX)); package_dir } fn mk_temp_workspace(short_name: &Path, version: &Version) -> Path { let package_dir = mk_empty_workspace(short_name, - version, "temp_workspace").push_many([~"src", fmt!("%s-%s", + version, "temp_workspace").push_many([~"src", format!("{}-{}", short_name.to_str(), version.to_str())]); - debug!("Created %s and does it exist? %?", package_dir.to_str(), + debug2!("Created {} and does it exist? {:?}", package_dir.to_str(), os::path_is_dir(&package_dir)); // Create main, lib, test, and bench files - debug!("mk_workspace: creating %s", package_dir.to_str()); + debug2!("mk_workspace: creating {}", package_dir.to_str()); assert!(os::mkdir_recursive(&package_dir, U_RWX)); - debug!("Created %s and does it exist? %?", package_dir.to_str(), + debug2!("Created {} and does it exist? {:?}", package_dir.to_str(), os::path_is_dir(&package_dir)); // Create main, lib, test, and bench files @@ -134,7 +134,7 @@ fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &st }); let rslt = prog.finish_with_output(); if rslt.status != 0 { - fail!("%s [git returned %?, output = %s, error = %s]", err_msg, + fail2!("{} [git returned {:?}, output = {}, error = {}]", err_msg, rslt.status, str::from_utf8(rslt.output), str::from_utf8(rslt.error)); } } @@ -147,13 +147,13 @@ fn init_git_repo(p: &Path) -> Path { let work_dir = tmp.push_rel(p); let work_dir_for_opts = work_dir.clone(); assert!(os::mkdir_recursive(&work_dir, U_RWX)); - debug!("Running: git init in %s", work_dir.to_str()); + debug2!("Running: git init in {}", work_dir.to_str()); let ws = work_dir.to_str(); run_git([~"init"], None, &work_dir_for_opts, - fmt!("Couldn't initialize git repository in %s", ws)); + format!("Couldn't initialize git repository in {}", ws)); // Add stuff to the dir so that git tag succeeds writeFile(&work_dir.push("README"), ""); - run_git([~"add", ~"README"], None, &work_dir_for_opts, fmt!("Couldn't add in %s", ws)); + run_git([~"add", ~"README"], None, &work_dir_for_opts, format!("Couldn't add in {}", ws)); git_commit(&work_dir_for_opts, ~"whatever"); tmp } @@ -165,11 +165,11 @@ fn add_all_and_commit(repo: &Path) { fn git_commit(repo: &Path, msg: ~str) { run_git([~"commit", ~"--author=tester ", ~"-m", msg], - None, repo, fmt!("Couldn't commit in %s", repo.to_str())); + None, repo, format!("Couldn't commit in {}", repo.to_str())); } fn git_add_all(repo: &Path) { - run_git([~"add", ~"-A"], None, repo, fmt!("Couldn't add all files in %s", repo.to_str())); + run_git([~"add", ~"-A"], None, repo, format!("Couldn't add all files in {}", repo.to_str())); } fn add_git_tag(repo: &Path, tag: ~str) { @@ -177,7 +177,7 @@ fn add_git_tag(repo: &Path, tag: ~str) { git_add_all(repo); git_commit(repo, ~"whatever"); run_git([~"tag", tag.clone()], None, repo, - fmt!("Couldn't add git tag %s in %s", tag, repo.to_str())); + format!("Couldn't add git tag {} in {}", tag, repo.to_str())); } fn is_rwx(p: &Path) -> bool { @@ -214,7 +214,7 @@ fn rustpkg_exec() -> Path { second_try } else { - fail!("in rustpkg test, can't find an installed rustpkg"); + fail2!("in rustpkg test, can't find an installed rustpkg"); } } } @@ -222,7 +222,7 @@ fn rustpkg_exec() -> Path { fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput { match command_line_test_with_env(args, cwd, None) { Success(r) => r, - _ => fail!("Command line test failed") + _ => fail2!("Command line test failed") } } @@ -242,10 +242,10 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s -> ProcessResult { let cmd = rustpkg_exec().to_str(); let env_str = match env { - Some(ref pairs) => pairs.map(|&(ref k, ref v)| { fmt!("%s=%s", *k, *v) }).connect(","), + Some(ref pairs) => pairs.map(|&(ref k, ref v)| { format!("{}={}", *k, *v) }).connect(","), None => ~"" }; - debug!("%s cd %s; %s %s", env_str, cwd.to_str(), cmd, args.connect(" ")); + debug2!("{} cd {}; {} {}", env_str, cwd.to_str(), cmd, args.connect(" ")); assert!(os::path_is_dir(&*cwd)); let cwd = (*cwd).clone(); let mut prog = run::Process::new(cmd, args, run::ProcessOptions { @@ -256,7 +256,7 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s err_fd: None }); let output = prog.finish_with_output(); - debug!("Output from command %s with args %? was %s {%s}[%?]", + debug2!("Output from command {} with args {:?} was {} \\{{}\\}[{:?}]", cmd, args, str::from_utf8(output.output), str::from_utf8(output.error), output.status); @@ -267,7 +267,7 @@ So tests that use this need to check the existence of a file to make sure the command succeeded */ if output.status != 0 { - debug!("Command %s %? failed with exit code %?; its output was {{{ %s }}}", + debug2!("Command {} {:?} failed with exit code {:?}; its output was --- {} ---", cmd, args, output.status, str::from_utf8(output.output) + str::from_utf8(output.error)); Fail(output.status) @@ -279,7 +279,7 @@ to make sure the command succeeded fn create_local_package(pkgid: &PkgId) -> Path { let parent_dir = mk_temp_workspace(&pkgid.path, &pkgid.version); - debug!("Created empty package dir for %s, returning %s", pkgid.to_str(), parent_dir.to_str()); + debug2!("Created empty package dir for {}, returning {}", pkgid.to_str(), parent_dir.to_str()); parent_dir.pop().pop() } @@ -289,7 +289,7 @@ fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path { // Create main, lib, test, and bench files assert!(os::mkdir_recursive(&package_dir, U_RWX)); - debug!("Created %s and does it exist? %?", package_dir.to_str(), + debug2!("Created {} and does it exist? {:?}", package_dir.to_str(), os::path_is_dir(&package_dir)); // Create main, lib, test, and bench files @@ -305,7 +305,7 @@ fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path { } fn create_local_package_with_test(pkgid: &PkgId) -> Path { - debug!("Dry run -- would create package %s with test"); + debug2!("Dry run -- would create package {:?} with test", pkgid); create_local_package(pkgid) // Already has tests??? } @@ -314,7 +314,7 @@ fn create_local_package_with_dep(pkgid: &PkgId, subord_pkgid: &PkgId) -> Path { create_local_package_in(subord_pkgid, &package_dir); // Write a main.rs file into pkgid that references subord_pkgid writeFile(&package_dir.push_many([~"src", pkgid.to_str(), ~"main.rs"]), - fmt!("extern mod %s;\nfn main() {}", + format!("extern mod {};\nfn main() \\{\\}", subord_pkgid.short_name)); // Write a lib.rs file into subord_pkgid that has something in it writeFile(&package_dir.push_many([~"src", subord_pkgid.to_str(), ~"lib.rs"]), @@ -324,7 +324,7 @@ fn create_local_package_with_dep(pkgid: &PkgId, subord_pkgid: &PkgId) -> Path { fn create_local_package_with_custom_build_hook(pkgid: &PkgId, custom_build_hook: &str) -> Path { - debug!("Dry run -- would create package %s with custom build hook %s", + debug2!("Dry run -- would create package {} with custom build hook {}", pkgid.to_str(), custom_build_hook); create_local_package(pkgid) // actually write the pkg.rs with the custom build hook @@ -336,9 +336,9 @@ fn assert_lib_exists(repo: &Path, pkg_path: &Path, v: Version) { } fn lib_exists(repo: &Path, pkg_path: &Path, _v: Version) -> bool { // ??? version? - debug!("assert_lib_exists: repo = %s, pkg_path = %s", repo.to_str(), pkg_path.to_str()); + debug2!("assert_lib_exists: repo = {}, pkg_path = {}", repo.to_str(), pkg_path.to_str()); let lib = installed_library_in_workspace(pkg_path, repo); - debug!("assert_lib_exists: checking whether %? exists", lib); + debug2!("assert_lib_exists: checking whether {:?} exists", lib); lib.is_some() && { let libname = lib.get_ref(); os::path_exists(libname) && is_rwx(libname) @@ -350,13 +350,13 @@ fn assert_executable_exists(repo: &Path, short_name: &str) { } fn executable_exists(repo: &Path, short_name: &str) -> bool { - debug!("executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name); + debug2!("executable_exists: repo = {}, short_name = {}", repo.to_str(), short_name); let exec = target_executable_in_workspace(&PkgId::new(short_name), repo); os::path_exists(&exec) && is_rwx(&exec) } fn test_executable_exists(repo: &Path, short_name: &str) -> bool { - debug!("test_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name); + debug2!("test_executable_exists: repo = {}, short_name = {}", repo.to_str(), short_name); let exec = built_test_in_workspace(&PkgId::new(short_name), repo); do exec.map_default(false) |exec| { os::path_exists(exec) && is_rwx(exec) @@ -375,7 +375,8 @@ fn assert_built_executable_exists(repo: &Path, short_name: &str) { } fn built_executable_exists(repo: &Path, short_name: &str) -> bool { - debug!("assert_built_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name); + debug2!("assert_built_executable_exists: repo = {}, short_name = {}", + repo.to_str(), short_name); let exec = built_executable_in_workspace(&PkgId::new(short_name), repo); exec.is_some() && { let execname = exec.get_ref(); @@ -409,7 +410,7 @@ fn llvm_bitcode_file_exists(repo: &Path, short_name: &str) -> bool { fn file_exists(repo: &Path, short_name: &str, extension: &str) -> bool { os::path_exists(&target_build_dir(repo).push_many([short_name.to_owned(), - fmt!("%s.%s", short_name, extension)])) + format!("{}.{}", short_name, extension)])) } fn assert_built_library_exists(repo: &Path, short_name: &str) { @@ -417,7 +418,7 @@ fn assert_built_library_exists(repo: &Path, short_name: &str) { } fn built_library_exists(repo: &Path, short_name: &str) -> bool { - debug!("assert_built_library_exists: repo = %s, short_name = %s", repo.to_str(), short_name); + debug2!("assert_built_library_exists: repo = {}, short_name = {}", repo.to_str(), short_name); let lib = built_library_in_workspace(&PkgId::new(short_name), repo); lib.is_some() && { let libname = lib.get_ref(); @@ -439,7 +440,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~ let mut result = ~[]; let p_output = match command_line_test_with_env(args, &os::getcwd(), Some(env)) { - Fail(_) => fail!("Command-line test failed"), + Fail(_) => fail2!("Command-line test failed"), Success(r) => r }; let test_output = str::from_utf8(p_output.output); @@ -451,7 +452,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~ // assumes short_name and path are one and the same -- I should fix fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path { - debug!("lib_output_file_name: given %s and short name %s", + debug2!("lib_output_file_name: given {} and short name {}", workspace.to_str(), short_name); library_in_workspace(&Path(short_name), short_name, @@ -462,7 +463,7 @@ fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path { } fn output_file_name(workspace: &Path, short_name: ~str) -> Path { - target_build_dir(workspace).push(short_name).push(fmt!("%s%s", short_name, os::EXE_SUFFIX)) + target_build_dir(workspace).push(short_name).push(format!("{}{}", short_name, os::EXE_SUFFIX)) } fn touch_source_file(workspace: &Path, pkgid: &PkgId) { @@ -485,20 +486,20 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId, filename: &str) { let pkg_src_dir = workspace.push_many([~"src", pkgid.to_str()]); let mut maybe_p = None; let maybe_file = pkg_src_dir.push(filename); - debug!("Trying to frob %s -- %s", pkg_src_dir.to_str(), filename); + debug2!("Trying to frob {} -- {}", pkg_src_dir.to_str(), filename); if os::path_exists(&maybe_file) { maybe_p = Some(maybe_file); } - debug!("Frobbed? %?", maybe_p); + debug2!("Frobbed? {:?}", maybe_p); match maybe_p { Some(ref p) => { let w = io::file_writer(p, &[io::Append]); match w { - Err(s) => { let _ = cond.raise((p.clone(), fmt!("Bad path: %s", s))); } + Err(s) => { let _ = cond.raise((p.clone(), format!("Bad path: {}", s))); } Ok(w) => w.write_line("/* hi */") } } - None => fail!(fmt!("frob_source_file failed to find a source file in %s", + None => fail2!(format!("frob_source_file failed to find a source file in {}", pkg_src_dir.to_str())) } } @@ -509,7 +510,7 @@ fn test_make_dir_rwx() { let dir = temp.push("quux"); assert!(!os::path_exists(&dir) || os::remove_dir_recursive(&dir)); - debug!("Trying to make %s", dir.to_str()); + debug2!("Trying to make {}", dir.to_str()); assert!(make_dir_rwx(&dir)); assert!(os::path_is_dir(&dir)); assert!(is_rwx(&dir)); @@ -521,29 +522,29 @@ fn test_install_valid() { use path_util::installed_library_in_workspace; let sysroot = test_sysroot(); - debug!("sysroot = %s", sysroot.to_str()); + debug2!("sysroot = {}", sysroot.to_str()); let temp_pkg_id = fake_pkg(); let temp_workspace = mk_temp_workspace(&temp_pkg_id.path, &NoVersion).pop().pop(); let ctxt = fake_ctxt(sysroot, &temp_workspace); - debug!("temp_workspace = %s", temp_workspace.to_str()); + debug2!("temp_workspace = {}", temp_workspace.to_str()); // should have test, bench, lib, and main let src = PkgSrc::new(temp_workspace.clone(), false, temp_pkg_id.clone()); ctxt.install(src, &Everything); // Check that all files exist let exec = target_executable_in_workspace(&temp_pkg_id, &temp_workspace); - debug!("exec = %s", exec.to_str()); + debug2!("exec = {}", exec.to_str()); assert!(os::path_exists(&exec)); assert!(is_rwx(&exec)); let lib = installed_library_in_workspace(&temp_pkg_id.path, &temp_workspace); - debug!("lib = %?", lib); + debug2!("lib = {:?}", lib); assert!(lib.map_default(false, |l| os::path_exists(l))); assert!(lib.map_default(false, |l| is_rwx(l))); // And that the test and bench executables aren't installed assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, &temp_workspace))); let bench = target_bench_in_workspace(&temp_pkg_id, &temp_workspace); - debug!("bench = %s", bench.to_str()); + debug2!("bench = {}", bench.to_str()); assert!(!os::path_exists(&bench)); } @@ -568,12 +569,12 @@ fn test_install_invalid() { #[test] fn test_install_git() { let sysroot = test_sysroot(); - debug!("sysroot = %s", sysroot.to_str()); + debug2!("sysroot = {}", sysroot.to_str()); let temp_pkg_id = git_repo_pkg(); let repo = init_git_repo(&temp_pkg_id.path); - debug!("repo = %s", repo.to_str()); + debug2!("repo = {}", repo.to_str()); let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test-pkg"]); - debug!("repo_subdir = %s", repo_subdir.to_str()); + debug2!("repo_subdir = {}", repo_subdir.to_str()); writeFile(&repo_subdir.push("main.rs"), "fn main() { let _x = (); }"); @@ -585,15 +586,15 @@ fn test_install_git() { "#[bench] pub fn f() { (); }"); add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files - debug!("test_install_git: calling rustpkg install %s in %s", + debug2!("test_install_git: calling rustpkg install {} in {}", temp_pkg_id.path.to_str(), repo.to_str()); // should have test, bench, lib, and main command_line_test([~"install", temp_pkg_id.path.to_str()], &repo); let ws = repo.push(".rust"); // Check that all files exist - debug!("Checking for files in %s", ws.to_str()); + debug2!("Checking for files in {}", ws.to_str()); let exec = target_executable_in_workspace(&temp_pkg_id, &ws); - debug!("exec = %s", exec.to_str()); + debug2!("exec = {}", exec.to_str()); assert!(os::path_exists(&exec)); assert!(is_rwx(&exec)); let _built_lib = @@ -609,9 +610,9 @@ fn test_install_git() { // And that the test and bench executables aren't installed let test = target_test_in_workspace(&temp_pkg_id, &ws); assert!(!os::path_exists(&test)); - debug!("test = %s", test.to_str()); + debug2!("test = {}", test.to_str()); let bench = target_bench_in_workspace(&temp_pkg_id, &ws); - debug!("bench = %s", bench.to_str()); + debug2!("bench = {}", bench.to_str()); assert!(!os::path_exists(&bench)); } @@ -661,7 +662,7 @@ fn test_package_version() { let local_path = "mockgithub.com/catamorphism/test_pkg_version"; let repo = init_git_repo(&Path(local_path)); let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test_pkg_version"]); - debug!("Writing files in: %s", repo_subdir.to_str()); + debug2!("Writing files in: {}", repo_subdir.to_str()); writeFile(&repo_subdir.push("main.rs"), "fn main() { let _x = (); }"); writeFile(&repo_subdir.push("lib.rs"), @@ -681,7 +682,7 @@ fn test_package_version() { // we can still match on the filename to make sure it contains the 0.4 version assert!(match built_library_in_workspace(&temp_pkg_id, &ws) { - Some(p) => p.to_str().ends_with(fmt!("0.4%s", os::consts::DLL_SUFFIX)), + Some(p) => p.to_str().ends_with(format!("0.4{}", os::consts::DLL_SUFFIX)), None => false }); assert!(built_executable_in_workspace(&temp_pkg_id, &ws) @@ -696,7 +697,7 @@ fn test_package_request_version() { let local_path = "mockgithub.com/catamorphism/test_pkg_version"; let repo = init_git_repo(&Path(local_path)); let repo_subdir = repo.push_many([~"mockgithub.com", ~"catamorphism", ~"test_pkg_version"]); - debug!("Writing files in: %s", repo_subdir.to_str()); + debug2!("Writing files in: {}", repo_subdir.to_str()); writeFile(&repo_subdir.push("main.rs"), "fn main() { let _x = (); }"); writeFile(&repo_subdir.push("lib.rs"), @@ -710,12 +711,12 @@ fn test_package_request_version() { writeFile(&repo_subdir.push("version-0.4-file.txt"), "hello"); add_git_tag(&repo_subdir, ~"0.4"); - command_line_test([~"install", fmt!("%s#0.3", local_path)], &repo); + command_line_test([~"install", format!("{}\\#0.3", local_path)], &repo); assert!(match installed_library_in_workspace(&Path("test_pkg_version"), &repo.push(".rust")) { Some(p) => { - debug!("installed: %s", p.to_str()); - p.to_str().ends_with(fmt!("0.3%s", os::consts::DLL_SUFFIX)) + debug2!("installed: {}", p.to_str()); + p.to_str().ends_with(format!("0.3{}", os::consts::DLL_SUFFIX)) } None => false }); @@ -746,7 +747,7 @@ fn rustpkg_library_target() { let foo_repo = init_git_repo(&Path("foo")); let package_dir = foo_repo.push("foo"); - debug!("Writing files in: %s", package_dir.to_str()); + debug2!("Writing files in: {}", package_dir.to_str()); writeFile(&package_dir.push("main.rs"), "fn main() { let _x = (); }"); writeFile(&package_dir.push("lib.rs"), @@ -772,13 +773,13 @@ fn rustpkg_local_pkg() { #[ignore (reason = "test makes bogus assumptions about build directory layout: issue #8690")] fn package_script_with_default_build() { let dir = create_local_package(&PkgId::new("fancy-lib")); - debug!("dir = %s", dir.to_str()); + debug2!("dir = {}", dir.to_str()); let source = test_sysroot().pop().pop().pop().push_many( [~"src", ~"librustpkg", ~"testsuite", ~"pass", ~"src", ~"fancy-lib", ~"pkg.rs"]); - debug!("package_script_with_default_build: %s", source.to_str()); + debug2!("package_script_with_default_build: {}", source.to_str()); if !os::copy_file(&source, &dir.push_many([~"src", ~"fancy-lib-0.1", ~"pkg.rs"])) { - fail!("Couldn't copy file"); + fail2!("Couldn't copy file"); } command_line_test([~"install", ~"fancy-lib"], &dir); assert_lib_exists(&dir, &Path("fancy-lib"), NoVersion); @@ -794,7 +795,7 @@ fn rustpkg_build_no_arg() { writeFile(&package_dir.push("main.rs"), "fn main() { let _x = (); }"); - debug!("build_no_arg: dir = %s", package_dir.to_str()); + debug2!("build_no_arg: dir = {}", package_dir.to_str()); command_line_test([~"build"], &package_dir); assert_built_executable_exists(&tmp, "foo"); } @@ -808,7 +809,7 @@ fn rustpkg_install_no_arg() { assert!(os::mkdir_recursive(&package_dir, U_RWX)); writeFile(&package_dir.push("lib.rs"), "fn main() { let _x = (); }"); - debug!("install_no_arg: dir = %s", package_dir.to_str()); + debug2!("install_no_arg: dir = {}", package_dir.to_str()); command_line_test([~"install"], &package_dir); assert_lib_exists(&tmp, &Path("foo"), NoVersion); } @@ -822,7 +823,7 @@ fn rustpkg_clean_no_arg() { writeFile(&package_dir.push("main.rs"), "fn main() { let _x = (); }"); - debug!("clean_no_arg: dir = %s", package_dir.to_str()); + debug2!("clean_no_arg: dir = {}", package_dir.to_str()); command_line_test([~"build"], &package_dir); assert_built_executable_exists(&tmp, "foo"); command_line_test([~"clean"], &package_dir); @@ -834,11 +835,11 @@ fn rustpkg_clean_no_arg() { fn rust_path_test() { let dir_for_path = mkdtemp(&os::tmpdir(), "more_rust").expect("rust_path_test failed"); let dir = mk_workspace(&dir_for_path, &Path("foo"), &NoVersion); - debug!("dir = %s", dir.to_str()); + debug2!("dir = {}", dir.to_str()); writeFile(&dir.push("main.rs"), "fn main() { let _x = (); }"); let cwd = os::getcwd(); - debug!("cwd = %s", cwd.to_str()); + debug2!("cwd = {}", cwd.to_str()); // use command_line_test_with_env command_line_test_with_env([~"install", ~"foo"], &cwd, @@ -944,7 +945,7 @@ fn install_check_duplicates() { let mut contents = ~[]; let check_dups = |p: &PkgId| { if contents.contains(p) { - fail!("package %s appears in `list` output more than once", p.path.to_str()); + fail2!("package {} appears in `list` output more than once", p.path.to_str()); } else { contents.push((*p).clone()); @@ -983,8 +984,8 @@ fn no_rebuilding_dep() { match command_line_test_partial([~"build", ~"foo"], &workspace) { Success(*) => (), // ok - Fail(status) if status == 65 => fail!("no_rebuilding_dep failed: it tried to rebuild bar"), - Fail(_) => fail!("no_rebuilding_dep failed for some other reason") + Fail(status) if status == 65 => fail2!("no_rebuilding_dep failed: it tried to rebuild bar"), + Fail(_) => fail2!("no_rebuilding_dep failed for some other reason") } let bar_date_2 = datestamp(&lib_output_file_name(&workspace, @@ -1001,11 +1002,11 @@ fn do_rebuild_dep_dates_change() { command_line_test([~"build", ~"foo"], &workspace); let bar_lib_name = lib_output_file_name(&workspace, "bar"); let bar_date = datestamp(&bar_lib_name); - debug!("Datestamp on %s is %?", bar_lib_name.to_str(), bar_date); + debug2!("Datestamp on {} is {:?}", bar_lib_name.to_str(), bar_date); touch_source_file(&workspace, &dep_id); command_line_test([~"build", ~"foo"], &workspace); let new_bar_date = datestamp(&bar_lib_name); - debug!("Datestamp on %s is %?", bar_lib_name.to_str(), new_bar_date); + debug2!("Datestamp on {} is {:?}", bar_lib_name.to_str(), new_bar_date); assert!(new_bar_date > bar_date); } @@ -1074,7 +1075,7 @@ fn test_non_numeric_tag() { writeFile(&repo_subdir.push("not_on_testbranch_only"), "bye bye"); add_all_and_commit(&repo_subdir); - command_line_test([~"install", fmt!("%s#testbranch", temp_pkg_id.path.to_str())], &repo); + command_line_test([~"install", format!("{}\\#testbranch", temp_pkg_id.path.to_str())], &repo); let file1 = repo.push_many(["mockgithub.com", "catamorphism", "test-pkg", "testbranch_only"]); let file2 = repo.push_many(["mockgithub.com", "catamorphism", "test-pkg", @@ -1119,7 +1120,7 @@ fn test_extern_mod() { }); let outp = prog.finish_with_output(); if outp.status != 0 { - fail!("output was %s, error was %s", + fail2!("output was {}, error was {}", str::from_utf8(outp.output), str::from_utf8(outp.error)); } @@ -1149,7 +1150,7 @@ fn test_extern_mod_simpler() { let env = Some([(~"RUST_PATH", lib_depend_dir.to_str())] + os::env()); let rustpkg_exec = rustpkg_exec(); let rustc = rustpkg_exec.with_filename("rustc"); - debug!("RUST_PATH=%s %s %s \n --sysroot %s -o %s", + debug2!("RUST_PATH={} {} {} \n --sysroot {} -o {}", lib_depend_dir.to_str(), rustc.to_str(), main_file.to_str(), @@ -1168,7 +1169,7 @@ fn test_extern_mod_simpler() { }); let outp = prog.finish_with_output(); if outp.status != 0 { - fail!("output was %s, error was %s", + fail2!("output was {}, error was {}", str::from_utf8(outp.output), str::from_utf8(outp.error)); } @@ -1182,8 +1183,8 @@ fn test_import_rustpkg() { writeFile(&workspace.push_many([~"src", ~"foo-0.1", ~"pkg.rs"]), "extern mod rustpkg; fn main() {}"); command_line_test([~"build", ~"foo"], &workspace); - debug!("workspace = %s", workspace.to_str()); - assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s", + debug2!("workspace = {}", workspace.to_str()); + assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(format!("pkg{}", os::EXE_SUFFIX)))); } @@ -1192,10 +1193,10 @@ fn test_macro_pkg_script() { let p_id = PkgId::new("foo"); let workspace = create_local_package(&p_id); writeFile(&workspace.push_many([~"src", ~"foo-0.1", ~"pkg.rs"]), - "extern mod rustpkg; fn main() { debug!(\"Hi\"); }"); + "extern mod rustpkg; fn main() { debug2!(\"Hi\"); }"); command_line_test([~"build", ~"foo"], &workspace); - debug!("workspace = %s", workspace.to_str()); - assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s", + debug2!("workspace = {}", workspace.to_str()); + assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(format!("pkg{}", os::EXE_SUFFIX)))); } @@ -1207,11 +1208,11 @@ fn multiple_workspaces() { // Make a third package that uses foo, make sure we can build/install it let a_loc = mk_temp_workspace(&Path("foo"), &NoVersion).pop().pop(); let b_loc = mk_temp_workspace(&Path("foo"), &NoVersion).pop().pop(); - debug!("Trying to install foo in %s", a_loc.to_str()); + debug2!("Trying to install foo in {}", a_loc.to_str()); command_line_test([~"install", ~"foo"], &a_loc); - debug!("Trying to install foo in %s", b_loc.to_str()); + debug2!("Trying to install foo in {}", b_loc.to_str()); command_line_test([~"install", ~"foo"], &b_loc); - let env = Some(~[(~"RUST_PATH", fmt!("%s:%s", a_loc.to_str(), b_loc.to_str()))]); + let env = Some(~[(~"RUST_PATH", format!("{}:{}", a_loc.to_str(), b_loc.to_str()))]); let c_loc = create_local_package_with_dep(&PkgId::new("bar"), &PkgId::new("foo")); command_line_test_with_env([~"install", ~"bar"], &c_loc, env); } @@ -1229,7 +1230,9 @@ fn rust_path_hack_test(hack_flag: bool) { let workspace = create_local_package(&p_id); let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace"); let rust_path = Some(~[(~"RUST_PATH", - fmt!("%s:%s", dest_workspace.to_str(), workspace.push_many(["src", "foo-0.1"]).to_str()))]); + format!("{}:{}", + dest_workspace.to_str(), + workspace.push_many(["src", "foo-0.1"]).to_str()))]); command_line_test_with_env(~[~"install"] + if hack_flag { ~[~"--rust-path-hack"] } else { ~[] } + ~[~"foo"], &dest_workspace, rust_path); assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion); @@ -1272,7 +1275,7 @@ fn rust_path_hack_cwd() { let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace"); let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]); command_line_test_with_env([~"install", ~"--rust-path-hack", ~"foo"], &cwd, rust_path); - debug!("Checking that foo exists in %s", dest_workspace.to_str()); + debug2!("Checking that foo exists in {}", dest_workspace.to_str()); assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion); assert_built_library_exists(&dest_workspace, "foo"); assert!(!lib_exists(&cwd, &Path("foo"), NoVersion)); @@ -1291,7 +1294,7 @@ fn rust_path_hack_multi_path() { let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace"); let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]); command_line_test_with_env([~"install", ~"--rust-path-hack", name.clone()], &subdir, rust_path); - debug!("Checking that %s exists in %s", name, dest_workspace.to_str()); + debug2!("Checking that {} exists in {}", name, dest_workspace.to_str()); assert_lib_exists(&dest_workspace, &Path("quux"), NoVersion); assert_built_library_exists(&dest_workspace, name); assert!(!lib_exists(&subdir, &Path("quux"), NoVersion)); @@ -1309,7 +1312,7 @@ fn rust_path_hack_install_no_arg() { let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace"); let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]); command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path); - debug!("Checking that foo exists in %s", dest_workspace.to_str()); + debug2!("Checking that foo exists in {}", dest_workspace.to_str()); assert_lib_exists(&dest_workspace, &Path("foo"), NoVersion); assert_built_library_exists(&dest_workspace, "foo"); assert!(!lib_exists(&source_dir, &Path("foo"), NoVersion)); @@ -1327,7 +1330,7 @@ fn rust_path_hack_build_no_arg() { let dest_workspace = mk_empty_workspace(&Path("bar"), &NoVersion, "dest_workspace"); let rust_path = Some(~[(~"RUST_PATH", dest_workspace.to_str())]); command_line_test_with_env([~"build", ~"--rust-path-hack"], &source_dir, rust_path); - debug!("Checking that foo exists in %s", dest_workspace.to_str()); + debug2!("Checking that foo exists in {}", dest_workspace.to_str()); assert_built_library_exists(&dest_workspace, "foo"); assert!(!built_library_exists(&source_dir, "foo")); } @@ -1337,13 +1340,13 @@ fn rust_path_install_target() { let dir_for_path = mkdtemp(&os::tmpdir(), "source_workspace").expect("rust_path_install_target failed"); let dir = mk_workspace(&dir_for_path, &Path("foo"), &NoVersion); - debug!("dir = %s", dir.to_str()); + debug2!("dir = {}", dir.to_str()); writeFile(&dir.push("main.rs"), "fn main() { let _x = (); }"); let dir_to_install_to = mkdtemp(&os::tmpdir(), "dest_workspace").expect("rust_path_install_target failed"); let dir = dir.pop().pop(); - let rust_path = Some(~[(~"RUST_PATH", fmt!("%s:%s", dir_to_install_to.to_str(), + let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", dir_to_install_to.to_str(), dir.to_str()))]); let cwd = os::getcwd(); command_line_test_with_env([~"install", ~"foo"], @@ -1491,7 +1494,7 @@ fn test_cfg_fail() { ~"build", ~"foo"], &workspace) { - Success(*) => fail!("test_cfg_fail failed"), + Success(*) => fail2!("test_cfg_fail failed"), _ => () } } @@ -1627,7 +1630,7 @@ fn pkgid_pointing_to_subdir() { writeFile(&foo_dir.push("lib.rs"), "pub fn f() {}"); writeFile(&bar_dir.push("lib.rs"), "pub fn g() {}"); - debug!("Creating a file in %s", workspace.to_str()); + debug2!("Creating a file in {}", workspace.to_str()); let testpkg_dir = workspace.push_many([~"src", ~"testpkg-0.1"]); assert!(os::mkdir_recursive(&testpkg_dir, U_RWX)); @@ -1654,7 +1657,7 @@ fn test_recursive_deps() { writeFile(&b_workspace.push("src").push("b-0.1").push("lib.rs"), "extern mod c; use c::g; pub fn f() { g(); }"); let environment = Some(~[(~"RUST_PATH", b_workspace.to_str())]); - debug!("RUST_PATH=%s", b_workspace.to_str()); + debug2!("RUST_PATH={}", b_workspace.to_str()); command_line_test_with_env([~"install", ~"a"], &a_workspace, environment); @@ -1669,9 +1672,9 @@ fn test_install_to_rust_path() { let second_workspace = create_local_package(&p_id); let first_workspace = mk_empty_workspace(&Path("p"), &NoVersion, "dest"); let rust_path = Some(~[(~"RUST_PATH", - fmt!("%s:%s", first_workspace.to_str(), + format!("{}:{}", first_workspace.to_str(), second_workspace.to_str()))]); - debug!("RUST_PATH=%s:%s", first_workspace.to_str(), second_workspace.to_str()); + debug2!("RUST_PATH={}:{}", first_workspace.to_str(), second_workspace.to_str()); command_line_test_with_env([test_sysroot().to_str(), ~"install", ~"foo"], @@ -1782,7 +1785,7 @@ fn correct_package_name_with_rust_path_hack() { writeFile(&dest_workspace.push_many(["src", "bar-0.1", "main.rs"]), "extern mod blat; fn main() { let _x = (); }"); - let rust_path = Some(~[(~"RUST_PATH", fmt!("%s:%s", dest_workspace.to_str(), + let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", dest_workspace.to_str(), foo_workspace.push_many(["src", "foo-0.1"]).to_str()))]); // bar doesn't exist, but we want to make sure rustpkg doesn't think foo is bar command_line_test_with_env([~"install", ~"--rust-path-hack", ~"bar"], @@ -1833,9 +1836,9 @@ fn test_rebuild_when_needed() { frob_source_file(&foo_workspace, &foo_id, "test.rs"); chmod_read_only(&test_executable); match command_line_test_partial([~"test", ~"foo"], &foo_workspace) { - Success(*) => fail!("test_rebuild_when_needed didn't rebuild"), + Success(*) => fail2!("test_rebuild_when_needed didn't rebuild"), Fail(status) if status == 65 => (), // ok - Fail(_) => fail!("test_rebuild_when_needed failed for some other reason") + Fail(_) => fail2!("test_rebuild_when_needed failed for some other reason") } } @@ -1852,8 +1855,8 @@ fn test_no_rebuilding() { chmod_read_only(&test_executable); match command_line_test_partial([~"test", ~"foo"], &foo_workspace) { Success(*) => (), // ok - Fail(status) if status == 65 => fail!("test_no_rebuilding failed: it rebuilt the tests"), - Fail(_) => fail!("test_no_rebuilding failed for some other reason") + Fail(status) if status == 65 => fail2!("test_no_rebuilding failed: it rebuilt the tests"), + Fail(_) => fail2!("test_no_rebuilding failed for some other reason") } } diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index af80abdac38a6..17bda88339314 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -174,7 +174,7 @@ pub fn compile_input(context: &BuildContext, what: OutputType) -> Option { assert!(in_file.components.len() > 1); let input = driver::file_input((*in_file).clone()); - debug!("compile_input: %s / %?", in_file.to_str(), what); + debug2!("compile_input: {} / {:?}", in_file.to_str(), what); // tjc: by default, use the package ID name as the link name // not sure if we should support anything else @@ -184,9 +184,9 @@ pub fn compile_input(context: &BuildContext, let binary = os::args()[0].to_managed(); - debug!("flags: %s", flags.connect(" ")); - debug!("cfgs: %s", cfgs.connect(" ")); - debug!("compile_input's sysroot = %s", context.sysroot().to_str()); + debug2!("flags: {}", flags.connect(" ")); + debug2!("cfgs: {}", cfgs.connect(" ")); + debug2!("compile_input's sysroot = {}", context.sysroot().to_str()); let crate_type = match what { Lib => lib_crate, @@ -203,7 +203,7 @@ pub fn compile_input(context: &BuildContext, + context.flag_strs() + cfgs.flat_map(|c| { ~[~"--cfg", (*c).clone()] }), driver::optgroups()).unwrap(); - debug!("rustc flags: %?", matches); + debug2!("rustc flags: {:?}", matches); // Hack so that rustpkg can run either out of a rustc target dir, // or the host dir @@ -213,8 +213,8 @@ pub fn compile_input(context: &BuildContext, else { context.sysroot().pop().pop().pop() }; - debug!("compile_input's sysroot = %s", context.sysroot().to_str()); - debug!("sysroot_to_use = %s", sysroot_to_use.to_str()); + debug2!("compile_input's sysroot = {}", context.sysroot().to_str()); + debug2!("sysroot_to_use = {}", sysroot_to_use.to_str()); let output_type = match context.compile_upto() { Assemble => link::output_type_assembly, @@ -262,7 +262,7 @@ pub fn compile_input(context: &BuildContext, find_and_install_dependencies(context, pkg_id, sess, exec, &crate, |p| { - debug!("a dependency: %s", p.to_str()); + debug2!("a dependency: {}", p.to_str()); // Pass the directory containing a dependency // as an additional lib search path if !addl_lib_search_paths.contains(&p) { @@ -275,23 +275,23 @@ pub fn compile_input(context: &BuildContext, // Inject the link attributes so we get the right package name and version if attr::find_linkage_metas(crate.attrs).is_empty() { let name_to_use = match what { - Test => fmt!("%stest", pkg_id.short_name).to_managed(), - Bench => fmt!("%sbench", pkg_id.short_name).to_managed(), + Test => format!("{}test", pkg_id.short_name).to_managed(), + Bench => format!("{}bench", pkg_id.short_name).to_managed(), _ => pkg_id.short_name.to_managed() }; - debug!("Injecting link name: %s", name_to_use); + debug2!("Injecting link name: {}", name_to_use); let link_options = ~[attr::mk_name_value_item_str(@"name", name_to_use), attr::mk_name_value_item_str(@"vers", pkg_id.version.to_str().to_managed())] + ~[attr::mk_name_value_item_str(@"package_id", pkg_id.path.to_str().to_managed())]; - debug!("link options: %?", link_options); + debug2!("link options: {:?}", link_options); crate.attrs = ~[attr::mk_attr(attr::mk_list_item(@"link", link_options))]; } - debug!("calling compile_crate_from_input, workspace = %s, - building_library = %?", out_dir.to_str(), sess.building_library); + debug2!("calling compile_crate_from_input, workspace = {}, + building_library = {:?}", out_dir.to_str(), sess.building_library); let result = compile_crate_from_input(in_file, exec, context.compile_upto(), @@ -305,7 +305,7 @@ pub fn compile_input(context: &BuildContext, else { result }; - debug!("About to discover output %s", discovered_output.to_str()); + debug2!("About to discover output {}", discovered_output.to_str()); for p in discovered_output.iter() { if os::path_exists(p) { exec.discover_output("binary", p.to_str(), digest_only_date(p)); @@ -330,22 +330,22 @@ pub fn compile_crate_from_input(input: &Path, // Returns None if one of the flags that suppresses compilation output was // given crate: ast::Crate) -> Option { - debug!("Calling build_output_filenames with %s, building library? %?", + debug2!("Calling build_output_filenames with {}, building library? {:?}", out_dir.to_str(), sess.building_library); // bad copy - debug!("out_dir = %s", out_dir.to_str()); + debug2!("out_dir = {}", out_dir.to_str()); let outputs = driver::build_output_filenames(&driver::file_input(input.clone()), &Some(out_dir.clone()), &None, crate.attrs, sess); - debug!("Outputs are out_filename: %s and obj_filename: %s and output type = %?", + debug2!("Outputs are out_filename: {} and obj_filename: {} and output type = {:?}", outputs.out_filename.to_str(), outputs.obj_filename.to_str(), sess.opts.output_type); - debug!("additional libraries:"); + debug2!("additional libraries:"); for lib in sess.opts.addl_lib_search_paths.iter() { - debug!("an additional library: %s", lib.to_str()); + debug2!("an additional library: {}", lib.to_str()); } let analysis = driver::phase_3_run_analysis_passes(sess, &crate); if driver::stop_after_phase_3(sess) { return None; } @@ -362,7 +362,7 @@ pub fn compile_crate_from_input(input: &Path, // Register dependency on the source file exec.discover_input("file", input.to_str(), digest_file_with_date(input)); - debug!("Built %s, date = %?", outputs.out_filename.to_str(), + debug2!("Built {}, date = {:?}", outputs.out_filename.to_str(), datestamp(&outputs.out_filename)); Some(outputs.out_filename) @@ -384,10 +384,10 @@ pub fn compile_crate(ctxt: &BuildContext, crate: &Path, workspace: &Path, flags: &[~str], cfgs: &[~str], opt: bool, what: OutputType) -> Option { - debug!("compile_crate: crate=%s, workspace=%s", crate.to_str(), workspace.to_str()); - debug!("compile_crate: short_name = %s, flags =...", pkg_id.to_str()); + debug2!("compile_crate: crate={}, workspace={}", crate.to_str(), workspace.to_str()); + debug2!("compile_crate: short_name = {}, flags =...", pkg_id.to_str()); for fl in flags.iter() { - debug!("+++ %s", *fl); + debug2!("+++ {}", *fl); } compile_input(ctxt, exec, pkg_id, crate, workspace, flags, cfgs, opt, what) } @@ -403,7 +403,7 @@ struct ViewItemVisitor<'self> { impl<'self> Visitor<()> for ViewItemVisitor<'self> { fn visit_view_item(&mut self, vi: &ast::view_item, env: ()) { - debug!("A view item!"); + debug2!("A view item!"); match vi.node { // ignore metadata, I guess ast::view_item_extern_mod(lib_ident, path_opt, _, _) => { @@ -411,11 +411,11 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { Some(p) => p, None => self.sess.str_of(lib_ident) }; - debug!("Finding and installing... %s", lib_name); + debug2!("Finding and installing... {}", lib_name); // Check standard Rust library path first match system_library(&self.context.sysroot(), lib_name) { Some(ref installed_path) => { - debug!("It exists: %s", installed_path.to_str()); + debug2!("It exists: {}", installed_path.to_str()); // Say that [path for c] has a discovered dependency on // installed_path // For binary files, we only hash the datestamp, not the contents. @@ -428,15 +428,15 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { } None => { // FIXME #8711: need to parse version out of path_opt - debug!("Trying to install library %s, rebuilding it", + debug2!("Trying to install library {}, rebuilding it", lib_name.to_str()); // Try to install it let pkg_id = PkgId::new(lib_name); let workspaces = pkg_parent_workspaces(&self.context.context, &pkg_id); let source_workspace = if workspaces.is_empty() { - error(fmt!("Couldn't find package %s \ - in any of the workspaces in the RUST_PATH (%s)", + error(format!("Couldn't find package {} \ + in any of the workspaces in the RUST_PATH ({})", lib_name, rust_path().map(|s| s.to_str()).connect(":"))); cond.raise((pkg_id.clone(), ~"Dependency not found")) @@ -452,14 +452,14 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { pkg_id), &JustOne(Path( lib_crate_filename))); - debug!("Installed %s, returned %? dependencies and \ - %? transitive dependencies", + debug2!("Installed {}, returned {:?} dependencies and \ + {:?} transitive dependencies", lib_name, outputs_disc.len(), inputs_disc.len()); // It must have installed *something*... assert!(!outputs_disc.is_empty()); let target_workspace = outputs_disc[0].pop(); for dep in outputs_disc.iter() { - debug!("Discovering a binary input: %s", dep.to_str()); + debug2!("Discovering a binary input: {}", dep.to_str()); self.exec.discover_input("binary", dep.to_str(), digest_only_date(dep)); @@ -476,11 +476,11 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { digest_only_date(&Path(*dep))); } else { - fail!("Bad kind: %s", *what); + fail2!("Bad kind: {}", *what); } } // Also, add an additional search path - debug!("Installed %s into %s", lib_name, target_workspace.to_str()); + debug2!("Installed {} into {}", lib_name, target_workspace.to_str()); (self.save)(target_workspace); } } @@ -501,7 +501,7 @@ pub fn find_and_install_dependencies(context: &BuildContext, exec: &mut workcache::Exec, c: &ast::Crate, save: &fn(Path)) { - debug!("In find_and_install_dependencies..."); + debug2!("In find_and_install_dependencies..."); let mut visitor = ViewItemVisitor { context: context, parent: parent, @@ -553,8 +553,8 @@ fn debug_flags() -> ~[~str] { ~[] } /// Returns the last-modified date as an Option pub fn datestamp(p: &Path) -> Option { - debug!("Scrutinizing datestamp for %s - does it exist? %?", p.to_str(), os::path_exists(p)); + debug2!("Scrutinizing datestamp for {} - does it exist? {:?}", p.to_str(), os::path_exists(p)); let out = p.stat().map(|stat| stat.st_mtime); - debug!("Date = %?", out); + debug2!("Date = {:?}", out); out.map(|t| { *t as libc::time_t }) } diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index 6eb4cc56a2bdd..a59d2bb28870c 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -79,8 +79,8 @@ impl Ord for Version { impl ToStr for Version { fn to_str(&self) -> ~str { match *self { - ExactRevision(ref n) | Tagged(ref n) => fmt!("%s", n.to_str()), - SemanticVersion(ref v) => fmt!("%s", v.to_str()), + ExactRevision(ref n) | Tagged(ref n) => format!("{}", n.to_str()), + SemanticVersion(ref v) => format!("{}", v.to_str()), NoVersion => ~"0.1" } } @@ -104,9 +104,9 @@ pub fn try_getting_local_version(local_path: &Path) -> Option { loop; } let outp = run::process_output("git", - [fmt!("--git-dir=%s", git_dir.to_str()), ~"tag", ~"-l"]); + [format!("--git-dir={}", git_dir.to_str()), ~"tag", ~"-l"]); - debug!("git --git-dir=%s tag -l ~~~> %?", git_dir.to_str(), outp.status); + debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.to_str(), outp.status); if outp.status != 0 { loop; @@ -134,25 +134,27 @@ pub fn try_getting_version(remote_path: &Path) -> Option { if is_url_like(remote_path) { let tmp_dir = mkdtemp(&os::tmpdir(), "test").expect("try_getting_version: couldn't create temp dir"); - debug!("(to get version) executing {git clone https://%s %s}", + debug2!("(to get version) executing \\{git clone https://{} {}\\}", remote_path.to_str(), tmp_dir.to_str()); - let outp = run::process_output("git", [~"clone", fmt!("https://%s", remote_path.to_str()), + let outp = run::process_output("git", [~"clone", + format!("https://{}", + remote_path.to_str()), tmp_dir.to_str()]); if outp.status == 0 { - debug!("Cloned it... ( %s, %s )", + debug2!("Cloned it... ( {}, {} )", str::from_utf8(outp.output), str::from_utf8(outp.error)); let mut output = None; - debug!("(getting version, now getting tags) executing {git --git-dir=%s tag -l}", + debug2!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}", tmp_dir.push(".git").to_str()); let outp = run::process_output("git", - [fmt!("--git-dir=%s", tmp_dir.push(".git").to_str()), + [format!("--git-dir={}", tmp_dir.push(".git").to_str()), ~"tag", ~"-l"]); let output_text = str::from_utf8(outp.output); - debug!("Full output: ( %s ) [%?]", output_text, outp.status); + debug2!("Full output: ( {} ) [{:?}]", output_text, outp.status); for l in output_text.line_iter() { - debug!("A line of output: %s", l); + debug2!("A line of output: {}", l); if !l.is_whitespace() { output = Some(l); } @@ -179,7 +181,7 @@ enum ParseState { pub fn try_parsing_version(s: &str) -> Option { let s = s.trim(); - debug!("Attempting to parse: %s", s); + debug2!("Attempting to parse: {}", s); let mut parse_state = Start; for c in s.iter() { if char::is_digit(c) { @@ -242,7 +244,7 @@ fn test_parse_version() { #[test] fn test_split_version() { let s = "a/b/c#0.1"; - debug!("== %? ==", split_version(s)); + debug2!("== {:?} ==", split_version(s)); assert!(split_version(s) == Some((s.slice(0, 5), ExactRevision(~"0.1")))); assert!(split_version("a/b/c") == None); let s = "a#1.2"; diff --git a/src/librustpkg/workcache_support.rs b/src/librustpkg/workcache_support.rs index daf35c988c823..8af24ff4c3889 100644 --- a/src/librustpkg/workcache_support.rs +++ b/src/librustpkg/workcache_support.rs @@ -25,12 +25,12 @@ pub fn digest_file_with_date(path: &Path) -> ~str { (*sha).input_str(s); let st = match path.stat() { Some(st) => st, - None => cond1.raise((path.clone(), fmt!("Couldn't get file access time"))) + None => cond1.raise((path.clone(), format!("Couldn't get file access time"))) }; (*sha).input_str(st.st_mtime.to_str()); (*sha).result_str() } - Err(e) => cond.raise((path.clone(), fmt!("Couldn't read file: %s", e))).to_str() + Err(e) => cond.raise((path.clone(), format!("Couldn't read file: {}", e))).to_str() } } @@ -41,7 +41,7 @@ pub fn digest_only_date(path: &Path) -> ~str { let mut sha = ~Sha1::new(); let st = match path.stat() { Some(st) => st, - None => cond.raise((path.clone(), fmt!("Couldn't get file access time"))) + None => cond.raise((path.clone(), format!("Couldn't get file access time"))) }; (*sha).input_str(st.st_mtime.to_str()); (*sha).result_str() @@ -49,9 +49,9 @@ pub fn digest_only_date(path: &Path) -> ~str { /// Adds multiple discovered outputs pub fn discover_outputs(e: &mut workcache::Exec, outputs: ~[Path]) { - debug!("Discovering %? outputs", outputs.len()); + debug2!("Discovering {:?} outputs", outputs.len()); for p in outputs.iter() { - debug!("Discovering output! %s", p.to_str()); + debug2!("Discovering output! {}", p.to_str()); // For now, assume that all discovered outputs are binaries e.discover_output("binary", p.to_str(), digest_only_date(p)); } diff --git a/src/librustpkg/workspace.rs b/src/librustpkg/workspace.rs index dfe548c298e8e..9642d004de316 100644 --- a/src/librustpkg/workspace.rs +++ b/src/librustpkg/workspace.rs @@ -25,8 +25,8 @@ pub fn each_pkg_parent_workspace(cx: &Context, pkgid: &PkgId, action: &fn(&Path) let workspaces = pkg_parent_workspaces(cx, pkgid); if workspaces.is_empty() { // tjc: make this a condition - fail!("Package %s not found in any of \ - the following workspaces: %s", + fail2!("Package {} not found in any of \ + the following workspaces: {}", pkgid.path.to_str(), rust_path().to_str()); } From 86e613c632ce156360bdf6e80f6f82ed5ab3b838 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 29 Sep 2013 13:18:51 -0700 Subject: [PATCH 09/16] compiletest: Remove usage of fmt! --- src/compiletest/compiletest.rs | 66 +++++++++++------------ src/compiletest/errors.rs | 2 +- src/compiletest/header.rs | 4 +- src/compiletest/runtest.rs | 96 +++++++++++++++++----------------- src/compiletest/util.rs | 6 +-- 5 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 93324007f982e..bf920bcaf75af 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -82,23 +82,23 @@ pub fn parse_config(args: ~[~str]) -> config { let argv0 = args[0].clone(); let args_ = args.tail(); if args[1] == ~"-h" || args[1] == ~"--help" { - let message = fmt!("Usage: %s [OPTIONS] [TESTNAME...]", argv0); + let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); println(getopts::groups::usage(message, groups)); println(""); - fail!() + fail2!() } let matches = &match getopts::groups::getopts(args_, groups) { Ok(m) => m, - Err(f) => fail!(f.to_err_msg()) + Err(f) => fail2!(f.to_err_msg()) }; if matches.opt_present("h") || matches.opt_present("help") { - let message = fmt!("Usage: %s [OPTIONS] [TESTNAME...]", argv0); + let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); println(getopts::groups::usage(message, groups)); println(""); - fail!() + fail2!() } fn opt_path(m: &getopts::Matches, nm: &str) -> Path { @@ -152,29 +152,29 @@ pub fn parse_config(args: ~[~str]) -> config { pub fn log_config(config: &config) { let c = config; - logv(c, fmt!("configuration:")); - logv(c, fmt!("compile_lib_path: %s", config.compile_lib_path)); - logv(c, fmt!("run_lib_path: %s", config.run_lib_path)); - logv(c, fmt!("rustc_path: %s", config.rustc_path.to_str())); - logv(c, fmt!("src_base: %s", config.src_base.to_str())); - logv(c, fmt!("build_base: %s", config.build_base.to_str())); - logv(c, fmt!("stage_id: %s", config.stage_id)); - logv(c, fmt!("mode: %s", mode_str(config.mode))); - logv(c, fmt!("run_ignored: %b", config.run_ignored)); - logv(c, fmt!("filter: %s", opt_str(&config.filter))); - logv(c, fmt!("runtool: %s", opt_str(&config.runtool))); - logv(c, fmt!("rustcflags: %s", opt_str(&config.rustcflags))); - logv(c, fmt!("jit: %b", config.jit)); - logv(c, fmt!("target: %s", config.target)); - logv(c, fmt!("adb_path: %s", config.adb_path)); - logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir)); - logv(c, fmt!("adb_device_status: %b", config.adb_device_status)); + logv(c, format!("configuration:")); + logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); + logv(c, format!("run_lib_path: {}", config.run_lib_path)); + logv(c, format!("rustc_path: {}", config.rustc_path.to_str())); + logv(c, format!("src_base: {}", config.src_base.to_str())); + logv(c, format!("build_base: {}", config.build_base.to_str())); + logv(c, format!("stage_id: {}", config.stage_id)); + logv(c, format!("mode: {}", mode_str(config.mode))); + logv(c, format!("run_ignored: {}", config.run_ignored)); + logv(c, format!("filter: {}", opt_str(&config.filter))); + logv(c, format!("runtool: {}", opt_str(&config.runtool))); + logv(c, format!("rustcflags: {}", opt_str(&config.rustcflags))); + logv(c, format!("jit: {}", config.jit)); + logv(c, format!("target: {}", config.target)); + logv(c, format!("adb_path: {}", config.adb_path)); + logv(c, format!("adb_test_dir: {}", config.adb_test_dir)); + logv(c, format!("adb_device_status: {}", config.adb_device_status)); match config.test_shard { None => logv(c, ~"test_shard: (all)"), - Some((a,b)) => logv(c, fmt!("test_shard: %u.%u", a, b)) + Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b)) } - logv(c, fmt!("verbose: %b", config.verbose)); - logv(c, fmt!("\n")); + logv(c, format!("verbose: {}", config.verbose)); + logv(c, format!("\n")); } pub fn opt_str<'a>(maybestr: &'a Option<~str>) -> &'a str { @@ -203,7 +203,7 @@ pub fn str_mode(s: ~str) -> mode { ~"pretty" => mode_pretty, ~"debug-info" => mode_debug_info, ~"codegen" => mode_codegen, - _ => fail!("invalid mode") + _ => fail2!("invalid mode") } } @@ -226,7 +226,7 @@ pub fn run_tests(config: &config) { // For context, see #8904 rt::test::prepare_for_lots_of_tests(); let res = test::run_tests_console(&opts, tests); - if !res { fail!("Some tests failed"); } + if !res { fail2!("Some tests failed"); } } pub fn test_opts(config: &config) -> test::TestOpts { @@ -244,13 +244,13 @@ pub fn test_opts(config: &config) -> test::TestOpts { } pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] { - debug!("making tests from %s", + debug2!("making tests from {}", config.src_base.to_str()); let mut tests = ~[]; let dirs = os::list_dir_path(&config.src_base); for file in dirs.iter() { let file = file.clone(); - debug!("inspecting file %s", file.to_str()); + debug2!("inspecting file {}", file.to_str()); if is_test(config, &file) { let t = do make_test(config, &file) { match config.mode { @@ -306,12 +306,12 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName { let filename = path.filename(); let p = path.pop(); let dir = p.filename(); - fmt!("%s/%s", dir.unwrap_or(""), filename.unwrap_or("")) + format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or("")) } - test::DynTestName(fmt!("[%s] %s", - mode_str(config.mode), - shorten(testfile))) + test::DynTestName(format!("[{}] {}", + mode_str(config.mode), + shorten(testfile))) } pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn { diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index b044f19dcd629..02195e684e385 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -56,7 +56,7 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] { while idx < len && line[idx] == (' ' as u8) { idx += 1u; } let msg = line.slice(idx, len).to_owned(); - debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg); + debug2!("line={} kind={} msg={}", line_num - adjust_line, kind, msg); return ~[ExpectedError{line: line_num - adjust_line, kind: kind, msg: msg}]; diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 38cb7c7bfe0b2..36780abc7eefd 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -150,7 +150,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> { let end = strs.pop(); (strs.pop(), end) } - n => fail!("Expected 1 or 2 strings, not %u", n) + n => fail2!("Expected 1 or 2 strings, not {}", n) } } } @@ -179,7 +179,7 @@ fn parse_name_value_directive(line: &str, Some(colon) => { let value = line.slice(colon + keycolon.len(), line.len()).to_owned(); - debug!("%s: %s", directive, value); + debug2!("{}: {}", directive, value); Some(value) } None => None diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 6e2f62f870695..2d55fa775d7d7 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -63,9 +63,9 @@ pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) { io::stdout().write_str("\n\n"); } let testfile = Path(testfile); - debug!("running %s", testfile.to_str()); + debug2!("running {}", testfile.to_str()); let props = load_props(&testfile); - debug!("loaded props"); + debug2!("loaded props"); match config.mode { mode_compile_fail => run_cfail_test(&config, &props, &testfile), mode_run_fail => run_rfail_test(&config, &props, &testfile), @@ -136,8 +136,8 @@ fn check_correct_failure_status(ProcRes: &ProcRes) { static RUST_ERR: int = 101; if ProcRes.status != RUST_ERR { fatal_ProcRes( - fmt!("failure produced the wrong error code: %d", - ProcRes.status), + format!("failure produced the wrong error code: {}", + ProcRes.status), ProcRes); } } @@ -174,11 +174,11 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) { let mut round = 0; while round < rounds { - logv(config, fmt!("pretty-printing round %d", round)); + logv(config, format!("pretty-printing round {}", round)); let ProcRes = print_source(config, testfile, srcs[round].clone()); if ProcRes.status != 0 { - fatal_ProcRes(fmt!("pretty-printing failed in round %d", round), + fatal_ProcRes(format!("pretty-printing failed in round {}", round), &ProcRes); } @@ -228,19 +228,19 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) { if expected != actual { error(~"pretty-printed source does not match expected source"); let msg = - fmt!("\n\ + format!("\n\ expected:\n\ ------------------------------------------\n\ -%s\n\ +{}\n\ ------------------------------------------\n\ actual:\n\ ------------------------------------------\n\ -%s\n\ +{}\n\ ------------------------------------------\n\ \n", expected, actual); io::stdout().write_str(msg); - fail!(); + fail2!(); } } @@ -285,7 +285,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { let script_str = [~"set charset UTF-8", cmds, ~"quit\n"].connect("\n"); - debug!("script_str = %s", script_str); + debug2!("script_str = {}", script_str); dump_output_file(config, testfile, script_str, "debugger.script"); // run debugger script with gdb @@ -318,8 +318,8 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { } } if i != num_check_lines { - fatal_ProcRes(fmt!("line not found in debugger output: %s", - check_lines[i]), &ProcRes); + fatal_ProcRes(format!("line not found in debugger output: {}", + check_lines[i]), &ProcRes); } } } @@ -340,10 +340,10 @@ fn check_error_patterns(props: &TestProps, let mut done = false; for line in ProcRes.stderr.line_iter() { if line.contains(*next_err_pat) { - debug!("found error pattern %s", *next_err_pat); + debug2!("found error pattern {}", *next_err_pat); next_err_idx += 1u; if next_err_idx == props.error_patterns.len() { - debug!("found all error patterns"); + debug2!("found all error patterns"); done = true; break; } @@ -355,11 +355,11 @@ fn check_error_patterns(props: &TestProps, let missing_patterns = props.error_patterns.slice(next_err_idx, props.error_patterns.len()); if missing_patterns.len() == 1u { - fatal_ProcRes(fmt!("error pattern '%s' not found!", - missing_patterns[0]), ProcRes); + fatal_ProcRes(format!("error pattern '{}' not found!", + missing_patterns[0]), ProcRes); } else { for pattern in missing_patterns.iter() { - error(fmt!("error pattern '%s' not found!", *pattern)); + error(format!("error pattern '{}' not found!", *pattern)); } fatal_ProcRes(~"multiple error patterns not found", ProcRes); } @@ -378,7 +378,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], } let prefixes = expected_errors.iter().map(|ee| { - fmt!("%s:%u:", testfile.to_str(), ee.line) + format!("{}:{}:", testfile.to_str(), ee.line) }).collect::<~[~str]>(); fn to_lower( s : &str ) -> ~str { @@ -415,7 +415,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], let mut was_expected = false; for (i, ee) in expected_errors.iter().enumerate() { if !found_flags[i] { - debug!("prefix=%s ee.kind=%s ee.msg=%s line=%s", + debug2!("prefix={} ee.kind={} ee.msg={} line={}", prefixes[i], ee.kind, ee.msg, line); if (prefix_matches(line, prefixes[i]) && line.contains(ee.kind) && @@ -433,7 +433,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], } if !was_expected && is_compiler_error_or_warning(line) { - fatal_ProcRes(fmt!("unexpected compiler error or warning: '%s'", + fatal_ProcRes(format!("unexpected compiler error or warning: '{}'", line), ProcRes); } @@ -442,7 +442,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError], for (i, &flag) in found_flags.iter().enumerate() { if !flag { let ee = &expected_errors[i]; - fatal_ProcRes(fmt!("expected %s on line %u not found: %s", + fatal_ProcRes(format!("expected {} on line {} not found: {}", ee.kind, ee.line, ee.msg), ProcRes); } } @@ -591,7 +591,7 @@ fn compose_and_run_compiler( config.compile_lib_path, None); if auxres.status != 0 { fatal_ProcRes( - fmt!("auxiliary build of %s failed to compile: ", + format!("auxiliary build of {} failed to compile: ", abs_ab.to_str()), &auxres); } @@ -615,7 +615,7 @@ fn compose_and_run_compiler( fn ensure_dir(path: &Path) { if os::path_is_dir(path) { return; } if !os::make_dir(path, 0x1c0i32) { - fail!("can't make dir %s", path.to_str()); + fail2!("can't make dir {}", path.to_str()); } } @@ -678,7 +678,7 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str, let cmdline = { let cmdline = make_cmdline(lib_path, prog, args); - logv(config, fmt!("executing %s", cmdline)); + logv(config, format!("executing {}", cmdline)); cmdline }; let procsrv::Result{ out, err, status } = @@ -695,19 +695,19 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str, #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str { - fmt!("%s %s", prog, args.connect(" ")) + format!("{} {}", prog, args.connect(" ")) } #[cfg(target_os = "win32")] fn make_cmdline(libpath: &str, prog: &str, args: &[~str]) -> ~str { - fmt!("%s %s %s", lib_path_cmd_prefix(libpath), prog, + format!("{} {} {}", lib_path_cmd_prefix(libpath), prog, args.connect(" ")) } // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes fn lib_path_cmd_prefix(path: &str) -> ~str { - fmt!("%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)) + format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path)) } fn dump_output(config: &config, testfile: &Path, out: &str, err: &str) { @@ -744,8 +744,8 @@ fn output_base_name(config: &config, testfile: &Path) -> Path { fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { if config.verbose { - let sep1 = fmt!("------%s------------------------------", "stdout"); - let sep2 = fmt!("------%s------------------------------", "stderr"); + let sep1 = format!("------{}------------------------------", "stdout"); + let sep2 = format!("------{}------------------------------", "stderr"); let sep3 = ~"------------------------------------------"; io::stdout().write_line(sep1); io::stdout().write_line(out); @@ -755,27 +755,27 @@ fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { } } -fn error(err: ~str) { io::stdout().write_line(fmt!("\nerror: %s", err)); } +fn error(err: ~str) { io::stdout().write_line(format!("\nerror: {}", err)); } -fn fatal(err: ~str) -> ! { error(err); fail!(); } +fn fatal(err: ~str) -> ! { error(err); fail2!(); } fn fatal_ProcRes(err: ~str, ProcRes: &ProcRes) -> ! { let msg = - fmt!("\n\ -error: %s\n\ -command: %s\n\ + format!("\n\ +error: {}\n\ +command: {}\n\ stdout:\n\ ------------------------------------------\n\ -%s\n\ +{}\n\ ------------------------------------------\n\ stderr:\n\ ------------------------------------------\n\ -%s\n\ +{}\n\ ------------------------------------------\n\ \n", err, ProcRes.cmdline, ProcRes.stdout, ProcRes.stderr); io::stdout().write_str(msg); - fail!(); + fail2!(); } fn _arm_exec_compiled_test(config: &config, props: &TestProps, @@ -794,23 +794,23 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, ~[(~"",~"")], Some(~"")); if config.verbose { - io::stdout().write_str(fmt!("push (%s) %s %s %s", + io::stdout().write_str(format!("push ({}) {} {} {}", config.target, args.prog, copy_result.out, copy_result.err)); } - logv(config, fmt!("executing (%s) %s", config.target, cmdline)); + logv(config, format!("executing ({}) {}", config.target, cmdline)); let mut runargs = ~[]; // run test via adb_run_wrapper runargs.push(~"shell"); for (key, val) in env.move_iter() { - runargs.push(fmt!("%s=%s", key, val)); + runargs.push(format!("{}={}", key, val)); } - runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir)); - runargs.push(fmt!("%s", config.adb_test_dir)); - runargs.push(fmt!("%s", prog_short)); + runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir)); + runargs.push(format!("{}", config.adb_test_dir)); + runargs.push(format!("{}", prog_short)); for tv in args.args.iter() { runargs.push(tv.to_owned()); @@ -822,7 +822,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, runargs = ~[]; runargs.push(~"shell"); runargs.push(~"cat"); - runargs.push(fmt!("%s/%s.exitcode", config.adb_test_dir, prog_short)); + runargs.push(format!("{}/{}.exitcode", config.adb_test_dir, prog_short)); let procsrv::Result{ out: exitcode_out, err: _, status: _ } = procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], @@ -841,7 +841,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, runargs = ~[]; runargs.push(~"shell"); runargs.push(~"cat"); - runargs.push(fmt!("%s/%s.stdout", config.adb_test_dir, prog_short)); + runargs.push(format!("{}/{}.stdout", config.adb_test_dir, prog_short)); let procsrv::Result{ out: stdout_out, err: _, status: _ } = procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); @@ -850,7 +850,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, runargs = ~[]; runargs.push(~"shell"); runargs.push(~"cat"); - runargs.push(fmt!("%s/%s.stderr", config.adb_test_dir, prog_short)); + runargs.push(format!("{}/{}.stderr", config.adb_test_dir, prog_short)); let procsrv::Result{ out: stderr_out, err: _, status: _ } = procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); @@ -887,7 +887,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) { ~[(~"",~"")], Some(~"")); if config.verbose { - io::stdout().write_str(fmt!("push (%s) %s %s %s", + io::stdout().write_str(format!("push ({}) {} {} {}", config.target, file.to_str(), copy_result.out, copy_result.err)); } diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index b62d26a502914..59b8ba1c7ff30 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -29,7 +29,7 @@ pub fn get_os(triple: &str) -> &'static str { return os } } - fail!("Cannot determine OS from triple"); + fail2!("Cannot determine OS from triple"); } pub fn make_new_path(path: &str) -> ~str { @@ -38,7 +38,7 @@ pub fn make_new_path(path: &str) -> ~str { // maintain the current value while adding our own match getenv(lib_path_env_var()) { Some(curr) => { - fmt!("%s%s%s", path, path_div(), curr) + format!("{}{}{}", path, path_div(), curr) } None => path.to_str() } @@ -63,6 +63,6 @@ pub fn path_div() -> ~str { ~":" } pub fn path_div() -> ~str { ~";" } pub fn logv(config: &config, s: ~str) { - debug!("%s", s); + debug2!("{}", s); if config.verbose { io::println(s); } } From 630082ca8946ff2d0e814a73a2594ba65e1b29be Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 29 Sep 2013 19:23:57 -0700 Subject: [PATCH 10/16] rpass: Remove usage of fmt! --- src/compiletest/compiletest.rs | 2 +- src/test/auxiliary/cci_class_4.rs | 6 +- src/test/auxiliary/cci_class_cast.rs | 6 +- src/test/auxiliary/cci_nested_lib.rs | 2 +- .../auxiliary/extern-crosscrate-source.rs | 2 +- src/test/auxiliary/issue2378a.rs | 2 +- src/test/auxiliary/issue_2723_a.rs | 2 +- src/test/auxiliary/static-methods-crate.rs | 2 +- src/test/run-pass/alignment-gep-tup-like-1.rs | 2 +- src/test/run-pass/alignment-gep-tup-like-2.rs | 2 +- src/test/run-pass/arith-0.rs | 2 +- src/test/run-pass/arith-1.rs | 2 +- src/test/run-pass/attr-main-2.rs | 2 +- src/test/run-pass/auto-instantiate.rs | 4 +- .../autoref-intermediate-types-issue-3585.rs | 4 +- .../run-pass/binary-minus-without-space.rs | 2 +- src/test/run-pass/bind-by-move.rs | 2 +- src/test/run-pass/binops.rs | 2 +- src/test/run-pass/bitwise.rs | 4 +- src/test/run-pass/block-arg.rs | 6 +- src/test/run-pass/block-explicit-types.rs | 2 +- src/test/run-pass/block-iter-1.rs | 2 +- src/test/run-pass/block-iter-2.rs | 2 +- .../borrowck-macro-interaction-issue-6304.rs | 6 +- src/test/run-pass/borrowck-mut-uniq.rs | 4 +- .../borrowck-preserve-box-in-discr.rs | 2 +- .../borrowck-preserve-box-in-field.rs | 2 +- .../run-pass/borrowck-preserve-box-in-pat.rs | 2 +- .../run-pass/borrowck-preserve-box-in-uniq.rs | 2 +- src/test/run-pass/borrowck-preserve-box.rs | 2 +- .../run-pass/borrowck-preserve-cond-box.rs | 4 +- .../run-pass/borrowck-preserve-expl-deref.rs | 2 +- src/test/run-pass/borrowck-unary-move-2.rs | 2 +- src/test/run-pass/box-inside-if.rs | 2 +- src/test/run-pass/box-inside-if2.rs | 2 +- src/test/run-pass/box-unbox.rs | 2 +- .../run-pass/boxed-class-type-substitution.rs | 2 +- src/test/run-pass/bug-7183-generics.rs | 4 +- src/test/run-pass/cast-region-to-uint.rs | 2 +- src/test/run-pass/cci_borrow.rs | 2 +- src/test/run-pass/class-attributes-1.rs | 2 +- src/test/run-pass/class-attributes-2.rs | 2 +- .../class-cast-to-trait-cross-crate-2.rs | 2 +- .../class-cast-to-trait-multiple-types.rs | 6 +- src/test/run-pass/class-cast-to-trait.rs | 6 +- .../class-impl-very-parameterized-trait.rs | 14 +- .../class-implement-trait-cross-crate.rs | 6 +- src/test/run-pass/class-implement-traits.rs | 6 +- src/test/run-pass/class-separate-impl.rs | 8 +- src/test/run-pass/classes.rs | 6 +- src/test/run-pass/cleanup-copy-mode.rs | 2 +- .../close-over-big-then-small-data.rs | 2 +- src/test/run-pass/comm.rs | 8 +- src/test/run-pass/complex.rs | 6 +- .../run-pass/conditional-debug-macro-off.rs | 2 +- .../run-pass/conditional-debug-macro-on.rs | 4 +- src/test/run-pass/const-big-enum.rs | 6 +- src/test/run-pass/const-enum-byref-self.rs | 2 +- src/test/run-pass/const-enum-byref.rs | 2 +- src/test/run-pass/const-enum-ptr.rs | 2 +- src/test/run-pass/const-enum-structlike.rs | 2 +- src/test/run-pass/const-enum-vec-index.rs | 4 +- src/test/run-pass/const-enum-vec-ptr.rs | 4 +- src/test/run-pass/const-enum-vector.rs | 4 +- src/test/run-pass/const-nullary-enum.rs | 4 +- src/test/run-pass/const.rs | 2 +- src/test/run-pass/core-rt-smoke.rs | 2 +- src/test/run-pass/dead-code-one-arm-if.rs | 2 +- src/test/run-pass/deref-lval.rs | 2 +- .../run-pass/deriving-cmp-shortcircuit.rs | 8 +- src/test/run-pass/die-macro.rs | 4 +- src/test/run-pass/enum-alignment.rs | 2 +- src/test/run-pass/enum-discrim-width-stuff.rs | 4 +- .../enum-nullable-simplifycfg-misopt.rs | 2 +- src/test/run-pass/estr-slice.rs | 12 +- src/test/run-pass/evec-slice.rs | 8 +- src/test/run-pass/export-non-interference2.rs | 2 +- src/test/run-pass/export-non-interference3.rs | 2 +- src/test/run-pass/expr-block-generic-box1.rs | 4 +- .../run-pass/expr-block-generic-unique1.rs | 4 +- src/test/run-pass/expr-if-fail-all.rs | 2 +- src/test/run-pass/expr-if-fail.rs | 6 +- src/test/run-pass/expr-match-box.rs | 4 +- src/test/run-pass/expr-match-fail-all.rs | 2 +- src/test/run-pass/expr-match-fail.rs | 4 +- src/test/run-pass/expr-match-generic-box1.rs | 2 +- src/test/run-pass/expr-match-generic-box2.rs | 2 +- .../run-pass/expr-match-generic-unique1.rs | 2 +- .../run-pass/expr-match-generic-unique2.rs | 2 +- src/test/run-pass/expr-match-generic.rs | 2 +- src/test/run-pass/expr-match-struct.rs | 2 +- src/test/run-pass/expr-match-unique.rs | 2 +- src/test/run-pass/extern-call-deep.rs | 4 +- src/test/run-pass/extern-call-deep2.rs | 4 +- src/test/run-pass/extern-call-indirect.rs | 4 +- src/test/run-pass/extern-call-scrub.rs | 4 +- src/test/run-pass/extern-crosscrate.rs | 4 +- src/test/run-pass/extern-yield.rs | 2 +- src/test/run-pass/fact.rs | 4 +- src/test/run-pass/fat-arrow-match.rs | 2 +- src/test/run-pass/float-signature.rs | 2 +- src/test/run-pass/float.rs | 4 +- src/test/run-pass/fn-bare-item.rs | 2 +- src/test/run-pass/for-loop-fail.rs | 2 +- src/test/run-pass/foreach-put-structured.rs | 4 +- .../run-pass/foreach-simple-outer-slot.rs | 8 +- src/test/run-pass/generic-alias-box.rs | 2 +- src/test/run-pass/generic-alias-unique.rs | 2 +- src/test/run-pass/generic-derived-type.rs | 4 +- src/test/run-pass/generic-fn-box.rs | 2 +- src/test/run-pass/generic-fn-unique.rs | 2 +- src/test/run-pass/generic-fn.rs | 6 +- src/test/run-pass/generic-tag-match.rs | 2 +- src/test/run-pass/generic-tag-values.rs | 6 +- src/test/run-pass/generic-temporary.rs | 2 +- src/test/run-pass/generic-tup.rs | 2 +- src/test/run-pass/getopts_ref.rs | 2 +- src/test/run-pass/hashmap-memory.rs | 6 +- src/test/run-pass/if-bot.rs | 4 +- src/test/run-pass/if-check.rs | 4 +- src/test/run-pass/import-glob-0.rs | 12 +- src/test/run-pass/import.rs | 2 +- src/test/run-pass/import2.rs | 2 +- src/test/run-pass/import3.rs | 2 +- src/test/run-pass/import4.rs | 2 +- src/test/run-pass/import5.rs | 2 +- src/test/run-pass/import6.rs | 2 +- src/test/run-pass/import7.rs | 2 +- src/test/run-pass/import8.rs | 2 +- src/test/run-pass/inner-module.rs | 2 +- src/test/run-pass/integral-indexing.rs | 4 +- src/test/run-pass/issue-1516.rs | 2 +- src/test/run-pass/issue-1696.rs | 2 +- src/test/run-pass/issue-2216.rs | 2 +- src/test/run-pass/issue-2311-2.rs | 2 +- src/test/run-pass/issue-2312.rs | 2 +- src/test/run-pass/issue-2611-3.rs | 3 +- src/test/run-pass/issue-2633.rs | 2 +- src/test/run-pass/issue-2718.rs | 28 +- src/test/run-pass/issue-2804-2.rs | 2 +- src/test/run-pass/issue-2804.rs | 8 +- src/test/run-pass/issue-2904.rs | 4 +- src/test/run-pass/issue-2935.rs | 2 +- src/test/run-pass/issue-3109.rs | 2 +- src/test/run-pass/issue-3556.rs | 5 +- src/test/run-pass/issue-3563-3.rs | 2 +- src/test/run-pass/issue-3609.rs | 2 +- src/test/run-pass/issue-3895.rs | 2 +- src/test/run-pass/issue-4016.rs | 2 +- ...e-5008-borrowed-traitobject-method-call.rs | 2 +- src/test/run-pass/issue-5275.rs | 4 +- src/test/run-pass/issue-5666.rs | 4 +- src/test/run-pass/issue-5688.rs | 2 +- src/test/run-pass/issue-5708.rs | 2 +- src/test/run-pass/issue-5926.rs | 2 +- src/test/run-pass/issue-6128.rs | 2 +- src/test/run-pass/issue-6344-let.rs | 2 +- src/test/run-pass/issue-6344-match.rs | 2 +- src/test/run-pass/issue-7012.rs | 2 +- src/test/run-pass/issue-7563.rs | 6 +- src/test/run-pass/issue-8898.rs | 2 +- src/test/run-pass/istr.rs | 6 +- src/test/run-pass/item-attributes.rs | 2 +- src/test/run-pass/iter-range.rs | 2 +- src/test/run-pass/lambda-infer-unresolved.rs | 2 +- src/test/run-pass/last-use-in-block.rs | 2 +- src/test/run-pass/last-use-is-capture.rs | 2 +- src/test/run-pass/lazy-and-or.rs | 2 +- src/test/run-pass/lazy-init.rs | 2 +- src/test/run-pass/linear-for-loop.rs | 8 +- src/test/run-pass/liveness-loop-break.rs | 2 +- src/test/run-pass/log-err-phi.rs | 2 +- .../log-knows-the-names-of-variants-in-std.rs | 4 +- .../log-knows-the-names-of-variants.rs | 8 +- src/test/run-pass/log-linearized.rs | 2 +- src/test/run-pass/log-poly.rs | 8 +- src/test/run-pass/log-str.rs | 4 +- src/test/run-pass/loop-break-cont.rs | 6 +- src/test/run-pass/macro-interpolation.rs | 2 +- src/test/run-pass/match-borrowed_str.rs | 4 +- src/test/run-pass/match-bot-2.rs | 2 +- src/test/run-pass/match-bot.rs | 4 +- src/test/run-pass/match-enum-struct-0.rs | 2 +- src/test/run-pass/match-enum-struct-1.rs | 4 +- src/test/run-pass/match-join.rs | 2 +- src/test/run-pass/match-pattern-drop.rs | 12 +- src/test/run-pass/match-pattern-lit.rs | 6 +- .../run-pass/match-pattern-no-type-params.rs | 4 +- src/test/run-pass/match-pipe-binding.rs | 10 +- src/test/run-pass/match-range.rs | 16 +- .../match-ref-binding-in-guard-3256.rs | 2 +- src/test/run-pass/match-str.rs | 12 +- src/test/run-pass/match-struct-0.rs | 6 +- src/test/run-pass/match-unique-bind.rs | 2 +- src/test/run-pass/match-with-ret-arm.rs | 2 +- src/test/run-pass/morestack-address.rs | 2 +- src/test/run-pass/mutable-alias-vec.rs | 2 +- src/test/run-pass/negative.rs | 2 +- src/test/run-pass/nested-matchs.rs | 6 +- src/test/run-pass/nested-pattern.rs | 4 +- src/test/run-pass/nested-patterns.rs | 2 +- src/test/run-pass/new-impl-syntax.rs | 2 +- src/test/run-pass/opeq.rs | 8 +- src/test/run-pass/option-unwrap.rs | 2 +- src/test/run-pass/over-constrained-vregs.rs | 2 +- src/test/run-pass/overload-index-operator.rs | 2 +- src/test/run-pass/paren-free.rs | 2 +- src/test/run-pass/parse-fail.rs | 2 +- src/test/run-pass/pass-by-copy.rs | 4 +- src/test/run-pass/pure-fmt.rs | 14 +- src/test/run-pass/purity-infer.rs | 2 +- src/test/run-pass/rcvr-borrowed-to-region.rs | 6 +- src/test/run-pass/rcvr-borrowed-to-slice.rs | 6 +- src/test/run-pass/rec-align-u32.rs | 8 +- src/test/run-pass/rec-align-u64.rs | 8 +- src/test/run-pass/rec-auto.rs | 4 +- src/test/run-pass/reflect-visit-data.rs | 6 +- src/test/run-pass/reflect-visit-type.rs | 12 +- src/test/run-pass/region-dependent-addr-of.rs | 6 +- .../region-return-interior-of-option.rs | 2 +- src/test/run-pass/regions-addr-of-ret.rs | 2 +- src/test/run-pass/regions-borrow-at.rs | 2 +- src/test/run-pass/regions-bot.rs | 2 +- src/test/run-pass/regions-self-impls.rs | 2 +- src/test/run-pass/regions-self-in-enums.rs | 2 +- src/test/run-pass/regions-simple.rs | 2 +- src/test/run-pass/regions-static-closure.rs | 2 +- src/test/run-pass/repeated-vector-syntax.rs | 4 +- .../run-pass/resource-assign-is-not-copy.rs | 2 +- src/test/run-pass/resource-cycle.rs | 10 +- src/test/run-pass/resource-destruct.rs | 4 +- src/test/run-pass/ret-bang.rs | 2 +- src/test/run-pass/rt-start-main-thread.rs | 4 +- src/test/run-pass/sendfn-generic-fn.rs | 4 +- src/test/run-pass/sendfn-spawn-with-fn-arg.rs | 2 +- src/test/run-pass/shadow.rs | 2 +- .../run-pass/shape_intrinsic_tag_then_rec.rs | 4 +- src/test/run-pass/simple-infer.rs | 2 +- src/test/run-pass/simple-match-generic-tag.rs | 2 +- src/test/run-pass/size-and-align.rs | 8 +- src/test/run-pass/spawn-fn.rs | 6 +- src/test/run-pass/spawn.rs | 2 +- src/test/run-pass/spawn2.rs | 18 +- src/test/run-pass/stat.rs | 2 +- src/test/run-pass/str-append.rs | 6 +- src/test/run-pass/str-concat.rs | 2 +- src/test/run-pass/str-idx.rs | 2 +- src/test/run-pass/string-self-append.rs | 2 +- src/test/run-pass/struct-literal-dtor.rs | 2 +- src/test/run-pass/struct-return.rs | 14 +- src/test/run-pass/supported-cast.rs | 464 +++++++++--------- src/test/run-pass/syntax-extension-cfg.rs | 26 +- src/test/run-pass/syntax-extension-fmt.rs | 8 +- .../includeme.fragment | 2 +- src/test/run-pass/tag-align-shape.rs | 4 +- src/test/run-pass/tag-disr-val-shape.rs | 6 +- src/test/run-pass/tail-cps.rs | 8 +- src/test/run-pass/task-comm-0.rs | 12 +- src/test/run-pass/task-comm-1.rs | 4 +- src/test/run-pass/task-comm-10.rs | 4 +- src/test/run-pass/task-comm-12.rs | 4 +- src/test/run-pass/task-comm-13.rs | 4 +- src/test/run-pass/task-comm-14.rs | 8 +- src/test/run-pass/task-comm-3.rs | 14 +- src/test/run-pass/task-comm-4.rs | 16 +- src/test/run-pass/task-comm-9.rs | 2 +- src/test/run-pass/tempfile.rs | 8 +- src/test/run-pass/terminate-in-initializer.rs | 4 +- src/test/run-pass/test-runner-hides-main.rs | 2 +- src/test/run-pass/threads.rs | 4 +- src/test/run-pass/trait-cast.rs | 2 +- src/test/run-pass/trait-to-str.rs | 2 +- .../run-pass/traits-default-method-macro.rs | 2 +- src/test/run-pass/trivial-message.rs | 2 +- .../typeck-macro-interaction-issue-8852.rs | 2 +- .../run-pass/typeclasses-eq-example-static.rs | 2 +- src/test/run-pass/typeclasses-eq-example.rs | 2 +- .../run-pass/unary-minus-suffix-inference.rs | 20 +- src/test/run-pass/unique-copy-box.rs | 2 +- src/test/run-pass/unique-decl.rs | 2 +- src/test/run-pass/unique-in-tag.rs | 2 +- src/test/run-pass/unique-log.rs | 2 +- src/test/run-pass/unique-pat-3.rs | 2 +- src/test/run-pass/unique-pat.rs | 2 +- .../run-pass/unit-like-struct-drop-run.rs | 2 +- src/test/run-pass/unreachable-code-1.rs | 2 +- src/test/run-pass/unreachable-code.rs | 2 +- src/test/run-pass/unwind-box.rs | 2 +- src/test/run-pass/unwind-resource.rs | 10 +- src/test/run-pass/unwind-resource2.rs | 2 +- src/test/run-pass/unwind-unique.rs | 2 +- src/test/run-pass/use-uninit-match.rs | 2 +- src/test/run-pass/use-uninit-match2.rs | 4 +- src/test/run-pass/utf8.rs | 6 +- src/test/run-pass/vec-concat.rs | 2 +- src/test/run-pass/vec-late-init.rs | 2 +- src/test/run-pass/vec-matching-autoslice.rs | 10 +- src/test/run-pass/vec-matching.rs | 20 +- src/test/run-pass/vec-self-append.rs | 2 +- src/test/run-pass/weird-exprs.rs | 6 +- src/test/run-pass/while-cont.rs | 2 +- src/test/run-pass/while-loop-constraints-2.rs | 2 +- src/test/run-pass/while-with-break.rs | 4 +- src/test/run-pass/while.rs | 6 +- src/test/run-pass/writealias.rs | 2 +- src/test/run-pass/yield.rs | 8 +- src/test/run-pass/yield1.rs | 4 +- src/test/run-pass/yield2.rs | 2 +- 308 files changed, 853 insertions(+), 843 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index bf920bcaf75af..e253c9bd05953 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -91,7 +91,7 @@ pub fn parse_config(args: ~[~str]) -> config { let matches = &match getopts::groups::getopts(args_, groups) { Ok(m) => m, - Err(f) => fail2!(f.to_err_msg()) + Err(f) => fail2!("{}", f.to_err_msg()) }; if matches.opt_present("h") || matches.opt_present("help") { diff --git a/src/test/auxiliary/cci_class_4.rs b/src/test/auxiliary/cci_class_4.rs index 98e5c8c2b5bbd..78f9d62087baf 100644 --- a/src/test/auxiliary/cci_class_4.rs +++ b/src/test/auxiliary/cci_class_4.rs @@ -21,11 +21,11 @@ pub mod kitties { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -33,7 +33,7 @@ pub mod kitties { impl cat { pub fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs index 8fac4a3f322af..906928d1b7920 100644 --- a/src/test/auxiliary/cci_class_cast.rs +++ b/src/test/auxiliary/cci_class_cast.rs @@ -21,7 +21,7 @@ pub mod kitty { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; @@ -35,12 +35,12 @@ pub mod kitty { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 350bd09826fad..626947306c729 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -33,7 +33,7 @@ pub fn alist_get uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } diff --git a/src/test/auxiliary/issue2378a.rs b/src/test/auxiliary/issue2378a.rs index ea14229cc48a7..20b3a3280ec82 100644 --- a/src/test/auxiliary/issue2378a.rs +++ b/src/test/auxiliary/issue2378a.rs @@ -17,7 +17,7 @@ impl Index for maybe { fn index(&self, _idx: &uint) -> T { match self { &just(ref t) => (*t).clone(), - ¬hing => { fail!(); } + ¬hing => { fail2!(); } } } } diff --git a/src/test/auxiliary/issue_2723_a.rs b/src/test/auxiliary/issue_2723_a.rs index b3fa8e73cc222..384f69c736cf0 100644 --- a/src/test/auxiliary/issue_2723_a.rs +++ b/src/test/auxiliary/issue_2723_a.rs @@ -9,5 +9,5 @@ // except according to those terms. pub unsafe fn f(xs: ~[int]) { - xs.map(|_x| { unsafe fn q() { fail!(); } }); + xs.map(|_x| { unsafe fn q() { fail2!(); } }); } diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 6978b9209d8bc..ef173d52bc4fe 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -38,6 +38,6 @@ impl read for bool { pub fn read(s: ~str) -> T { match read::readMaybe(s) { Some(x) => x, - _ => fail!("read failed!") + _ => fail2!("read failed!") } } diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 4352c139b620b..873eb66e52e6f 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -36,7 +36,7 @@ fn f(a: A, b: u16) -> @Invokable { pub fn main() { let (a, b) = f(22_u64, 44u16).f(); - info!("a=%? b=%?", a, b); + info2!("a={:?} b={:?}", a, b); assert_eq!(a, 22u64); assert_eq!(b, 44u16); } diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs index 9bf95968a9a21..7c43385ed6167 100644 --- a/src/test/run-pass/alignment-gep-tup-like-2.rs +++ b/src/test/run-pass/alignment-gep-tup-like-2.rs @@ -55,7 +55,7 @@ pub fn main() { let z = f(~x, y); make_cycle(z); let (a, b) = z.f(); - info!("a=%u b=%u", *a as uint, b as uint); + info2!("a={} b={}", *a as uint, b as uint); assert_eq!(*a, x); assert_eq!(b, y); } diff --git a/src/test/run-pass/arith-0.rs b/src/test/run-pass/arith-0.rs index ca01e1e10c302..9944241836b58 100644 --- a/src/test/run-pass/arith-0.rs +++ b/src/test/run-pass/arith-0.rs @@ -12,6 +12,6 @@ pub fn main() { let a: int = 10; - info!(a); + info2!("{}", a); assert_eq!(a * (a - 1), 90); } diff --git a/src/test/run-pass/arith-1.rs b/src/test/run-pass/arith-1.rs index 8cde06ab4284f..db8f0eac4f6b3 100644 --- a/src/test/run-pass/arith-1.rs +++ b/src/test/run-pass/arith-1.rs @@ -28,6 +28,6 @@ pub fn main() { assert_eq!(i32_b << 1, i32_b << 1); assert_eq!(i32_b >> 1, i32_b >> 1); assert_eq!(i32_b & i32_b << 1, 0); - info!(i32_b | i32_b << 1); + info2!("{}", i32_b | i32_b << 1); assert_eq!(i32_b | i32_b << 1, 0x30303030); } diff --git a/src/test/run-pass/attr-main-2.rs b/src/test/run-pass/attr-main-2.rs index 741f700663330..6078698ebd6b6 100644 --- a/src/test/run-pass/attr-main-2.rs +++ b/src/test/run-pass/attr-main-2.rs @@ -11,7 +11,7 @@ // xfail-fast pub fn main() { - fail!() + fail2!() } #[main] diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 47cf12629013e..d8399848e09e3 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -19,6 +19,6 @@ struct Triple { x: int, y: int, z: int } fn f(x: T, y: U) -> Pair { return Pair {a: x, b: y}; } pub fn main() { - info!("%?", f(Triple {x: 3, y: 4, z: 5}, 4).a.x); - info!("%?", f(5, 6).a); + info2!("{:?}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x); + info2!("{:?}", f(5, 6).a); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index cae3bff8043ea..096e4378b3d43 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -14,13 +14,13 @@ trait Foo { impl Foo for @T { fn foo(&self) -> ~str { - fmt!("@%s", (**self).foo()) + format!("@{}", (**self).foo()) } } impl Foo for uint { fn foo(&self) -> ~str { - fmt!("%u", *self) + format!("{}", *self) } } diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 78edf3e112e98..f312cdae8bdee 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -11,6 +11,6 @@ // Check that issue #954 stays fixed pub fn main() { - match -1 { -1 => {}, _ => fail!("wat") } + match -1 { -1 => {}, _ => fail2!("wat") } assert_eq!(1-1, 0); } diff --git a/src/test/run-pass/bind-by-move.rs b/src/test/run-pass/bind-by-move.rs index a7a4aa9885e6e..ad5573889dd36 100644 --- a/src/test/run-pass/bind-by-move.rs +++ b/src/test/run-pass/bind-by-move.rs @@ -18,6 +18,6 @@ pub fn main() { let x = Some(p); match x { Some(z) => { dispose(z); }, - None => fail!() + None => fail2!() } } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 333794e98bfb8..10a7355c91d0b 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -81,7 +81,7 @@ fn test_class() { let mut r = p(1, 2); unsafe { - error!("q = %x, r = %x", + error2!("q = {:x}, r = {:x}", (::std::cast::transmute::<*p, uint>(&q)), (::std::cast::transmute::<*p, uint>(&r))); } diff --git a/src/test/run-pass/bitwise.rs b/src/test/run-pass/bitwise.rs index 49ff17317c8b0..b99067419b06e 100644 --- a/src/test/run-pass/bitwise.rs +++ b/src/test/run-pass/bitwise.rs @@ -27,8 +27,8 @@ fn general() { a ^= b; b ^= a; a = a ^ b; - info!(a); - info!(b); + info2!("{}", a); + info2!("{}", b); assert_eq!(b, 1); assert_eq!(a, 2); assert_eq!(!0xf0 & 0xff, 0xf); diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index 717093e9de704..18da52ca88f4e 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -14,7 +14,7 @@ pub fn main() { // Statement form does not require parentheses: for i in v.iter() { - info!("%?", *i); + info2!("{:?}", *i); } // Usable at all: @@ -35,14 +35,14 @@ pub fn main() { assert!(false); } match do v.iter().all |e| { e.is_negative() } { - true => { fail!("incorrect answer."); } + true => { fail2!("incorrect answer."); } false => { } } match 3 { _ if do v.iter().any |e| { e.is_negative() } => { } _ => { - fail!("wrong answer."); + fail2!("wrong answer."); } } diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index ff65d963000fd..1931ec589ac10 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -10,5 +10,5 @@ pub fn main() { fn as_buf(s: ~str, f: &fn(~str) -> T) -> T { f(s) } - as_buf(~"foo", |foo: ~str| -> () error!(foo) ); + as_buf(~"foo", |foo: ~str| -> () error2!("{}", foo) ); } diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 790757463c647..806ed035d5a0f 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -20,6 +20,6 @@ pub fn main() { odds += 1; } }); - error!(odds); + error2!("{:?}", odds); assert_eq!(odds, 4); } diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index 29b693ec37695..c84033e5bde08 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -20,6 +20,6 @@ pub fn main() { sum += *i * *j; }); }); - error!(sum); + error2!("{:?}", sum); assert_eq!(sum, 225); } diff --git a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs index 4e79013de833e..09c3dd2d54baf 100644 --- a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs @@ -19,11 +19,11 @@ impl Foo { ); match s { ~Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)), - _ => fail!() + _ => fail2!() } } - fn check_id(&mut self, s: int) { fail!() } + fn check_id(&mut self, s: int) { fail2!() } } - + pub fn main() { } diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 633e0f71b9e0b..8ff326ed8706e 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -31,9 +31,9 @@ pub fn main() { add_int(ints, 44); do iter_ints(ints) |i| { - error!("int = %d", *i); + error2!("int = {}", *i); true }; - error!("ints=%?", ints); + error2!("ints={:?}", ints); } diff --git a/src/test/run-pass/borrowck-preserve-box-in-discr.rs b/src/test/run-pass/borrowck-preserve-box-in-discr.rs index 219e57a3e8ccb..4be38df939b79 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -23,7 +23,7 @@ pub fn main() { x = @F {f: ~4}; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(**b_x)) as uint); assert_eq!(**b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(**b_x))); diff --git a/src/test/run-pass/borrowck-preserve-box-in-field.rs b/src/test/run-pass/borrowck-preserve-box-in-field.rs index a85ab027f2c92..ddc1d61869748 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-field.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-field.rs @@ -28,7 +28,7 @@ pub fn main() { assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x))); x = @F {f: ~4}; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(*b_x)) as uint); assert_eq!(*b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x))); diff --git a/src/test/run-pass/borrowck-preserve-box-in-pat.rs b/src/test/run-pass/borrowck-preserve-box-in-pat.rs index c53b4b4e747d5..dc389ed1bc8cd 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs @@ -23,7 +23,7 @@ pub fn main() { *x = @F {f: ~4}; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(**b_x)) as uint); assert_eq!(**b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(**b_x))); diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs index b25d731680133..139466bf40aa1 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs @@ -28,7 +28,7 @@ pub fn main() { assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x))); *x = @F{f: ~4}; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(*b_x)) as uint); assert_eq!(*b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x))); diff --git a/src/test/run-pass/borrowck-preserve-box.rs b/src/test/run-pass/borrowck-preserve-box.rs index ec57194cb4390..f852f36d63374 100644 --- a/src/test/run-pass/borrowck-preserve-box.rs +++ b/src/test/run-pass/borrowck-preserve-box.rs @@ -26,7 +26,7 @@ pub fn main() { assert_eq!(ptr::to_unsafe_ptr(&(*x)), ptr::to_unsafe_ptr(&(*b_x))); x = @22; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(*b_x)) as uint); assert_eq!(*b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x)) != ptr::to_unsafe_ptr(&(*b_x))); diff --git a/src/test/run-pass/borrowck-preserve-cond-box.rs b/src/test/run-pass/borrowck-preserve-cond-box.rs index dc3718275fce9..b9428daf152b4 100644 --- a/src/test/run-pass/borrowck-preserve-cond-box.rs +++ b/src/test/run-pass/borrowck-preserve-cond-box.rs @@ -25,13 +25,13 @@ fn testfn(cond: bool) { exp = 4; } - info!("*r = %d, exp = %d", *r, exp); + info2!("*r = {}, exp = {}", *r, exp); assert_eq!(*r, exp); x = @5; y = @6; - info!("*r = %d, exp = %d", *r, exp); + info2!("*r = {}, exp = {}", *r, exp); assert_eq!(*r, exp); assert_eq!(x, @5); assert_eq!(y, @6); diff --git a/src/test/run-pass/borrowck-preserve-expl-deref.rs b/src/test/run-pass/borrowck-preserve-expl-deref.rs index 94b8f70b759fb..fec8575749311 100644 --- a/src/test/run-pass/borrowck-preserve-expl-deref.rs +++ b/src/test/run-pass/borrowck-preserve-expl-deref.rs @@ -28,7 +28,7 @@ pub fn main() { assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x))); x = @F {f: ~4}; - info!("ptr::to_unsafe_ptr(*b_x) = %x", + info2!("ptr::to_unsafe_ptr(*b_x) = {:x}", ptr::to_unsafe_ptr(&(*b_x)) as uint); assert_eq!(*b_x, 3); assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x))); diff --git a/src/test/run-pass/borrowck-unary-move-2.rs b/src/test/run-pass/borrowck-unary-move-2.rs index 87d42943fac97..6d16fd838f854 100644 --- a/src/test/run-pass/borrowck-unary-move-2.rs +++ b/src/test/run-pass/borrowck-unary-move-2.rs @@ -14,7 +14,7 @@ struct noncopyable { impl Drop for noncopyable { fn drop(&mut self) { - error!("dropped"); + error2!("dropped"); } } diff --git a/src/test/run-pass/box-inside-if.rs b/src/test/run-pass/box-inside-if.rs index ea2b7d58a1112..249e9a47164c3 100644 --- a/src/test/run-pass/box-inside-if.rs +++ b/src/test/run-pass/box-inside-if.rs @@ -19,7 +19,7 @@ fn is_odd(_n: int) -> bool { return true; } fn length_is_even(_vs: @int) -> bool { return true; } fn foo(_acc: int, n: int) { - if is_odd(n) && length_is_even(some_box(1)) { error!("bloop"); } + if is_odd(n) && length_is_even(some_box(1)) { error2!("bloop"); } } pub fn main() { foo(67, 5); } diff --git a/src/test/run-pass/box-inside-if2.rs b/src/test/run-pass/box-inside-if2.rs index 53b4684706091..a4563c33331b0 100644 --- a/src/test/run-pass/box-inside-if2.rs +++ b/src/test/run-pass/box-inside-if2.rs @@ -19,7 +19,7 @@ fn is_odd(_n: int) -> bool { return true; } fn length_is_even(_vs: @int) -> bool { return true; } fn foo(_acc: int, n: int) { - if is_odd(n) || length_is_even(some_box(1)) { error!("bloop"); } + if is_odd(n) || length_is_even(some_box(1)) { error2!("bloop"); } } pub fn main() { foo(67, 5); } diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index 2e92395d54907..f5d522470d360 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -17,6 +17,6 @@ fn unbox(b: Box) -> T { return (*b.c).clone(); } pub fn main() { let foo: int = 17; let bfoo: Box = Box {c: @foo}; - info!("see what's in our box"); + info2!("see what's in our box"); assert_eq!(unbox::(bfoo), foo); } diff --git a/src/test/run-pass/boxed-class-type-substitution.rs b/src/test/run-pass/boxed-class-type-substitution.rs index 81bd3b6c139e3..e9be0904d4e9b 100644 --- a/src/test/run-pass/boxed-class-type-substitution.rs +++ b/src/test/run-pass/boxed-class-type-substitution.rs @@ -15,7 +15,7 @@ struct Tree { parent: Option } -fn empty() -> Tree { fail!() } +fn empty() -> Tree { fail2!() } struct Box { tree: Tree<@Box> diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 45f4302a5afe3..3e89ac8bd3864 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -19,14 +19,14 @@ fn hello(s:&S) -> ~str{ impl Speak for int { fn say(&self, s:&str) -> ~str { - fmt!("%s: %d", s, *self) + format!("{}: {}", s, *self) } } impl Speak for Option { fn say(&self, s:&str) -> ~str { match *self { - None => fmt!("%s - none", s), + None => format!("{} - none", s), Some(ref x) => { ~"something!" + x.say(s) } } } diff --git a/src/test/run-pass/cast-region-to-uint.rs b/src/test/run-pass/cast-region-to-uint.rs index 7472e0ca73a6c..69ca1584c12fa 100644 --- a/src/test/run-pass/cast-region-to-uint.rs +++ b/src/test/run-pass/cast-region-to-uint.rs @@ -12,5 +12,5 @@ use std::borrow; pub fn main() { let x = 3; - info!("&x=%x", borrow::to_uint(&x)); + info2!("&x={:x}", borrow::to_uint(&x)); } diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index c5fa8bba1a5de..3db000accec77 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -17,6 +17,6 @@ use cci_borrow_lib::foo; pub fn main() { let p = @22u; let r = foo(p); - info!("r=%u", r); + info2!("r={}", r); assert_eq!(r, 22u); } diff --git a/src/test/run-pass/class-attributes-1.rs b/src/test/run-pass/class-attributes-1.rs index 2165f73c3bf4c..3e7cae395d482 100644 --- a/src/test/run-pass/class-attributes-1.rs +++ b/src/test/run-pass/class-attributes-1.rs @@ -16,7 +16,7 @@ struct cat { impl Drop for cat { #[cat_dropper] - fn drop(&mut self) { error!("%s landed on hir feet" , self . name); } + fn drop(&mut self) { error2!("{} landed on hir feet" , self . name); } } diff --git a/src/test/run-pass/class-attributes-2.rs b/src/test/run-pass/class-attributes-2.rs index 30cafff0388c5..0a3f1539333cf 100644 --- a/src/test/run-pass/class-attributes-2.rs +++ b/src/test/run-pass/class-attributes-2.rs @@ -18,7 +18,7 @@ impl Drop for cat { Actually, cats don't always land on their feet when you drop them. */ fn drop(&mut self) { - error!("%s landed on hir feet", self.name); + error2!("{} landed on hir feet", self.name); } } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index d81e6fc687811..ac8c74f2da572 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -16,7 +16,7 @@ use cci_class_cast::kitty::*; fn print_out(thing: @ToStr, expected: ~str) { let actual = thing.to_str(); - info!("%s", actual); + info2!("{}", actual); assert_eq!(actual, expected); } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index dd63d96907760..3828fbd439501 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -20,7 +20,7 @@ struct dog { impl dog { fn bark(&self) -> int { - info!("Woof %u %d", *self.barks, *self.volume); + info2!("Woof {} {}", *self.barks, *self.volume); *self.barks += 1u; if *self.barks % 3u == 0u { *self.volume += 1; @@ -28,7 +28,7 @@ impl dog { if *self.barks % 10u == 0u { *self.volume -= 2; } - info!("Grrr %u %d", *self.barks, *self.volume); + info2!("Grrr {} {}", *self.barks, *self.volume); *self.volume } } @@ -62,7 +62,7 @@ impl cat { impl cat { fn meow(&self) -> uint { - info!("Meow"); + info2!("Meow"); *self.meows += 1u; if *self.meows % 5u == 0u { *self.how_hungry += 1; diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs index 737253a956fc0..69a94e09d5f30 100644 --- a/src/test/run-pass/class-cast-to-trait.rs +++ b/src/test/run-pass/class-cast-to-trait.rs @@ -25,12 +25,12 @@ impl noisy for cat { impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -38,7 +38,7 @@ impl cat { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 03dd33b08e235..baa82dbb2deb6 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -38,11 +38,11 @@ impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -75,7 +75,7 @@ impl MutableMap for cat { true } - fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail!() } + fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail2!() } fn remove(&mut self, k: &int) -> bool { if self.find(k).is_some() { @@ -85,16 +85,16 @@ impl MutableMap for cat { } } - fn pop(&mut self, _k: &int) -> Option { fail!() } + fn pop(&mut self, _k: &int) -> Option { fail2!() } - fn swap(&mut self, _k: int, _v: T) -> Option { fail!() } + fn swap(&mut self, _k: int, _v: T) -> Option { fail2!() } } impl cat { pub fn get<'a>(&'a self, k: &int) -> &'a T { match self.find(k) { Some(v) => { v } - None => { fail!("epic fail"); } + None => { fail2!("epic fail"); } } } @@ -106,7 +106,7 @@ impl cat { impl cat { fn meow(&mut self) { self.meows += 1; - error!("Meow %d", self.meows); + error2!("Meow {}", self.meows); if self.meows % 5 == 0 { self.how_hungry += 1; } diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index 9443904b46d21..78dcdba289529 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -23,12 +23,12 @@ struct cat { impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -40,7 +40,7 @@ impl noisy for cat { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 433d7f7a22ff4..1433b5a8024cd 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -24,7 +24,7 @@ struct cat { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; @@ -35,11 +35,11 @@ impl cat { impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 5555125a03b22..5ef0569cf10e0 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -21,12 +21,12 @@ impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -34,7 +34,7 @@ impl cat { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; @@ -58,7 +58,7 @@ impl ToStr for cat { fn print_out(thing: @ToStr, expected: ~str) { let actual = thing.to_str(); - info!("%s", actual); + info2!("{}", actual); assert_eq!(actual, expected); } diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index e5220b15520a7..14acd1c911506 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -20,11 +20,11 @@ impl cat { pub fn eat(&mut self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -32,7 +32,7 @@ impl cat { impl cat { fn meow(&mut self) { - error!("Meow"); + error2!("Meow"); self.meows += 1u; if self.meows % 5u == 0u { self.how_hungry += 1; diff --git a/src/test/run-pass/cleanup-copy-mode.rs b/src/test/run-pass/cleanup-copy-mode.rs index 70f70430bb9ee..6381a402cfd96 100644 --- a/src/test/run-pass/cleanup-copy-mode.rs +++ b/src/test/run-pass/cleanup-copy-mode.rs @@ -11,7 +11,7 @@ use std::task; fn adder(x: @int, y: @int) -> int { return *x + *y; } -fn failer() -> @int { fail!(); } +fn failer() -> @int { fail2!(); } pub fn main() { assert!(task::try(|| { adder(@2, failer()); () diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index 8b7967ac1501e..4b6b3cca33408 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -40,7 +40,7 @@ fn f(a: A, b: u16) -> @Invokable { pub fn main() { let (a, b) = f(22_u64, 44u16).f(); - info!("a=%? b=%?", a, b); + info2!("a={:?} b={:?}", a, b); assert_eq!(a, 22u64); assert_eq!(b, 44u16); } diff --git a/src/test/run-pass/comm.rs b/src/test/run-pass/comm.rs index ac9501a71103a..63c1f4ed3d696 100644 --- a/src/test/run-pass/comm.rs +++ b/src/test/run-pass/comm.rs @@ -15,13 +15,13 @@ pub fn main() { let (p, ch) = stream(); let _t = task::spawn(|| child(&ch) ); let y = p.recv(); - error!("received"); - error!(y); + error2!("received"); + error2!("{:?}", y); assert_eq!(y, 10); } fn child(c: &Chan) { - error!("sending"); + error2!("sending"); c.send(10); - error!("value sent"); + error2!("value sent"); } diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 7a085c5d3e2dd..f395c6b7151cd 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -37,7 +37,7 @@ fn foo(x: int) -> int { pub fn main() { let x: int = 2 + 2; - info!("%?", x); - info!("hello, world"); - info!("%?", 10); + info2!("{}", x); + info2!("hello, world"); + info2!("{}", 10); } diff --git a/src/test/run-pass/conditional-debug-macro-off.rs b/src/test/run-pass/conditional-debug-macro-off.rs index 1aae5ce29c0f8..17062757286e5 100644 --- a/src/test/run-pass/conditional-debug-macro-off.rs +++ b/src/test/run-pass/conditional-debug-macro-off.rs @@ -14,5 +14,5 @@ fn main() { // only fails if debug! evaluates its argument. - debug!({ if true { fail!() } }); + debug2!("{:?}", { if true { fail2!() } }); } diff --git a/src/test/run-pass/conditional-debug-macro-on.rs b/src/test/run-pass/conditional-debug-macro-on.rs index 2fe6d179348fe..dec79f0cb5b75 100644 --- a/src/test/run-pass/conditional-debug-macro-on.rs +++ b/src/test/run-pass/conditional-debug-macro-on.rs @@ -14,7 +14,7 @@ fn main() { // exits early if debug! evaluates its arguments, otherwise it // will hit the fail. - debug!({ if true { return; } }); + debug2!("{:?}", { if true { return; } }); - fail!(); + fail2!(); } diff --git a/src/test/run-pass/const-big-enum.rs b/src/test/run-pass/const-big-enum.rs index ac2e879ceacc9..0a5a42116b982 100644 --- a/src/test/run-pass/const-big-enum.rs +++ b/src/test/run-pass/const-big-enum.rs @@ -19,18 +19,18 @@ static X: Foo = Baz; pub fn main() { match X { Baz => {} - _ => fail!() + _ => fail2!() } match Y { Bar(s) => assert!(s == 2654435769), - _ => fail!() + _ => fail2!() } match Z { Quux(d,h) => { assert_eq!(d, 0x123456789abcdef0); assert_eq!(h, 0x1234); } - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs index 098a001cfcde9..25e4b7189f273 100644 --- a/src/test/run-pass/const-enum-byref-self.rs +++ b/src/test/run-pass/const-enum-byref-self.rs @@ -15,7 +15,7 @@ impl E { pub fn method(&self) { match *self { V => {} - VV(*) => fail!() + VV(*) => fail2!() } } } diff --git a/src/test/run-pass/const-enum-byref.rs b/src/test/run-pass/const-enum-byref.rs index 83fafad4f99bb..22ec61f854474 100644 --- a/src/test/run-pass/const-enum-byref.rs +++ b/src/test/run-pass/const-enum-byref.rs @@ -14,7 +14,7 @@ static C: E = V; fn f(a: &E) { match *a { V => {} - VV(*) => fail!() + VV(*) => fail2!() } } diff --git a/src/test/run-pass/const-enum-ptr.rs b/src/test/run-pass/const-enum-ptr.rs index c1e3889d613d9..c75d1728ca94b 100644 --- a/src/test/run-pass/const-enum-ptr.rs +++ b/src/test/run-pass/const-enum-ptr.rs @@ -14,6 +14,6 @@ static C: &'static E = &V0; pub fn main() { match *C { V0 => (), - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs index cc9d24e16db2c..05f54d6bd7eed 100644 --- a/src/test/run-pass/const-enum-structlike.rs +++ b/src/test/run-pass/const-enum-structlike.rs @@ -17,7 +17,7 @@ static C: E = S1 { u: 23 }; pub fn main() { match C { - S0 { _ } => fail!(), + S0 { _ } => fail2!(), S1 { u } => assert!(u == 23) } } diff --git a/src/test/run-pass/const-enum-vec-index.rs b/src/test/run-pass/const-enum-vec-index.rs index 4c81eaae1d802..5b4ce1bc4efd2 100644 --- a/src/test/run-pass/const-enum-vec-index.rs +++ b/src/test/run-pass/const-enum-vec-index.rs @@ -16,10 +16,10 @@ static C1: E = C[1]; pub fn main() { match C0 { V0 => (), - _ => fail!() + _ => fail2!() } match C1 { V1(n) => assert!(n == 0xDEADBEE), - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/const-enum-vec-ptr.rs b/src/test/run-pass/const-enum-vec-ptr.rs index 95c4ed836c769..8b905042f7ffc 100644 --- a/src/test/run-pass/const-enum-vec-ptr.rs +++ b/src/test/run-pass/const-enum-vec-ptr.rs @@ -14,10 +14,10 @@ static C: &'static [E] = &[V0, V1(0xDEADBEE), V0]; pub fn main() { match C[1] { V1(n) => assert!(n == 0xDEADBEE), - _ => fail!() + _ => fail2!() } match C[2] { V0 => (), - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/const-enum-vector.rs b/src/test/run-pass/const-enum-vector.rs index 3dc5b918f7f58..cff5d4689e4d7 100644 --- a/src/test/run-pass/const-enum-vector.rs +++ b/src/test/run-pass/const-enum-vector.rs @@ -14,10 +14,10 @@ static C: [E, ..3] = [V0, V1(0xDEADBEE), V0]; pub fn main() { match C[1] { V1(n) => assert!(n == 0xDEADBEE), - _ => fail!() + _ => fail2!() } match C[2] { V0 => (), - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/const-nullary-enum.rs b/src/test/run-pass/const-nullary-enum.rs index bc61c8e9aecf5..ac9a7fa6552cd 100644 --- a/src/test/run-pass/const-nullary-enum.rs +++ b/src/test/run-pass/const-nullary-enum.rs @@ -19,11 +19,11 @@ static X: Foo = Bar; pub fn main() { match X { Bar => {} - Baz | Boo => fail!() + Baz | Boo => fail2!() } match Y { Baz => {} - Bar | Boo => fail!() + Bar | Boo => fail2!() } } diff --git a/src/test/run-pass/const.rs b/src/test/run-pass/const.rs index 402277c19b3c1..5696c163fc571 100644 --- a/src/test/run-pass/const.rs +++ b/src/test/run-pass/const.rs @@ -12,4 +12,4 @@ static i: int = 10; -pub fn main() { info!("%i", i); } +pub fn main() { info2!("{}", i); } diff --git a/src/test/run-pass/core-rt-smoke.rs b/src/test/run-pass/core-rt-smoke.rs index 6e3d9629da043..0260edf1182c6 100644 --- a/src/test/run-pass/core-rt-smoke.rs +++ b/src/test/run-pass/core-rt-smoke.rs @@ -15,6 +15,6 @@ #[start] fn start(argc: int, argv: **u8) -> int { do std::rt::start(argc, argv) { - info!("creating my own runtime is joy"); + info2!("creating my own runtime is joy"); } } diff --git a/src/test/run-pass/dead-code-one-arm-if.rs b/src/test/run-pass/dead-code-one-arm-if.rs index 2749fc31ceab7..9a2819c229371 100644 --- a/src/test/run-pass/dead-code-one-arm-if.rs +++ b/src/test/run-pass/dead-code-one-arm-if.rs @@ -12,4 +12,4 @@ // -*- rust -*- -pub fn main() { if 1 == 1 { return; } info!("Paul is dead"); } +pub fn main() { if 1 == 1 { return; } info2!("Paul is dead"); } diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index e2f615b3ed2b5..bc0b51c6b5d51 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -10,4 +10,4 @@ -pub fn main() { let x = @mut 5; *x = 1000; info!("%?", *x); } +pub fn main() { let x = @mut 5; *x = 1000; info2!("{:?}", *x); } diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index 431c856ee88a5..940ddc31f46a7 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -14,19 +14,19 @@ pub struct FailCmp; impl Eq for FailCmp { - fn eq(&self, _: &FailCmp) -> bool { fail!("eq") } + fn eq(&self, _: &FailCmp) -> bool { fail2!("eq") } } impl Ord for FailCmp { - fn lt(&self, _: &FailCmp) -> bool { fail!("lt") } + fn lt(&self, _: &FailCmp) -> bool { fail2!("lt") } } impl TotalEq for FailCmp { - fn equals(&self, _: &FailCmp) -> bool { fail!("equals") } + fn equals(&self, _: &FailCmp) -> bool { fail2!("equals") } } impl TotalOrd for FailCmp { - fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") } + fn cmp(&self, _: &FailCmp) -> Ordering { fail2!("cmp") } } #[deriving(Eq,Ord,TotalEq,TotalOrd)] diff --git a/src/test/run-pass/die-macro.rs b/src/test/run-pass/die-macro.rs index f08e5f054a9da..ade01142c35b7 100644 --- a/src/test/run-pass/die-macro.rs +++ b/src/test/run-pass/die-macro.rs @@ -3,9 +3,9 @@ #[allow(unreachable_code)]; fn f() { - fail!(); + fail2!(); - let _x: int = fail!(); + let _x: int = fail2!(); } pub fn main() { diff --git a/src/test/run-pass/enum-alignment.rs b/src/test/run-pass/enum-alignment.rs index 58a91d4dbce4b..a36aaaf936de9 100644 --- a/src/test/run-pass/enum-alignment.rs +++ b/src/test/run-pass/enum-alignment.rs @@ -27,7 +27,7 @@ fn is_aligned(ptr: &T) -> bool { pub fn main() { let x = Some(0u64); match x { - None => fail!(), + None => fail2!(), Some(ref y) => assert!(is_aligned(y)) } } diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index a0b180f6e6df2..71f0b0f9475a5 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -20,6 +20,6 @@ pub fn main() { }; assert_eq!(expected, V as u64); assert_eq!(expected, C as u64); - assert_eq!(fmt!("%?", V), ~"V"); - assert_eq!(fmt!("%?", C), ~"V"); + assert_eq!(format!("{:?}", V), ~"V"); + assert_eq!(format!("{:?}", C), ~"V"); } diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index 4764dbb9417fb..334047d6ca693 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -19,6 +19,6 @@ pub fn main() { match Cons(10, @Nil) { Cons(10, _) => {} Nil => {} - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/estr-slice.rs b/src/test/run-pass/estr-slice.rs index ca2039fedede1..145f04009d16c 100644 --- a/src/test/run-pass/estr-slice.rs +++ b/src/test/run-pass/estr-slice.rs @@ -14,8 +14,8 @@ pub fn main() { let v = &"hello"; let y : &str = &"there"; - info!(x); - info!(y); + info2!("{}", x); + info2!("{}", y); assert_eq!(x[0], 'h' as u8); assert_eq!(x[4], 'o' as u8); @@ -30,7 +30,7 @@ pub fn main() { let c = &"cccc"; let cc = &"ccccc"; - info!(a); + info2!("{}", a); assert!(a < b); assert!(a <= b); @@ -38,7 +38,7 @@ pub fn main() { assert!(b >= a); assert!(b > a); - info!(b); + info2!("{}", b); assert!(a < c); assert!(a <= c); @@ -46,7 +46,7 @@ pub fn main() { assert!(c >= a); assert!(c > a); - info!(c); + info2!("{}", c); assert!(c < cc); assert!(c <= cc); @@ -54,5 +54,5 @@ pub fn main() { assert!(cc >= c); assert!(cc > c); - info!(cc); + info2!("{}", cc); } diff --git a/src/test/run-pass/evec-slice.rs b/src/test/run-pass/evec-slice.rs index 4a14faf1f84e1..32de1ad79b265 100644 --- a/src/test/run-pass/evec-slice.rs +++ b/src/test/run-pass/evec-slice.rs @@ -22,7 +22,7 @@ pub fn main() { let c : &[int] = &[2,2,2,2,3]; let cc : &[int] = &[2,2,2,2,2,2]; - info!(a); + info2!("{:?}", a); assert!(a < b); assert!(a <= b); @@ -30,7 +30,7 @@ pub fn main() { assert!(b >= a); assert!(b > a); - info!(b); + info2!("{:?}", b); assert!(b < c); assert!(b <= c); @@ -44,7 +44,7 @@ pub fn main() { assert!(c >= a); assert!(c > a); - info!(c); + info2!("{:?}", c); assert!(a < cc); assert!(a <= cc); @@ -52,5 +52,5 @@ pub fn main() { assert!(cc >= a); assert!(cc > a); - info!(cc); + info2!("{:?}", cc); } diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index 95d61e08eb89c..9147596b0db75 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -13,7 +13,7 @@ mod foo { pub fn y() { super::super::foo::x(); } } - pub fn x() { info!("x"); } + pub fn x() { info2!("x"); } } pub fn main() { self::foo::bar::y(); } diff --git a/src/test/run-pass/export-non-interference3.rs b/src/test/run-pass/export-non-interference3.rs index e2af3121f16e1..b06323741a5c2 100644 --- a/src/test/run-pass/export-non-interference3.rs +++ b/src/test/run-pass/export-non-interference3.rs @@ -15,7 +15,7 @@ pub mod foo { } pub mod bar { - pub fn x() { info!("x"); } + pub fn x() { info2!("x"); } } pub fn main() { foo::x(); } diff --git a/src/test/run-pass/expr-block-generic-box1.rs b/src/test/run-pass/expr-block-generic-box1.rs index 12b387b7eae5e..710cab50fba69 100644 --- a/src/test/run-pass/expr-block-generic-box1.rs +++ b/src/test/run-pass/expr-block-generic-box1.rs @@ -21,8 +21,8 @@ fn test_generic(expected: @T, eq: compare) { fn test_box() { fn compare_box(b1: @bool, b2: @bool) -> bool { - info!(*b1); - info!(*b2); + info2!("{}", *b1); + info2!("{}", *b2); return *b1 == *b2; } test_generic::(@true, compare_box); diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index 3f9c101761f8d..f22ef2138ff82 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -20,8 +20,8 @@ fn test_generic(expected: ~T, eq: compare) { fn test_box() { fn compare_box(b1: ~bool, b2: ~bool) -> bool { - info!(*b1); - info!(*b2); + info2!("{}", *b1); + info2!("{}", *b2); return *b1 == *b2; } test_generic::(~true, compare_box); diff --git a/src/test/run-pass/expr-if-fail-all.rs b/src/test/run-pass/expr-if-fail-all.rs index a34620d2e1be4..b19b9ceaa00b9 100644 --- a/src/test/run-pass/expr-if-fail-all.rs +++ b/src/test/run-pass/expr-if-fail-all.rs @@ -14,6 +14,6 @@ pub fn main() { let _x = if true { 10 } else { - if true { fail!() } else { fail!() } + if true { fail2!() } else { fail2!() } }; } diff --git a/src/test/run-pass/expr-if-fail.rs b/src/test/run-pass/expr-if-fail.rs index f79b7198b50e7..966a1db1d0e60 100644 --- a/src/test/run-pass/expr-if-fail.rs +++ b/src/test/run-pass/expr-if-fail.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn test_if_fail() { let x = if false { fail!() } else { 10 }; assert!((x == 10)); } +fn test_if_fail() { let x = if false { fail2!() } else { 10 }; assert!((x == 10)); } fn test_else_fail() { - let x = if true { 10 } else { fail!() }; + let x = if true { 10 } else { fail2!() }; assert_eq!(x, 10); } fn test_elseif_fail() { - let x = if false { 0 } else if false { fail!() } else { 10 }; + let x = if false { 0 } else if false { fail2!() } else { 10 }; assert_eq!(x, 10); } diff --git a/src/test/run-pass/expr-match-box.rs b/src/test/run-pass/expr-match-box.rs index 84a78637187fc..6f638758ed882 100644 --- a/src/test/run-pass/expr-match-box.rs +++ b/src/test/run-pass/expr-match-box.rs @@ -15,13 +15,13 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { @100 } _ => fail!("wat") }; + let res = match true { true => { @100 } _ => fail2!("wat") }; assert_eq!(*res, 100); } fn test_str() { let res = match true { true => { ~"happy" }, - _ => fail!("not happy at all") }; + _ => fail2!("not happy at all") }; assert_eq!(res, ~"happy"); } diff --git a/src/test/run-pass/expr-match-fail-all.rs b/src/test/run-pass/expr-match-fail-all.rs index aef11a78e0dbb..418031243ee5e 100644 --- a/src/test/run-pass/expr-match-fail-all.rs +++ b/src/test/run-pass/expr-match-fail-all.rs @@ -17,6 +17,6 @@ pub fn main() { let _x = match true { true => { 10 } - false => { match true { true => { fail!() } false => { fail!() } } } + false => { match true { true => { fail2!() } false => { fail2!() } } } }; } diff --git a/src/test/run-pass/expr-match-fail.rs b/src/test/run-pass/expr-match-fail.rs index 3e1b96763e196..c1081561b6f12 100644 --- a/src/test/run-pass/expr-match-fail.rs +++ b/src/test/run-pass/expr-match-fail.rs @@ -9,12 +9,12 @@ // except according to those terms. fn test_simple() { - let r = match true { true => { true } false => { fail!() } }; + let r = match true { true => { true } false => { fail2!() } }; assert_eq!(r, true); } fn test_box() { - let r = match true { true => { ~[10] } false => { fail!() } }; + let r = match true { true => { ~[10] } false => { fail2!() } }; assert_eq!(r[0], 10); } diff --git a/src/test/run-pass/expr-match-generic-box1.rs b/src/test/run-pass/expr-match-generic-box1.rs index 064e334362050..e70a18a7f6d80 100644 --- a/src/test/run-pass/expr-match-generic-box1.rs +++ b/src/test/run-pass/expr-match-generic-box1.rs @@ -15,7 +15,7 @@ type compare = &'static fn(@T, @T) -> bool; fn test_generic(expected: @T, eq: compare) { - let actual: @T = match true { true => { expected }, _ => fail!() }; + let actual: @T = match true { true => { expected }, _ => fail2!() }; assert!((eq(expected, actual))); } diff --git a/src/test/run-pass/expr-match-generic-box2.rs b/src/test/run-pass/expr-match-generic-box2.rs index bca06ebdbb5f3..92e13e36d073a 100644 --- a/src/test/run-pass/expr-match-generic-box2.rs +++ b/src/test/run-pass/expr-match-generic-box2.rs @@ -14,7 +14,7 @@ type compare = &'static fn(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") }; + let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") }; assert!((eq(expected, actual))); } diff --git a/src/test/run-pass/expr-match-generic-unique1.rs b/src/test/run-pass/expr-match-generic-unique1.rs index 7371f8fd89b9c..e4a6fa516c5bd 100644 --- a/src/test/run-pass/expr-match-generic-unique1.rs +++ b/src/test/run-pass/expr-match-generic-unique1.rs @@ -16,7 +16,7 @@ type compare = &'static fn(~T, ~T) -> bool; fn test_generic(expected: ~T, eq: compare) { let actual: ~T = match true { true => { expected.clone() }, - _ => fail!("wat") + _ => fail2!("wat") }; assert!((eq(expected, actual))); } diff --git a/src/test/run-pass/expr-match-generic-unique2.rs b/src/test/run-pass/expr-match-generic-unique2.rs index d07d40e675766..09278fad75ce9 100644 --- a/src/test/run-pass/expr-match-generic-unique2.rs +++ b/src/test/run-pass/expr-match-generic-unique2.rs @@ -16,7 +16,7 @@ type compare<'self, T> = &'self fn(T, T) -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => expected.clone(), - _ => fail!("wat") + _ => fail2!("wat") }; assert!((eq(expected, actual))); } diff --git a/src/test/run-pass/expr-match-generic.rs b/src/test/run-pass/expr-match-generic.rs index b43085d346f30..d98cd130022fe 100644 --- a/src/test/run-pass/expr-match-generic.rs +++ b/src/test/run-pass/expr-match-generic.rs @@ -14,7 +14,7 @@ type compare = extern "Rust" fn(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") }; + let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") }; assert!((eq(expected, actual))); } diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs index 7cfcc38f8dd31..7fa58a535b0a4 100644 --- a/src/test/run-pass/expr-match-struct.rs +++ b/src/test/run-pass/expr-match-struct.rs @@ -17,7 +17,7 @@ struct R { i: int } fn test_rec() { - let rs = match true { true => R {i: 100}, _ => fail!() }; + let rs = match true { true => R {i: 100}, _ => fail2!() }; assert_eq!(rs.i, 100); } diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs index cdd4e45877ad6..7f610d1babd87 100644 --- a/src/test/run-pass/expr-match-unique.rs +++ b/src/test/run-pass/expr-match-unique.rs @@ -15,7 +15,7 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { ~100 }, _ => fail!() }; + let res = match true { true => { ~100 }, _ => fail2!() }; assert_eq!(*res, 100); } diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs index 1153cb4177daa..41ae128626bef 100644 --- a/src/test/run-pass/extern-call-deep.rs +++ b/src/test/run-pass/extern-call-deep.rs @@ -31,13 +31,13 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { #[fixed_stack_segment] fn count(n: uint) -> uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } pub fn main() { let result = count(1000u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 1000u); } diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs index a8fa9c2cef028..0490949e8a475 100644 --- a/src/test/run-pass/extern-call-deep2.rs +++ b/src/test/run-pass/extern-call-deep2.rs @@ -32,7 +32,7 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { #[fixed_stack_segment] #[inline(never)] fn count(n: uint) -> uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } @@ -42,7 +42,7 @@ pub fn main() { // has a large stack) do task::spawn { let result = count(1000u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 1000u); }; } diff --git a/src/test/run-pass/extern-call-indirect.rs b/src/test/run-pass/extern-call-indirect.rs index 9929cb447a6c7..733625f492ef9 100644 --- a/src/test/run-pass/extern-call-indirect.rs +++ b/src/test/run-pass/extern-call-indirect.rs @@ -31,13 +31,13 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { #[fixed_stack_segment] #[inline(never)] fn fact(n: uint) -> uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } pub fn main() { let result = fact(10u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 3628800u); } diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index 4388ef65e9865..74b1ed9a5c423 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -36,7 +36,7 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { #[fixed_stack_segment] #[inline(never)] fn count(n: uint) -> uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } @@ -46,7 +46,7 @@ pub fn main() { // has a large stack) do task::spawn { let result = count(12u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 2048u); }; } diff --git a/src/test/run-pass/extern-crosscrate.rs b/src/test/run-pass/extern-crosscrate.rs index 7db7b898c0e6d..3367b795462b3 100644 --- a/src/test/run-pass/extern-crosscrate.rs +++ b/src/test/run-pass/extern-crosscrate.rs @@ -16,13 +16,13 @@ extern mod externcallback(vers = "0.1"); #[fixed_stack_segment] #[inline(never)] fn fact(n: uint) -> uint { unsafe { - info!("n = %?", n); + info2!("n = {}", n); externcallback::rustrt::rust_dbg_call(externcallback::cb, n) } } pub fn main() { let result = fact(10u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 3628800u); } diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index fd0807dffc84c..7e71d416b55a8 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -41,7 +41,7 @@ pub fn main() { do 10u.times { do task::spawn { let result = count(5u); - info!("result = %?", result); + info2!("result = {}", result); assert_eq!(result, 16u); }; } diff --git a/src/test/run-pass/fact.rs b/src/test/run-pass/fact.rs index ff651effc8d4d..f0379e1dac1c9 100644 --- a/src/test/run-pass/fact.rs +++ b/src/test/run-pass/fact.rs @@ -15,7 +15,7 @@ fn f(x: int) -> int { // info!("in f:"); - info!(x); + info2!("{}", x); if x == 1 { // info!("bottoming out"); @@ -26,7 +26,7 @@ fn f(x: int) -> int { let y: int = x * f(x - 1); // info!("returned"); - info!(y); + info2!("{}", y); return y; } } diff --git a/src/test/run-pass/fat-arrow-match.rs b/src/test/run-pass/fat-arrow-match.rs index f6b49960fad70..be945e93ec9d0 100644 --- a/src/test/run-pass/fat-arrow-match.rs +++ b/src/test/run-pass/fat-arrow-match.rs @@ -17,7 +17,7 @@ enum color { } pub fn main() { - error!(match red { + error2!("{}", match red { red => { 1 } green => { 2 } blue => { 3 } diff --git a/src/test/run-pass/float-signature.rs b/src/test/run-pass/float-signature.rs index f6a9e05d81803..5193d1e559d29 100644 --- a/src/test/run-pass/float-signature.rs +++ b/src/test/run-pass/float-signature.rs @@ -14,5 +14,5 @@ pub fn main() { fn foo(n: float) -> float { return n + 0.12345; } let n: float = 0.1; let m: float = foo(n); - info!(m); + info2!("{}", m); } diff --git a/src/test/run-pass/float.rs b/src/test/run-pass/float.rs index a9f1555ade419..1418255d601ca 100644 --- a/src/test/run-pass/float.rs +++ b/src/test/run-pass/float.rs @@ -12,9 +12,9 @@ pub fn main() { let pi = 3.1415927; - info!(-pi * (pi + 2.0 / pi) - pi * 5.0); + info2!("{:?}", -pi * (pi + 2.0 / pi) - pi * 5.0); if pi == 5.0 || pi < 10.0 || pi <= 2.0 || pi != 22.0 / 7.0 || pi >= 10.0 || pi > 1.0 { - info!("yes"); + info2!("yes"); } } diff --git a/src/test/run-pass/fn-bare-item.rs b/src/test/run-pass/fn-bare-item.rs index e01c7ee998c31..be0f686c5a403 100644 --- a/src/test/run-pass/fn-bare-item.rs +++ b/src/test/run-pass/fn-bare-item.rs @@ -9,7 +9,7 @@ // except according to those terms. fn f() { - info!("This is a bare function"); + info2!("This is a bare function"); } pub fn main() { diff --git a/src/test/run-pass/for-loop-fail.rs b/src/test/run-pass/for-loop-fail.rs index ff718500340c8..9599c5852df89 100644 --- a/src/test/run-pass/for-loop-fail.rs +++ b/src/test/run-pass/for-loop-fail.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { let x: ~[int] = ~[]; for _ in x.iter() { fail!("moop"); } } +pub fn main() { let x: ~[int] = ~[]; for _ in x.iter() { fail2!("moop"); } } diff --git a/src/test/run-pass/foreach-put-structured.rs b/src/test/run-pass/foreach-put-structured.rs index bd3799e47e1e5..6e20bb20bd936 100644 --- a/src/test/run-pass/foreach-put-structured.rs +++ b/src/test/run-pass/foreach-put-structured.rs @@ -21,8 +21,8 @@ pub fn main() { let mut j: int = 0; do pairs() |p| { let (_0, _1) = p; - info!(_0); - info!(_1); + info2!("{}", _0); + info2!("{}", _1); assert_eq!(_0 + 10, i); i += 1; j = _1; diff --git a/src/test/run-pass/foreach-simple-outer-slot.rs b/src/test/run-pass/foreach-simple-outer-slot.rs index 9292c11570587..b5fa186902e39 100644 --- a/src/test/run-pass/foreach-simple-outer-slot.rs +++ b/src/test/run-pass/foreach-simple-outer-slot.rs @@ -14,13 +14,13 @@ // -*- rust -*- pub fn main() { let mut sum: int = 0; - do first_ten |i| { info!("main"); info!(i); sum = sum + i; } - info!("sum"); - info!(sum); + do first_ten |i| { info2!("main"); info2!("{}", i); sum = sum + i; } + info2!("sum"); + info2!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; - while i < 10 { info!("first_ten"); it(i); i = i + 1; } + while i < 10 { info2!("first_ten"); it(i); i = i + 1; } } diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs index 2cd505f1f7d25..b4412db1a5881 100644 --- a/src/test/run-pass/generic-alias-box.rs +++ b/src/test/run-pass/generic-alias-box.rs @@ -15,6 +15,6 @@ fn id(t: T) -> T { return t; } pub fn main() { let expected = @100; let actual = id::<@int>(expected); - info!(*actual); + info2!("{:?}", *actual); assert_eq!(*expected, *actual); } diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 7a6cb9470b2a4..ab50b70b1b8c8 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -15,6 +15,6 @@ fn id(t: T) -> T { return t; } pub fn main() { let expected = ~100; let actual = id::<~int>(expected.clone()); - info!(*actual); + info2!("{:?}", *actual); assert_eq!(*expected, *actual); } diff --git a/src/test/run-pass/generic-derived-type.rs b/src/test/run-pass/generic-derived-type.rs index 3c30a6b53afa3..7ce3dc7a03da7 100644 --- a/src/test/run-pass/generic-derived-type.rs +++ b/src/test/run-pass/generic-derived-type.rs @@ -25,8 +25,8 @@ fn f(t: T) -> Pair { pub fn main() { let b = f::(10); - info!(b.a); - info!(b.b); + info2!("{:?}" ,b.a); + info2!("{:?}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } diff --git a/src/test/run-pass/generic-fn-box.rs b/src/test/run-pass/generic-fn-box.rs index 97905449fbef0..c5d6d23d9487c 100644 --- a/src/test/run-pass/generic-fn-box.rs +++ b/src/test/run-pass/generic-fn-box.rs @@ -12,4 +12,4 @@ fn f(x: @T) -> @T { return x; } -pub fn main() { let x = f(@3); info!(*x); } +pub fn main() { let x = f(@3); info2!("{:?}", *x); } diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index 3c28b16d3a981..d4ba0ddfc8e44 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -11,4 +11,4 @@ fn f(x: ~T) -> ~T { return x; } -pub fn main() { let x = f(~3); info!(*x); } +pub fn main() { let x = f(~3); info2!("{:?}", *x); } diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs index d14ee82e45eab..4d8b382b511ea 100644 --- a/src/test/run-pass/generic-fn.rs +++ b/src/test/run-pass/generic-fn.rs @@ -23,14 +23,14 @@ pub fn main() { let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::(x); - info!(y); + info2!("{}", y); assert_eq!(x, y); b = id::(a); - info!(b); + info2!("{}", b); assert_eq!(a, b); q = id::(p); x = p.z; y = q.z; - info!(y); + info2!("{}", y); assert_eq!(x, y); } diff --git a/src/test/run-pass/generic-tag-match.rs b/src/test/run-pass/generic-tag-match.rs index f740d8cb2d159..7b3b11189746a 100644 --- a/src/test/run-pass/generic-tag-match.rs +++ b/src/test/run-pass/generic-tag-match.rs @@ -14,7 +14,7 @@ enum foo { arm(T), } fn altfoo(f: foo) { let mut hit = false; - match f { arm::(_x) => { info!("in arm"); hit = true; } } + match f { arm::(_x) => { info2!("in arm"); hit = true; } } assert!((hit)); } diff --git a/src/test/run-pass/generic-tag-values.rs b/src/test/run-pass/generic-tag-values.rs index d132eb5d5a96d..739eb9f0aca3c 100644 --- a/src/test/run-pass/generic-tag-values.rs +++ b/src/test/run-pass/generic-tag-values.rs @@ -18,12 +18,12 @@ struct Pair { x: int, y: int } pub fn main() { let nop: noption = some::(5); - match nop { some::(n) => { info!(n); assert!((n == 5)); } } + match nop { some::(n) => { info2!("{:?}", n); assert!((n == 5)); } } let nop2: noption = some(Pair{x: 17, y: 42}); match nop2 { some(t) => { - info!(t.x); - info!(t.y); + info2!("{:?}", t.x); + info2!("{:?}", t.y); assert_eq!(t.x, 17); assert_eq!(t.y, 42); } diff --git a/src/test/run-pass/generic-temporary.rs b/src/test/run-pass/generic-temporary.rs index 82c8a3e85c689..5143676f34a5b 100644 --- a/src/test/run-pass/generic-temporary.rs +++ b/src/test/run-pass/generic-temporary.rs @@ -12,7 +12,7 @@ fn mk() -> int { return 1; } -fn chk(a: int) { info!(a); assert!((a == 1)); } +fn chk(a: int) { info2!("{}", a); assert!((a == 1)); } fn apply(produce: extern fn() -> T, consume: extern fn(T)) { diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index 4a74330f7d67e..f9f5da51196b5 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -11,7 +11,7 @@ fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } pub fn main() { - info!(get_third((1, 2, 3))); + info2!("{:?}", get_third((1, 2, 3))); assert_eq!(get_third((1, 2, 3)), 3); assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8); } diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs index d1964b5d94b82..1f98b445b169d 100644 --- a/src/test/run-pass/getopts_ref.rs +++ b/src/test/run-pass/getopts_ref.rs @@ -21,7 +21,7 @@ pub fn main() { match getopts(args, opts) { Ok(ref m) => assert!(!m.opt_present("b")), - Err(ref f) => fail!((*f).clone().to_err_msg()) + Err(ref f) => fail2!("{:?}", (*f).clone().to_err_msg()) }; } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 15286a85c01b2..bf79768c7be1a 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -47,11 +47,11 @@ mod map_reduce { return; } let (pp, cc) = stream(); - error!("sending find_reducer"); + error2!("sending find_reducer"); ctrl.send(find_reducer(key.as_bytes().to_owned(), cc)); - error!("receiving"); + error2!("receiving"); let c = pp.recv(); - error!(c); + error2!("{:?}", c); im.insert(key, c); } diff --git a/src/test/run-pass/if-bot.rs b/src/test/run-pass/if-bot.rs index 125ea295e65aa..768f3431832da 100644 --- a/src/test/run-pass/if-bot.rs +++ b/src/test/run-pass/if-bot.rs @@ -11,6 +11,6 @@ pub fn main() { - let i: int = if false { fail!() } else { 5 }; - info!(i); + let i: int = if false { fail2!() } else { 5 }; + info2!("{:?}", i); } diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs index 3fb45f82f57dc..0fd5fc01d1762 100644 --- a/src/test/run-pass/if-check.rs +++ b/src/test/run-pass/if-check.rs @@ -16,9 +16,9 @@ fn even(x: uint) -> bool { fn foo(x: uint) { if even(x) { - info!(x); + info2!("{}", x); } else { - fail!(); + fail2!(); } } diff --git a/src/test/run-pass/import-glob-0.rs b/src/test/run-pass/import-glob-0.rs index 378bc25eaf6ad..f71bdb4e182da 100644 --- a/src/test/run-pass/import-glob-0.rs +++ b/src/test/run-pass/import-glob-0.rs @@ -14,10 +14,10 @@ use module_of_many_things::*; use dug::too::greedily::and::too::deep::*; mod module_of_many_things { - pub fn f1() { info!("f1"); } - pub fn f2() { info!("f2"); } - fn f3() { info!("f3"); } - pub fn f4() { info!("f4"); } + pub fn f1() { info2!("f1"); } + pub fn f2() { info2!("f2"); } + fn f3() { info2!("f3"); } + pub fn f4() { info2!("f4"); } } mod dug { @@ -26,8 +26,8 @@ mod dug { pub mod and { pub mod too { pub mod deep { - pub fn nameless_fear() { info!("Boo!"); } - pub fn also_redstone() { info!("Whatever."); } + pub fn nameless_fear() { info2!("Boo!"); } + pub fn also_redstone() { info2!("Whatever."); } } } } diff --git a/src/test/run-pass/import.rs b/src/test/run-pass/import.rs index dcbe038c65af4..eff085e687dfc 100644 --- a/src/test/run-pass/import.rs +++ b/src/test/run-pass/import.rs @@ -11,7 +11,7 @@ // except according to those terms. mod foo { - pub fn x(y: int) { info!(y); } + pub fn x(y: int) { info2!("{:?}", y); } } mod bar { diff --git a/src/test/run-pass/import2.rs b/src/test/run-pass/import2.rs index 9cda55f508408..3ca64ce199ec5 100644 --- a/src/test/run-pass/import2.rs +++ b/src/test/run-pass/import2.rs @@ -14,7 +14,7 @@ use zed::bar; mod zed { - pub fn bar() { info!("bar"); } + pub fn bar() { info2!("bar"); } } pub fn main() { bar(); } diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs index 64d47bf22195f..10f6d87bf4cfd 100644 --- a/src/test/run-pass/import3.rs +++ b/src/test/run-pass/import3.rs @@ -17,7 +17,7 @@ use baz::zed::bar; mod baz { pub mod zed { - pub fn bar() { info!("bar2"); } + pub fn bar() { info2!("bar2"); } } } diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs index d368ab2e993db..d453306317bb7 100644 --- a/src/test/run-pass/import4.rs +++ b/src/test/run-pass/import4.rs @@ -14,7 +14,7 @@ use zed::bar; mod zed { - pub fn bar() { info!("bar"); } + pub fn bar() { info2!("bar"); } } pub fn main() { let _zed = 42; bar(); } diff --git a/src/test/run-pass/import5.rs b/src/test/run-pass/import5.rs index e9539b290ae1d..00c5f35c54239 100644 --- a/src/test/run-pass/import5.rs +++ b/src/test/run-pass/import5.rs @@ -14,7 +14,7 @@ use foo::bar; mod foo { pub use foo::zed::bar; pub mod zed { - pub fn bar() { info!("foo"); } + pub fn bar() { info2!("foo"); } } } diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs index 4f813247576c8..150a89f61769d 100644 --- a/src/test/run-pass/import6.rs +++ b/src/test/run-pass/import6.rs @@ -17,7 +17,7 @@ use bar::baz; mod foo { pub mod zed { - pub fn baz() { info!("baz"); } + pub fn baz() { info2!("baz"); } } } mod bar { diff --git a/src/test/run-pass/import7.rs b/src/test/run-pass/import7.rs index 63a30ccee2ceb..e9241882f6559 100644 --- a/src/test/run-pass/import7.rs +++ b/src/test/run-pass/import7.rs @@ -17,7 +17,7 @@ use bar::baz; mod foo { pub mod zed { - pub fn baz() { info!("baz"); } + pub fn baz() { info2!("baz"); } } } mod bar { diff --git a/src/test/run-pass/import8.rs b/src/test/run-pass/import8.rs index 849522ab6e599..9b0c512d4f1f4 100644 --- a/src/test/run-pass/import8.rs +++ b/src/test/run-pass/import8.rs @@ -15,7 +15,7 @@ use foo::x; use z = foo::x; mod foo { - pub fn x(y: int) { info!(y); } + pub fn x(y: int) { info2!("{}", y); } } pub fn main() { x(10); z(10); } diff --git a/src/test/run-pass/inner-module.rs b/src/test/run-pass/inner-module.rs index 1e53dd849fc8f..7e3547ba7f329 100644 --- a/src/test/run-pass/inner-module.rs +++ b/src/test/run-pass/inner-module.rs @@ -14,7 +14,7 @@ // -*- rust -*- mod inner { pub mod inner2 { - pub fn hello() { info!("hello, modular world"); } + pub fn hello() { info2!("hello, modular world"); } } pub fn hello() { inner2::hello(); } } diff --git a/src/test/run-pass/integral-indexing.rs b/src/test/run-pass/integral-indexing.rs index 1915e8ac800a7..05032dda759b0 100644 --- a/src/test/run-pass/integral-indexing.rs +++ b/src/test/run-pass/integral-indexing.rs @@ -20,11 +20,11 @@ pub fn main() { assert_eq!(v[3i8], 3); assert_eq!(v[3u32], 3); assert_eq!(v[3i32], 3); - info!(v[3u8]); + info2!("{}", v[3u8]); assert_eq!(s[3u], 'd' as u8); assert_eq!(s[3u8], 'd' as u8); assert_eq!(s[3i8], 'd' as u8); assert_eq!(s[3u32], 'd' as u8); assert_eq!(s[3i32], 'd' as u8); - info!(s[3u8]); + info2!("{}", s[3u8]); } diff --git a/src/test/run-pass/issue-1516.rs b/src/test/run-pass/issue-1516.rs index 4b73d83595e64..17444e657087c 100644 --- a/src/test/run-pass/issue-1516.rs +++ b/src/test/run-pass/issue-1516.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - let early_error: &'static fn(&str) -> ! = |_msg| { fail!() }; + let early_error: &'static fn(&str) -> ! = |_msg| { fail2!() }; } diff --git a/src/test/run-pass/issue-1696.rs b/src/test/run-pass/issue-1696.rs index d8023d2e7167d..de62c57ab9fa2 100644 --- a/src/test/run-pass/issue-1696.rs +++ b/src/test/run-pass/issue-1696.rs @@ -15,5 +15,5 @@ use std::hashmap::HashMap; pub fn main() { let mut m = HashMap::new(); m.insert("foo".as_bytes().to_owned(), "bar".as_bytes().to_owned()); - error!(m); + error2!("{:?}", m); } diff --git a/src/test/run-pass/issue-2216.rs b/src/test/run-pass/issue-2216.rs index 0914c81c3ff17..4ad7d9500f674 100644 --- a/src/test/run-pass/issue-2216.rs +++ b/src/test/run-pass/issue-2216.rs @@ -27,6 +27,6 @@ pub fn main() { break; } - error!("%?", x); + error2!("{:?}", x); assert_eq!(x, 42); } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index b03bfb958af1b..cf8d3dc642c2b 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -15,7 +15,7 @@ struct foo { impl foo { pub fn bar>(&self, _c: C) -> B { - fail!(); + fail2!(); } } diff --git a/src/test/run-pass/issue-2312.rs b/src/test/run-pass/issue-2312.rs index 14b5efe904db8..54a8730fa1bb2 100644 --- a/src/test/run-pass/issue-2312.rs +++ b/src/test/run-pass/issue-2312.rs @@ -15,7 +15,7 @@ trait clam { } struct foo(int); impl foo { - pub fn bar>(&self, _c: C) -> B { fail!(); } + pub fn bar>(&self, _c: C) -> B { fail2!(); } } pub fn main() { } diff --git a/src/test/run-pass/issue-2611-3.rs b/src/test/run-pass/issue-2611-3.rs index 3cc7296fa4a8e..5882edf18803e 100644 --- a/src/test/run-pass/issue-2611-3.rs +++ b/src/test/run-pass/issue-2611-3.rs @@ -20,7 +20,8 @@ struct E { } impl A for E { - fn b(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but + fn b(_x: F) -> F { fail2!() } + //~^ ERROR in method `b`, type parameter 0 has 1 bound, but } pub fn main() {} diff --git a/src/test/run-pass/issue-2633.rs b/src/test/run-pass/issue-2633.rs index bde18d77b9add..e905c895c3510 100644 --- a/src/test/run-pass/issue-2633.rs +++ b/src/test/run-pass/issue-2633.rs @@ -13,7 +13,7 @@ struct cat { } fn meow() { - error!("meow") + error2!("meow") } fn cat() -> cat { diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 19f0843efd82c..617f98cdb5f19 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -52,9 +52,9 @@ pub mod pipes { } mod rusti { - pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail!(); } - pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail!(); } - pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail!(); } + pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail2!(); } + pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail2!(); } + pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail2!(); } } // We should consider moving this to ::std::unsafe, although I @@ -88,7 +88,7 @@ pub mod pipes { // The receiver will eventually clean this up. unsafe { forget(p); } } - full => { fail!("duplicate send") } + full => { fail2!("duplicate send") } blocked => { // The receiver will eventually clean this up. @@ -130,7 +130,7 @@ pub mod pipes { } full => { // This is impossible - fail!("you dun goofed") + fail2!("you dun goofed") } terminated => { // I have to clean up, use drop_glue @@ -147,7 +147,7 @@ pub mod pipes { } blocked => { // this shouldn't happen. - fail!("terminating a blocked packet") + fail2!("terminating a blocked packet") } terminated | full => { // I have to clean up, use drop_glue @@ -232,7 +232,7 @@ pub mod pingpong { let _addr : *::pipes::send_packet = match &p { &ping(ref x) => { cast::transmute(x) } }; - fail!() + fail2!() } } @@ -241,7 +241,7 @@ pub mod pingpong { let _addr : *::pipes::send_packet = match &p { &pong(ref x) => { cast::transmute(x) } }; - fail!() + fail2!() } } @@ -265,7 +265,7 @@ pub mod pingpong { pub fn do_pong(c: pong) -> (ping, ()) { let packet = ::pipes::recv(c); if packet.is_none() { - fail!("sender closed the connection") + fail2!("sender closed the connection") } (pingpong::liberate_pong(packet.unwrap()), ()) } @@ -280,7 +280,7 @@ pub mod pingpong { pub fn do_ping(c: ping) -> (pong, ()) { let packet = ::pipes::recv(c); if packet.is_none() { - fail!("sender closed the connection") + fail2!("sender closed the connection") } (pingpong::liberate_ping(packet.unwrap()), ()) } @@ -295,16 +295,16 @@ pub mod pingpong { fn client(chan: pingpong::client::ping) { let chan = pingpong::client::do_ping(chan); - error!(~"Sent ping"); + error2!("Sent ping"); let (_chan, _data) = pingpong::client::do_pong(chan); - error!(~"Received pong"); + error2!("Received pong"); } fn server(chan: pingpong::server::ping) { let (chan, _data) = pingpong::server::do_ping(chan); - error!(~"Received ping"); + error2!("Received ping"); let _chan = pingpong::server::do_pong(chan); - error!(~"Sent pong"); + error2!("Sent pong"); } pub fn main() { diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs index 917839a5401e2..8fad80ce238ee 100644 --- a/src/test/run-pass/issue-2804-2.rs +++ b/src/test/run-pass/issue-2804-2.rs @@ -16,7 +16,7 @@ use std::hashmap::HashMap; fn add_interfaces(managed_ip: ~str, device: HashMap<~str, int>) { - error!("%s, %?", managed_ip, device.get(&~"interfaces")); + error2!("{}, {:?}", managed_ip, device.get(&~"interfaces")); } pub fn main() {} diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 37cf2658ebc87..efcdbaa482c07 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -28,7 +28,7 @@ fn lookup(table: ~json::Object, key: ~str, default: ~str) -> ~str (*s).clone() } option::Some(value) => { - error!("%s was expected to be a string but is a %?", key, value); + error2!("{} was expected to be a string but is a {:?}", key, value); default } option::None => { @@ -42,12 +42,12 @@ fn add_interface(_store: int, managed_ip: ~str, data: extra::json::Json) -> (~st match &data { &extra::json::Object(ref interface) => { let name = lookup((*interface).clone(), ~"ifDescr", ~""); - let label = fmt!("%s-%s", managed_ip, name); + let label = format!("{}-{}", managed_ip, name); (label, bool_value(false)) } _ => { - error!("Expected dict for %s interfaces but found %?", managed_ip, data); + error2!("Expected dict for {} interfaces but found {:?}", managed_ip, data); (~"gnos:missing-interface", bool_value(true)) } } @@ -65,7 +65,7 @@ fn add_interfaces(store: int, managed_ip: ~str, device: HashMap<~str, extra::jso } _ => { - error!("Expected list for %s interfaces but found %?", managed_ip, + error2!("Expected list for {} interfaces but found {:?}", managed_ip, device.get(&~"interfaces")); ~[] } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 978099be119bd..f2a4692d39651 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -55,8 +55,8 @@ fn square_from_char(c: char) -> square { '.' => { earth } ' ' => { empty } _ => { - error!("invalid square: %?", c); - fail!() + error2!("invalid square: {:?}", c); + fail2!() } } } diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs index c1f4e1e49aa08..fff89381dbe37 100644 --- a/src/test/run-pass/issue-2935.rs +++ b/src/test/run-pass/issue-2935.rs @@ -29,6 +29,6 @@ pub fn main() { // x.f(); // y.f(); // (*z).f(); - error!("ok so far..."); + error2!("ok so far..."); z.f(); //segfault } diff --git a/src/test/run-pass/issue-3109.rs b/src/test/run-pass/issue-3109.rs index 6af1075544ecc..76cb182b0b6a6 100644 --- a/src/test/run-pass/issue-3109.rs +++ b/src/test/run-pass/issue-3109.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - error!(("hi there!", "you")); + error2!("{:?}", ("hi there!", "you")); } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 6709ef761a44c..f058a5cbfd1fe 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -26,7 +26,8 @@ fn check_strs(actual: &str, expected: &str) -> bool { if actual != expected { - io::stderr().write_line(fmt!("Found %s, but expected %s", actual, expected)); + io::stderr().write_line(format!("Found {}, but expected {}", actual, + expected)); return false; } return true; @@ -39,6 +40,6 @@ pub fn main() let t = Text(@~"foo"); let u = Section(@~[~"alpha"], true, @~[t], @~"foo", @~"foo", @~"foo", @~"foo", @~"foo"); - let v = fmt!("%?", u); // this is the line that causes the seg fault + let v = format!("{:?}", u); // this is the line that causes the seg fault assert!(v.len() > 0); } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index 9040d5b5fb5f9..55273f7029b6f 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -150,7 +150,7 @@ impl Canvas for AsciiArt { // this little helper. pub fn check_strs(actual: &str, expected: &str) -> bool { if actual != expected { - io::stderr().write_line(fmt!("Found:\n%s\nbut expected\n%s", actual, expected)); + io::stderr().write_line(format!("Found:\n{}\nbut expected\n{}", actual, expected)); return false; } return true; diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 49f70b28e9a83..c0bd5aa2a6883 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -18,7 +18,7 @@ fn foo(name: ~str, samples_chan: Chan) { |buffer| { for i in range(0u, buffer.len()) { - error!("%?: %f", i, buffer[i]) + error2!("{}: {}", i, buffer[i]) } }; samples_chan.send(GetSamples(name.clone(), callback)); diff --git a/src/test/run-pass/issue-3895.rs b/src/test/run-pass/issue-3895.rs index efe0cb8d491d9..ef9cab8754126 100644 --- a/src/test/run-pass/issue-3895.rs +++ b/src/test/run-pass/issue-3895.rs @@ -13,6 +13,6 @@ pub fn main() { match BadChar { _ if true => BadChar, - BadChar | BadSyntax => fail!() , + BadChar | BadSyntax => fail2!() , }; } diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs index c4178961d9e69..98b6a9c5f44b2 100644 --- a/src/test/run-pass/issue-4016.rs +++ b/src/test/run-pass/issue-4016.rs @@ -20,7 +20,7 @@ fn exec() { let doc = json::from_str("").unwrap(); let mut decoder = json::Decoder(doc); let _v: T = Decodable::decode(&mut decoder); - fail!() + fail2!() } pub fn main() {} diff --git a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs index dd3f54d97ecec..ac4b665e8fc69 100644 --- a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs @@ -34,7 +34,7 @@ impl Debuggable for Thing { fn print_name(x: &Debuggable) { - println(fmt!("debug_name = %s", x.debug_name())); + println!("debug_name = {}", x.debug_name()); } pub fn main() { diff --git a/src/test/run-pass/issue-5275.rs b/src/test/run-pass/issue-5275.rs index 8f0d01fab4057..b0560b4e637b6 100644 --- a/src/test/run-pass/issue-5275.rs +++ b/src/test/run-pass/issue-5275.rs @@ -12,14 +12,14 @@ fn foo(self_: &A) -> int { if true { - fail!() + fail2!() } else { *bar(self_.bar) } } fn bar<'r>(_: &'r mut int) -> &'r int { - fail!() + fail2!() } struct A { diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index 1be5d07913258..eeccac99c9809 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -18,7 +18,7 @@ trait Barks { impl Barks for Dog { fn bark(&self) -> ~str { - return fmt!("woof! (I'm %s)", self.name); + return format!("woof! (I'm {})", self.name); } } @@ -29,7 +29,7 @@ pub fn main() { let barker = [snoopy as ~Barks, bubbles as ~Barks]; for pup in barker.iter() { - println(fmt!("%s", pup.bark())); + println!("{}", pup.bark()); } } diff --git a/src/test/run-pass/issue-5688.rs b/src/test/run-pass/issue-5688.rs index 4ac4b3b33b7ec..869374d6ad4fb 100644 --- a/src/test/run-pass/issue-5688.rs +++ b/src/test/run-pass/issue-5688.rs @@ -21,6 +21,6 @@ struct X { vec: &'static [int] } static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; pub fn main() { for &v in V.iter() { - println(fmt!("%?", v.vec)); + println!("{:?}", v.vec); } } diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index aee1f8415eff9..918e43d040cb5 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -24,7 +24,7 @@ trait Inner { } impl Inner for int { - fn print(&self) { print(fmt!("Inner: %d\n", *self)); } + fn print(&self) { print(format!("Inner: {}\n", *self)); } } struct Outer<'self> { diff --git a/src/test/run-pass/issue-5926.rs b/src/test/run-pass/issue-5926.rs index d941e6326648d..dbaa5460fd090 100644 --- a/src/test/run-pass/issue-5926.rs +++ b/src/test/run-pass/issue-5926.rs @@ -14,6 +14,6 @@ pub fn main() { let mut your_favorite_numbers = @[1,2,3]; let mut my_favorite_numbers = @[4,5,6]; let f = your_favorite_numbers + my_favorite_numbers; - println(fmt!("The third favorite number is %?.", f)) + println!("The third favorite number is {:?}.", f) } diff --git a/src/test/run-pass/issue-6128.rs b/src/test/run-pass/issue-6128.rs index a01a04ebf8272..51c7ed8babcc1 100644 --- a/src/test/run-pass/issue-6128.rs +++ b/src/test/run-pass/issue-6128.rs @@ -17,7 +17,7 @@ trait Graph { impl Graph for HashMap { fn f(&self, _e: E) { - fail!(); + fail2!(); } } diff --git a/src/test/run-pass/issue-6344-let.rs b/src/test/run-pass/issue-6344-let.rs index 9343f2b61c900..2d70f2623e4a5 100644 --- a/src/test/run-pass/issue-6344-let.rs +++ b/src/test/run-pass/issue-6344-let.rs @@ -17,5 +17,5 @@ pub fn main() { let a = A { x: 0 }; let A { x: ref x } = a; - info!("%?", x) + info2!("{:?}", x) } diff --git a/src/test/run-pass/issue-6344-match.rs b/src/test/run-pass/issue-6344-match.rs index 18d327aa360c4..465e413b0ec04 100644 --- a/src/test/run-pass/issue-6344-match.rs +++ b/src/test/run-pass/issue-6344-match.rs @@ -18,7 +18,7 @@ pub fn main() { match a { A { x : ref x } => { - info!("%?", x) + info2!("{:?}", x) } } } diff --git a/src/test/run-pass/issue-7012.rs b/src/test/run-pass/issue-7012.rs index 2a56f2ad8bc47..696197a21af71 100644 --- a/src/test/run-pass/issue-7012.rs +++ b/src/test/run-pass/issue-7012.rs @@ -23,5 +23,5 @@ static test1: signature<'static> = signature { pub fn main() { let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]; - println(fmt!("%b",test==test1.pattern)); + println(format!("{}",test==test1.pattern)); } diff --git a/src/test/run-pass/issue-7563.rs b/src/test/run-pass/issue-7563.rs index f36dcb5ef1bbe..348a455830f7a 100644 --- a/src/test/run-pass/issue-7563.rs +++ b/src/test/run-pass/issue-7563.rs @@ -19,7 +19,7 @@ pub fn main() { let sa = A { a: 100 }; let sb = B { b: 200, pa: &sa }; - debug!("sa is %?", sa); - debug!("sb is %?", sb); - debug!("sb.pa is %?", sb.get_pa()); + debug2!("sa is {:?}", sa); + debug2!("sb is {:?}", sb); + debug2!("sb.pa is {:?}", sb.get_pa()); } diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 5a54821dc1ee5..07731020d3485 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -11,7 +11,7 @@ fn assert_repr_eq(obj : T, expected : ~str) { - assert_eq!(expected, fmt!("%?", obj)); + assert_eq!(expected, format!("{:?}", obj)); } pub fn main() { diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index 254954fbde975..a02edba5f6536 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -10,7 +10,7 @@ fn test_stack_assign() { let s: ~str = ~"a"; - info!(s.clone()); + info2!("{}", s.clone()); let t: ~str = ~"a"; assert!(s == t); let u: ~str = ~"b"; @@ -27,7 +27,7 @@ fn test_heap_assign() { assert!((s != u)); } -fn test_heap_log() { let s = ~"a big ol' string"; info!(s); } +fn test_heap_log() { let s = ~"a big ol' string"; info2!("{}", s); } fn test_stack_add() { assert_eq!(~"a" + "b", ~"ab"); @@ -49,7 +49,7 @@ fn test_append() { let mut s = ~"a"; s.push_str("b"); - info!(s.clone()); + info2!("{}", s.clone()); assert_eq!(s, ~"ab"); let mut s = ~"c"; diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 29c1c63066047..e661fe7771ae0 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -151,7 +151,7 @@ mod test_distinguish_syntax_ext { extern mod extra; pub fn f() { - fmt!("test%s", "s"); + format!("test{}", "s"); #[attr = "val"] fn g() { } } diff --git a/src/test/run-pass/iter-range.rs b/src/test/run-pass/iter-range.rs index edb91a11cfccd..82163200e5926 100644 --- a/src/test/run-pass/iter-range.rs +++ b/src/test/run-pass/iter-range.rs @@ -19,5 +19,5 @@ fn range_(a: int, b: int, it: &fn(int)) { pub fn main() { let mut sum: int = 0; range_(0, 100, |x| sum += x ); - info!(sum); + info2!("{}", sum); } diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index d55150e448e81..0a6393d3deee2 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -16,6 +16,6 @@ struct Refs { refs: ~[int], n: int } pub fn main() { let e = @mut Refs{refs: ~[], n: 0}; - let _f: &fn() = || error!(e.n); + let _f: &fn() = || error2!("{}", e.n); e.refs.push(1); } diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index e2dbf7d29db19..2f7f0f26e0fa5 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -15,7 +15,7 @@ fn lp(s: ~str, f: &fn(~str) -> T) -> T { let r = f(s); return (r); } - fail!(); + fail2!(); } fn apply(s: ~str, f: &fn(~str) -> T) -> T { diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 079d2374a29ff..a6beed631da11 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -16,5 +16,5 @@ pub fn main() { fn invoke(f: &fn()) { f(); } let k = ~22; let _u = A {a: k.clone()}; - invoke(|| error!(k.clone()) ) + invoke(|| error2!("{:?}", k.clone()) ) } diff --git a/src/test/run-pass/lazy-and-or.rs b/src/test/run-pass/lazy-and-or.rs index 6dc1063aed8c2..c821f582662ba 100644 --- a/src/test/run-pass/lazy-and-or.rs +++ b/src/test/run-pass/lazy-and-or.rs @@ -16,7 +16,7 @@ pub fn main() { let x = 1 == 2 || 3 == 3; assert!((x)); let mut y: int = 10; - info!(x || incr(&mut y)); + info2!("{:?}", x || incr(&mut y)); assert_eq!(y, 10); if true && x { assert!((true)); } else { assert!((false)); } } diff --git a/src/test/run-pass/lazy-init.rs b/src/test/run-pass/lazy-init.rs index 33cccacaf9090..53edb3d732cf7 100644 --- a/src/test/run-pass/lazy-init.rs +++ b/src/test/run-pass/lazy-init.rs @@ -10,6 +10,6 @@ -fn foo(x: int) { info!(x); } +fn foo(x: int) { info2!("{}", x); } pub fn main() { let mut x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); } diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index 01ee4e2063855..db27a471ba355 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -11,8 +11,8 @@ pub fn main() { let x = ~[1, 2, 3]; let mut y = 0; - for i in x.iter() { info!(*i); y += *i; } - info!(y); + for i in x.iter() { info2!("{:?}", *i); y += *i; } + info2!("{:?}", y); assert_eq!(y, 6); let s = ~"hello there"; let mut i: int = 0; @@ -25,8 +25,8 @@ pub fn main() { // ... i += 1; - info!(i); - info!(c); + info2!("{:?}", i); + info2!("{:?}", c); } assert_eq!(i, 11); } diff --git a/src/test/run-pass/liveness-loop-break.rs b/src/test/run-pass/liveness-loop-break.rs index b539429b07971..103a34492d9e1 100644 --- a/src/test/run-pass/liveness-loop-break.rs +++ b/src/test/run-pass/liveness-loop-break.rs @@ -14,7 +14,7 @@ fn test() { v = 3; break; } - info!("%d", v); + info2!("{}", v); } pub fn main() { diff --git a/src/test/run-pass/log-err-phi.rs b/src/test/run-pass/log-err-phi.rs index 586a13771774d..399ef25b7272e 100644 --- a/src/test/run-pass/log-err-phi.rs +++ b/src/test/run-pass/log-err-phi.rs @@ -10,4 +10,4 @@ -pub fn main() { if false { error!(~"foo" + "bar"); } } +pub fn main() { if false { error2!("{}", ~"foo" + "bar"); } } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index ec048d13a181a..77bac4d12fc6f 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -20,13 +20,13 @@ enum foo { } fn check_log(exp: ~str, v: T) { - assert_eq!(exp, fmt!("%?", v)); + assert_eq!(exp, format!("{:?}", v)); } pub fn main() { let x = list::from_vec([a(22u), b(~"hi")]); let exp = ~"@Cons(a(22u), @Cons(b(~\"hi\"), @Nil))"; - let act = fmt!("%?", x); + let act = format!("{:?}", x); assert!(act == exp); check_log(exp, x); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 4727e61b1fd0f..2e0b857f3cdd8 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -19,8 +19,8 @@ enum bar { } pub fn main() { - assert_eq!(~"a(22u)", fmt!("%?", a(22u))); - assert_eq!(~"b(~\"hi\")", fmt!("%?", b(~"hi"))); - assert_eq!(~"c", fmt!("%?", c)); - assert_eq!(~"d", fmt!("%?", d)); + assert_eq!(~"a(22u)", format!("{:?}", a(22u))); + assert_eq!(~"b(~\"hi\")", format!("{:?}", b(~"hi"))); + assert_eq!(~"c", format!("{:?}", c)); + assert_eq!(~"d", format!("{:?}", d)); } diff --git a/src/test/run-pass/log-linearized.rs b/src/test/run-pass/log-linearized.rs index a67eb282a142a..393b5c3d281de 100644 --- a/src/test/run-pass/log-linearized.rs +++ b/src/test/run-pass/log-linearized.rs @@ -26,7 +26,7 @@ fn mk() -> @mut Smallintmap { fn f() { let sim = mk::(); - error!(sim); + error2!("{:?}", sim); } pub fn main() { diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index 08ff87df1b97b..5cd4561137735 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -13,8 +13,8 @@ enum Numbers { } pub fn main() { - info!(1); - info!(2.0); - warn!(Three); - error!(~[4]); + info2!("{}", 1); + info2!("{}", 2.0); + warn2!("{:?}", Three); + error2!("{:?}", ~[4]); } diff --git a/src/test/run-pass/log-str.rs b/src/test/run-pass/log-str.rs index fc48f4aea0c1e..a8914de917e7d 100644 --- a/src/test/run-pass/log-str.rs +++ b/src/test/run-pass/log-str.rs @@ -14,6 +14,6 @@ pub fn main() { let act = sys::log_str(&~[1, 2, 3]); assert_eq!(~"~[1, 2, 3]", act); - let act = fmt!("%?/%6?", ~[1, 2, 3], ~"hi"); - assert_eq!(act, ~"~[1, 2, 3]/ ~\"hi\""); + let act = format!("{:?}/{:6?}", ~[1, 2, 3], ~"hi"); + assert_eq!(act, ~"~[1, 2, 3]/~\"hi\" "); } diff --git a/src/test/run-pass/loop-break-cont.rs b/src/test/run-pass/loop-break-cont.rs index 64d2b3d0b215b..396946ce5a034 100644 --- a/src/test/run-pass/loop-break-cont.rs +++ b/src/test/run-pass/loop-break-cont.rs @@ -11,7 +11,7 @@ pub fn main() { let mut i = 0u; loop { - error!(~"a"); + error2!("a"); i += 1u; if i == 10u { break; @@ -23,7 +23,7 @@ pub fn main() { if i == 21u { break; } - error!(~"b"); + error2!("b"); is_even = false; i += 1u; if i % 2u != 0u { @@ -33,7 +33,7 @@ pub fn main() { } assert!(!is_even); loop { - error!(~"c"); + error2!("c"); if i == 22u { break; } diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index 45c8669eae2e9..1c6ba82c3c981 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -17,7 +17,7 @@ macro_rules! overly_complicated ( Some($pat) => { $res } - _ => { fail!(); } + _ => { fail2!(); } } }) diff --git a/src/test/run-pass/match-borrowed_str.rs b/src/test/run-pass/match-borrowed_str.rs index a33c38d242874..acff2de548eed 100644 --- a/src/test/run-pass/match-borrowed_str.rs +++ b/src/test/run-pass/match-borrowed_str.rs @@ -22,7 +22,7 @@ fn f2(ref_string: &str) -> ~str { match ref_string { "a" => ~"found a", "b" => ~"found b", - s => fmt!("not found (%s)", s) + s => format!("not found ({})", s) } } @@ -38,7 +38,7 @@ fn g2(ref_1: &str, ref_2: &str) -> ~str { match (ref_1, ref_2) { ("a", "b") => ~"found a,b", ("b", "c") => ~"found b,c", - (s1, s2) => fmt!("not found (%s, %s)", s1, s2) + (s1, s2) => format!("not found ({}, {})", s1, s2) } } diff --git a/src/test/run-pass/match-bot-2.rs b/src/test/run-pass/match-bot-2.rs index ba897bd92c017..3abc4435edc52 100644 --- a/src/test/run-pass/match-bot-2.rs +++ b/src/test/run-pass/match-bot-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // n.b. This was only ever failing with optimization disabled. -fn a() -> int { match return 1 { 2 => 3, _ => fail!() } } +fn a() -> int { match return 1 { 2 => 3, _ => fail2!() } } pub fn main() { a(); } diff --git a/src/test/run-pass/match-bot.rs b/src/test/run-pass/match-bot.rs index 29087be8af6e9..fd26dbfac0f8f 100644 --- a/src/test/run-pass/match-bot.rs +++ b/src/test/run-pass/match-bot.rs @@ -11,6 +11,6 @@ pub fn main() { let i: int = - match Some::(3) { None:: => { fail!() } Some::(_) => { 5 } }; - info!("%?", i); + match Some::(3) { None:: => { fail2!() } Some::(_) => { 5 } }; + info2!("{}", i); } diff --git a/src/test/run-pass/match-enum-struct-0.rs b/src/test/run-pass/match-enum-struct-0.rs index 365729ec86054..3a223dc701604 100644 --- a/src/test/run-pass/match-enum-struct-0.rs +++ b/src/test/run-pass/match-enum-struct-0.rs @@ -18,7 +18,7 @@ enum E { pub fn main() { let e = Bar; match e { - Foo{f: _f} => fail!(), + Foo{f: _f} => fail2!(), _ => (), } } diff --git a/src/test/run-pass/match-enum-struct-1.rs b/src/test/run-pass/match-enum-struct-1.rs index 15d24c41a3d08..65352ada39450 100644 --- a/src/test/run-pass/match-enum-struct-1.rs +++ b/src/test/run-pass/match-enum-struct-1.rs @@ -17,10 +17,10 @@ pub fn main() { let e = Foo{f: 1}; match e { Foo{_} => (), - _ => fail!(), + _ => fail2!(), } match e { Foo{f: _f} => (), - _ => fail!(), + _ => fail2!(), } } diff --git a/src/test/run-pass/match-join.rs b/src/test/run-pass/match-join.rs index 0f01985f274ad..e73319712affc 100644 --- a/src/test/run-pass/match-join.rs +++ b/src/test/run-pass/match-join.rs @@ -28,4 +28,4 @@ fn foo(y: Option) { return; } -pub fn main() { info!("hello"); foo::(Some::(5)); } +pub fn main() { info2!("hello"); foo::(Some::(5)); } diff --git a/src/test/run-pass/match-pattern-drop.rs b/src/test/run-pass/match-pattern-drop.rs index b8fa09ca63f03..26aedf5570599 100644 --- a/src/test/run-pass/match-pattern-drop.rs +++ b/src/test/run-pass/match-pattern-drop.rs @@ -14,20 +14,20 @@ enum t { make_t(@int), clam, } fn foo(s: @int) { - info!(::std::sys::refcount(s)); + info2!("{:?}", ::std::sys::refcount(s)); let count = ::std::sys::refcount(s); let x: t = make_t(s); // ref up assert_eq!(::std::sys::refcount(s), count + 1u); - info!(::std::sys::refcount(s)); + info2!("{:?}", ::std::sys::refcount(s)); match x { make_t(y) => { - info!("%?", y); // ref up then down + info2!("{:?}", y); // ref up then down } - _ => { info!("?"); fail!(); } + _ => { info2!("?"); fail2!(); } } - info!(::std::sys::refcount(s)); + info2!("{:?}", ::std::sys::refcount(s)); assert_eq!(::std::sys::refcount(s), count + 1u); let _ = ::std::sys::refcount(s); // don't get bitten by last-use. } @@ -39,7 +39,7 @@ pub fn main() { foo(s); // ref up then down - info!("%u", ::std::sys::refcount(s)); + info2!("{}", ::std::sys::refcount(s)); let count2 = ::std::sys::refcount(s); assert_eq!(count, count2); } diff --git a/src/test/run-pass/match-pattern-lit.rs b/src/test/run-pass/match-pattern-lit.rs index 84e9012be4e24..9493b8d960dee 100644 --- a/src/test/run-pass/match-pattern-lit.rs +++ b/src/test/run-pass/match-pattern-lit.rs @@ -12,9 +12,9 @@ fn altlit(f: int) -> int { match f { - 10 => { info!("case 10"); return 20; } - 11 => { info!("case 11"); return 22; } - _ => fail!("the impossible happened") + 10 => { info2!("case 10"); return 20; } + 11 => { info2!("case 11"); return 22; } + _ => fail2!("the impossible happened") } } diff --git a/src/test/run-pass/match-pattern-no-type-params.rs b/src/test/run-pass/match-pattern-no-type-params.rs index 2076f46e8ab7b..6ef3f75fbbc6e 100644 --- a/src/test/run-pass/match-pattern-no-type-params.rs +++ b/src/test/run-pass/match-pattern-no-type-params.rs @@ -12,8 +12,8 @@ enum maybe { nothing, just(T), } fn foo(x: maybe) { match x { - nothing => { error!("A"); } - just(_a) => { error!("B"); } + nothing => { error2!("A"); } + just(_a) => { error2!("B"); } } } diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index 6df4c8123610f..70832548f8277 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -15,7 +15,7 @@ fn test1() { assert_eq!(a, ~"a"); assert_eq!(b, ~"b"); }, - _ => fail!(), + _ => fail2!(), } } @@ -25,7 +25,7 @@ fn test2() { assert_eq!(a, 2); assert_eq!(b, 3); }, - _ => fail!(), + _ => fail2!(), } } @@ -35,7 +35,7 @@ fn test3() { assert_eq!(*a, 2); assert_eq!(*b, 3); }, - _ => fail!(), + _ => fail2!(), } } @@ -45,7 +45,7 @@ fn test4() { assert_eq!(a, 2); assert_eq!(b, 3); }, - _ => fail!(), + _ => fail2!(), } } @@ -55,7 +55,7 @@ fn test5() { assert_eq!(*a, 2); assert_eq!(*b, 3); }, - _ => fail!(), + _ => fail2!(), } } diff --git a/src/test/run-pass/match-range.rs b/src/test/run-pass/match-range.rs index 6b02b21a084bd..a95c4e5289b19 100644 --- a/src/test/run-pass/match-range.rs +++ b/src/test/run-pass/match-range.rs @@ -11,31 +11,31 @@ pub fn main() { match 5u { 1u..5u => {} - _ => fail!("should match range"), + _ => fail2!("should match range"), } match 5u { - 6u..7u => fail!("shouldn't match range"), + 6u..7u => fail2!("shouldn't match range"), _ => {} } match 5u { - 1u => fail!("should match non-first range"), + 1u => fail2!("should match non-first range"), 2u..6u => {} - _ => fail!("math is broken") + _ => fail2!("math is broken") } match 'c' { 'a'..'z' => {} - _ => fail!("should suppport char ranges") + _ => fail2!("should suppport char ranges") } match -3 { -7..5 => {} - _ => fail!("should match signed range") + _ => fail2!("should match signed range") } match 3.0 { 1.0..5.0 => {} - _ => fail!("should match float range") + _ => fail2!("should match float range") } match -1.5 { -3.6..3.6 => {} - _ => fail!("should match negative float range") + _ => fail2!("should match negative float range") } } diff --git a/src/test/run-pass/match-ref-binding-in-guard-3256.rs b/src/test/run-pass/match-ref-binding-in-guard-3256.rs index e1d2f0e1c4847..74a3f25536247 100644 --- a/src/test/run-pass/match-ref-binding-in-guard-3256.rs +++ b/src/test/run-pass/match-ref-binding-in-guard-3256.rs @@ -17,7 +17,7 @@ pub fn main() { Some(ref z) if z.with(|b| *b) => { do z.with |b| { assert!(*b); } }, - _ => fail!() + _ => fail2!() } } } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index 8bbcc507f184f..ecec003519c81 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -11,21 +11,21 @@ // Issue #53 pub fn main() { - match ~"test" { ~"not-test" => fail!(), ~"test" => (), _ => fail!() } + match ~"test" { ~"not-test" => fail2!(), ~"test" => (), _ => fail2!() } enum t { tag1(~str), tag2, } match tag1(~"test") { - tag2 => fail!(), - tag1(~"not-test") => fail!(), + tag2 => fail2!(), + tag1(~"not-test") => fail2!(), tag1(~"test") => (), - _ => fail!() + _ => fail2!() } - let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail!() }; + let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail2!() }; assert_eq!(x, 1); - match ~"a" { ~"a" => { } ~"b" => { }, _ => fail!() } + match ~"a" { ~"a" => { } ~"b" => { }, _ => fail2!() } } diff --git a/src/test/run-pass/match-struct-0.rs b/src/test/run-pass/match-struct-0.rs index 67e844c519ee8..215b05ac73f47 100644 --- a/src/test/run-pass/match-struct-0.rs +++ b/src/test/run-pass/match-struct-0.rs @@ -15,15 +15,15 @@ struct Foo{ pub fn main() { let f = Foo{f: 1}; match f { - Foo{f: 0} => fail!(), + Foo{f: 0} => fail2!(), Foo{_} => (), } match f { - Foo{f: 0} => fail!(), + Foo{f: 0} => fail2!(), Foo{f: _f} => (), } match f { - Foo{f: 0} => fail!(), + Foo{f: 0} => fail2!(), _ => (), } } diff --git a/src/test/run-pass/match-unique-bind.rs b/src/test/run-pass/match-unique-bind.rs index 9d62bc57ace92..7f2af90d09af6 100644 --- a/src/test/run-pass/match-unique-bind.rs +++ b/src/test/run-pass/match-unique-bind.rs @@ -11,7 +11,7 @@ pub fn main() { match ~100 { ~x => { - info!("%?", x); + info2!("{:?}", x); assert_eq!(x, 100); } } diff --git a/src/test/run-pass/match-with-ret-arm.rs b/src/test/run-pass/match-with-ret-arm.rs index 1d9d8fa219fc3..2476d440a1570 100644 --- a/src/test/run-pass/match-with-ret-arm.rs +++ b/src/test/run-pass/match-with-ret-arm.rs @@ -19,5 +19,5 @@ pub fn main() { Some(num) => num as u32 }; assert_eq!(f, 1234u32); - error!(f) + error2!("{}", f) } diff --git a/src/test/run-pass/morestack-address.rs b/src/test/run-pass/morestack-address.rs index ef6bb4e93b2da..cb4b078b9de2c 100644 --- a/src/test/run-pass/morestack-address.rs +++ b/src/test/run-pass/morestack-address.rs @@ -20,6 +20,6 @@ pub fn main() { unsafe { let addr = rusti::morestack_addr(); assert!(addr.is_not_null()); - error!("%?", addr); + error2!("{}", addr); } } diff --git a/src/test/run-pass/mutable-alias-vec.rs b/src/test/run-pass/mutable-alias-vec.rs index d8ea95be658ab..9ec91d930c05a 100644 --- a/src/test/run-pass/mutable-alias-vec.rs +++ b/src/test/run-pass/mutable-alias-vec.rs @@ -21,6 +21,6 @@ pub fn main() { grow(&mut v); grow(&mut v); let len = v.len(); - info!(len); + info2!("{}", len); assert_eq!(len, 3 as uint); } diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index d92496c4b7b40..a435f2c6050d2 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -11,6 +11,6 @@ pub fn main() { match -5 { -5 => {} - _ => { fail!() } + _ => { fail2!() } } } diff --git a/src/test/run-pass/nested-matchs.rs b/src/test/run-pass/nested-matchs.rs index cddbf60c382b0..9c728194e90d4 100644 --- a/src/test/run-pass/nested-matchs.rs +++ b/src/test/run-pass/nested-matchs.rs @@ -9,16 +9,16 @@ // except according to those terms. -fn baz() -> ! { fail!(); } +fn baz() -> ! { fail2!(); } fn foo() { match Some::(5) { Some::(_x) => { let mut bar; match None:: { None:: => { bar = 5; } _ => { baz(); } } - info!(bar); + info2!("{:?}", bar); } - None:: => { info!("hello"); } + None:: => { info2!("hello"); } } } diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index 0bc6280393cff..cc8436e7c4b2f 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -16,8 +16,8 @@ enum t { foo(int, uint), bar(int, Option), } fn nested(o: t) { match o { - bar(_i, Some::(_)) => { error!("wrong pattern matched"); fail!(); } - _ => { error!("succeeded"); } + bar(_i, Some::(_)) => { error2!("wrong pattern matched"); fail2!(); } + _ => { error2!("succeeded"); } } } diff --git a/src/test/run-pass/nested-patterns.rs b/src/test/run-pass/nested-patterns.rs index d901a625e1d1e..b979518f8a10f 100644 --- a/src/test/run-pass/nested-patterns.rs +++ b/src/test/run-pass/nested-patterns.rs @@ -16,7 +16,7 @@ struct C { c: int } pub fn main() { match A {a: 10, b: @20} { x@A {a, b: @20} => { assert!(x.a == 10); assert!(a == 10); } - A {b: _b, _} => { fail!(); } + A {b: _b, _} => { fail2!(); } } let mut x@B {b, _} = B {a: 10, b: C {c: 20}}; x.b.c = 30; diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs index 71c13ecb9a302..bc2c147b2429d 100644 --- a/src/test/run-pass/new-impl-syntax.rs +++ b/src/test/run-pass/new-impl-syntax.rs @@ -5,7 +5,7 @@ struct Thingy { impl ToStr for Thingy { fn to_str(&self) -> ~str { - fmt!("{ x: %d, y: %d }", self.x, self.y) + format!("\\{ x: {}, y: {} \\}", self.x, self.y) } } diff --git a/src/test/run-pass/opeq.rs b/src/test/run-pass/opeq.rs index f384740f5f28f..5172af1718443 100644 --- a/src/test/run-pass/opeq.rs +++ b/src/test/run-pass/opeq.rs @@ -15,15 +15,15 @@ pub fn main() { let mut x: int = 1; x *= 2; - info!(x); + info2!("{}", x); assert_eq!(x, 2); x += 3; - info!(x); + info2!("{}", x); assert_eq!(x, 5); x *= x; - info!(x); + info2!("{}", x); assert_eq!(x, 25); x /= 5; - info!(x); + info2!("{}", x); assert_eq!(x, 5); } diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index 66cd7f2b55f74..7c8872fae8a76 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -24,7 +24,7 @@ impl Drop for dtor { fn unwrap(o: Option) -> T { match o { Some(v) => v, - None => fail!() + None => fail2!() } } diff --git a/src/test/run-pass/over-constrained-vregs.rs b/src/test/run-pass/over-constrained-vregs.rs index a41b79115230a..0fc56cecec559 100644 --- a/src/test/run-pass/over-constrained-vregs.rs +++ b/src/test/run-pass/over-constrained-vregs.rs @@ -17,6 +17,6 @@ pub fn main() { while b <= 32u { 0u << b; b <<= 1u; - info!(b); + info2!("{:?}", b); } } diff --git a/src/test/run-pass/overload-index-operator.rs b/src/test/run-pass/overload-index-operator.rs index 0f83a8e730e85..8de802e1fc979 100644 --- a/src/test/run-pass/overload-index-operator.rs +++ b/src/test/run-pass/overload-index-operator.rs @@ -36,7 +36,7 @@ impl Index for AssociationList { return pair.value.clone(); } } - fail!("No value found for key: %?", index); + fail2!("No value found for key: {:?}", index); } } diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index 751ba78b2820f..29789f38a4bf0 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -11,5 +11,5 @@ pub fn main() { let x = true; if x { let mut i = 10; while i > 0 { i -= 1; } } - match x { true => { info!("right"); } false => { info!("wrong"); } } + match x { true => { info2!("right"); } false => { info2!("wrong"); } } } diff --git a/src/test/run-pass/parse-fail.rs b/src/test/run-pass/parse-fail.rs index cd5d089c36121..7d4a74fe32cbe 100644 --- a/src/test/run-pass/parse-fail.rs +++ b/src/test/run-pass/parse-fail.rs @@ -11,6 +11,6 @@ #[allow(unreachable_code)]; // -*- rust -*- -fn dont_call_me() { fail!(); info!(1); } +fn dont_call_me() { fail2!(); info2!("{}", 1); } pub fn main() { } diff --git a/src/test/run-pass/pass-by-copy.rs b/src/test/run-pass/pass-by-copy.rs index 716725899ab1c..a9cfd3aa1832f 100644 --- a/src/test/run-pass/pass-by-copy.rs +++ b/src/test/run-pass/pass-by-copy.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn magic(x: A) { info!(x); } -fn magic2(x: @int) { info!(x); } +fn magic(x: A) { info2!("{:?}", x); } +fn magic2(x: @int) { info2!("{:?}", x); } struct A { a: @int } diff --git a/src/test/run-pass/pure-fmt.rs b/src/test/run-pass/pure-fmt.rs index c16b10da5de40..f5dc7c1c1d307 100644 --- a/src/test/run-pass/pure-fmt.rs +++ b/src/test/run-pass/pure-fmt.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Testing that calling fmt! (via info!) doesn't complain about impure borrows +// Testing that calling fmt! (via info2!) doesn't complain about impure borrows struct Big { b: @~str, c: uint, d: int, e: char, f: float, g: bool } @@ -22,12 +22,12 @@ fn foo() { f: 0.0, g: true }; - info!("test %?", a.b); - info!("test %u", a.c); - info!("test %i", a.d); - info!("test %c", a.e); - info!("test %f", a.f); - info!("test %b", a.g); + info2!("test {:?}", a.b); + info2!("test {:u}", a.c); + info2!("test {:i}", a.d); + info2!("test {:c}", a.e); + info2!("test {:f}", a.f); + info2!("test {:b}", a.g); } pub fn main() { diff --git a/src/test/run-pass/purity-infer.rs b/src/test/run-pass/purity-infer.rs index debde77b21128..030df6bcc085f 100644 --- a/src/test/run-pass/purity-infer.rs +++ b/src/test/run-pass/purity-infer.rs @@ -11,5 +11,5 @@ fn something(f: &fn()) { f(); } pub fn main() { - something(|| error!("hi!") ); + something(|| error2!("hi!") ); } diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 46819027dad64..376a14924c081 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -28,16 +28,16 @@ pub fn main() { let x = @6; let y = x.get(); - info!("y=%d", y); + info2!("y={}", y); assert_eq!(y, 6); let x = ~6; let y = x.get(); - info!("y=%d", y); + info2!("y={}", y); assert_eq!(y, 6); let x = &6; let y = x.get(); - info!("y=%d", y); + info2!("y={}", y); assert_eq!(y, 6); } diff --git a/src/test/run-pass/rcvr-borrowed-to-slice.rs b/src/test/run-pass/rcvr-borrowed-to-slice.rs index 63fe744f25312..1f1b9d3d1ee9e 100644 --- a/src/test/run-pass/rcvr-borrowed-to-slice.rs +++ b/src/test/run-pass/rcvr-borrowed-to-slice.rs @@ -24,16 +24,16 @@ fn call_sum(x: &[int]) -> int { x.sum_() } pub fn main() { let x = ~[1, 2, 3]; let y = call_sum(x); - info!("y==%d", y); + info2!("y=={}", y); assert_eq!(y, 6); let x = ~[1, 2, 3]; let y = x.sum_(); - info!("y==%d", y); + info2!("y=={}", y); assert_eq!(y, 6); let x = ~[1, 2, 3]; let y = x.sum_(); - info!("y==%d", y); + info2!("y=={}", y); assert_eq!(y, 6); } diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs index 6c4d9915d85f9..b7a2330cf84f4 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-u32.rs @@ -53,11 +53,11 @@ pub fn main() { let x = Outer {c8: 22u8, t: Inner {c64: 44u32}}; // Send it through the shape code - let y = fmt!("%?", x); + let y = format!("{:?}", x); - info!("align inner = %?", rusti::min_align_of::()); - info!("size outer = %?", sys::size_of::()); - info!("y = %s", y); + info2!("align inner = {:?}", rusti::min_align_of::()); + info2!("size outer = {:?}", sys::size_of::()); + info2!("y = {}", y); // per clang/gcc the alignment of `inner` is 4 on x86. assert_eq!(rusti::min_align_of::(), m::align()); diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index c116353e9c917..f3bfb998dbbc5 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -75,11 +75,11 @@ pub fn main() { let x = Outer {c8: 22u8, t: Inner {c64: 44u64}}; // Send it through the shape code - let y = fmt!("%?", x); + let y = format!("{:?}", x); - info!("align inner = %?", rusti::min_align_of::()); - info!("size outer = %?", sys::size_of::()); - info!("y = %s", y); + info2!("align inner = {}", rusti::min_align_of::()); + info2!("size outer = {}", sys::size_of::()); + info2!("y = {}", y); // per clang/gcc the alignment of `Inner` is 4 on x86. assert_eq!(rusti::min_align_of::(), m::m::align()); diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 01a31ebf3337b..086d03ae4e30f 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -19,6 +19,6 @@ struct X { foo: ~str, bar: ~str } pub fn main() { let x = X {foo: ~"hello", bar: ~"world"}; - info!(x.foo.clone()); - info!(x.bar.clone()); + info2!("{}", x.foo.clone()); + info2!("{}", x.bar.clone()); } diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 919fd35116103..be276478522ba 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -559,7 +559,7 @@ impl TyVisitor for my_visitor { _sz: uint, _align: uint) -> bool { true } fn visit_rec_field(&mut self, _i: uint, _name: &str, _mtbl: uint, inner: *TyDesc) -> bool { - error!("rec field!"); + error2!("rec field!"); self.visit_inner(inner) } fn visit_leave_rec(&mut self, _n_fields: uint, @@ -577,7 +577,7 @@ impl TyVisitor for my_visitor { fn visit_enter_tup(&mut self, _n_fields: uint, _sz: uint, _align: uint) -> bool { true } fn visit_tup_field(&mut self, _i: uint, inner: *TyDesc) -> bool { - error!("tup field!"); + error2!("tup field!"); self.visit_inner(inner) } fn visit_leave_tup(&mut self, _n_fields: uint, @@ -641,7 +641,7 @@ pub fn main() { vals: ~[]}); let mut v = ptr_visit_adaptor(Inner {inner: u}); let td = get_tydesc_for(r); - error!("tydesc sz: %u, align: %u", + error2!("tydesc sz: {}, align: {}", (*td).size, (*td).align); visit_tydesc(td, &mut v as &mut TyVisitor); diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs index 258afaa3f8d12..7b14b36df7d45 100644 --- a/src/test/run-pass/reflect-visit-type.rs +++ b/src/test/run-pass/reflect-visit-type.rs @@ -17,32 +17,32 @@ struct MyVisitor { impl TyVisitor for MyVisitor { fn visit_bot(&mut self) -> bool { self.types.push(~"bot"); - error!("visited bot type"); + error2!("visited bot type"); true } fn visit_nil(&mut self) -> bool { self.types.push(~"nil"); - error!("visited nil type"); + error2!("visited nil type"); true } fn visit_bool(&mut self) -> bool { self.types.push(~"bool"); - error!("visited bool type"); + error2!("visited bool type"); true } fn visit_int(&mut self) -> bool { self.types.push(~"int"); - error!("visited int type"); + error2!("visited int type"); true } fn visit_i8(&mut self) -> bool { self.types.push(~"i8"); - error!("visited i8 type"); + error2!("visited i8 type"); true } fn visit_i16(&mut self) -> bool { self.types.push(~"i16"); - error!("visited i16 type"); + error2!("visited i16 type"); true } fn visit_i32(&mut self) -> bool { true } diff --git a/src/test/run-pass/region-dependent-addr-of.rs b/src/test/run-pass/region-dependent-addr-of.rs index d8076f543ecc1..1d44d8defdc1c 100644 --- a/src/test/run-pass/region-dependent-addr-of.rs +++ b/src/test/run-pass/region-dependent-addr-of.rs @@ -57,21 +57,21 @@ fn get_v5<'v>(a: &'v A, _i: uint) -> &'v int { fn get_v6_a<'v>(a: &'v A, _i: uint) -> &'v int { match a.value.v6 { Some(ref v) => &v.f, - None => fail!() + None => fail2!() } } fn get_v6_b<'v>(a: &'v A, _i: uint) -> &'v int { match *a { A { value: B { v6: Some(ref v), _ } } => &v.f, - _ => fail!() + _ => fail2!() } } fn get_v6_c<'v>(a: &'v A, _i: uint) -> &'v int { match a { &A { value: B { v6: Some(ref v), _ } } => &v.f, - _ => fail!() + _ => fail2!() } } diff --git a/src/test/run-pass/region-return-interior-of-option.rs b/src/test/run-pass/region-return-interior-of-option.rs index aa4630717db6c..9258b149fd316 100644 --- a/src/test/run-pass/region-return-interior-of-option.rs +++ b/src/test/run-pass/region-return-interior-of-option.rs @@ -11,7 +11,7 @@ fn get<'r, T>(opt: &'r Option) -> &'r T { match *opt { Some(ref v) => v, - None => fail!("none") + None => fail2!("none") } } diff --git a/src/test/run-pass/regions-addr-of-ret.rs b/src/test/run-pass/regions-addr-of-ret.rs index 9e19618f332e0..08b1d24986936 100644 --- a/src/test/run-pass/regions-addr-of-ret.rs +++ b/src/test/run-pass/regions-addr-of-ret.rs @@ -14,5 +14,5 @@ fn f<'a>(x : &'a int) -> &'a int { pub fn main() { let three = &3; - error!(fmt!("%d", *f(three))); + error2!("{}", *f(three)); } diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index 08a09c59facca..a504296a182bd 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -15,6 +15,6 @@ fn foo(x: &uint) -> uint { pub fn main() { let p = @22u; let r = foo(p); - info!("r=%u", r); + info2!("r={}", r); assert_eq!(r, 22u); } diff --git a/src/test/run-pass/regions-bot.rs b/src/test/run-pass/regions-bot.rs index dbc5bf6626af1..5d8d5d6033a48 100644 --- a/src/test/run-pass/regions-bot.rs +++ b/src/test/run-pass/regions-bot.rs @@ -10,7 +10,7 @@ // A very limited test of the "bottom" region -fn produce_static() -> &'static T { fail!(); } +fn produce_static() -> &'static T { fail2!(); } fn foo(_x: &T) -> &uint { produce_static() } diff --git a/src/test/run-pass/regions-self-impls.rs b/src/test/run-pass/regions-self-impls.rs index 2a2fbcfe61f3f..61d088851fd08 100644 --- a/src/test/run-pass/regions-self-impls.rs +++ b/src/test/run-pass/regions-self-impls.rs @@ -22,6 +22,6 @@ impl<'self> get_chowder<'self> for Clam<'self> { pub fn main() { let clam = Clam { chowder: &3 }; - info!(*clam.get_chowder()); + info2!("{:?}", *clam.get_chowder()); clam.get_chowder(); } diff --git a/src/test/run-pass/regions-self-in-enums.rs b/src/test/run-pass/regions-self-in-enums.rs index c35ec383665ad..f0b7306990dd3 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -19,5 +19,5 @@ pub fn main() { match y { int_wrapper_ctor(zz) => { z = zz; } } - info!(*z); + info2!("{:?}", *z); } diff --git a/src/test/run-pass/regions-simple.rs b/src/test/run-pass/regions-simple.rs index 318c8a8670e01..e57c2e9807e0f 100644 --- a/src/test/run-pass/regions-simple.rs +++ b/src/test/run-pass/regions-simple.rs @@ -12,5 +12,5 @@ pub fn main() { let mut x: int = 3; let y: &mut int = &mut x; *y = 5; - info!(*y); + info2!("{:?}", *y); } diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index a2eb459ce206e..3cb6fea3e532e 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -21,6 +21,6 @@ fn call_static_closure(cl: closure_box<'static>) { } pub fn main() { - let cl_box = box_it(|| info!("Hello, world!")); + let cl_box = box_it(|| info2!("Hello, world!")); call_static_closure(cl_box); } diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index 40ce248f28625..6291e229b6c9c 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -17,6 +17,6 @@ pub fn main() { let x = [ @[true], ..512 ]; let y = [ 0, ..1 ]; - error!("%?", x); - error!("%?", y); + error2!("{:?}", x); + error2!("{:?}", y); } diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index dd5450de62fdb..2e30044f31887 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -32,7 +32,7 @@ pub fn main() { let a = r(i); let b = (a, 10); let (c, _d) = b; - info!(c); + info2!("{:?}", c); } assert_eq!(*i, 1); } diff --git a/src/test/run-pass/resource-cycle.rs b/src/test/run-pass/resource-cycle.rs index a5354fd01cd83..e7384203310c8 100644 --- a/src/test/run-pass/resource-cycle.rs +++ b/src/test/run-pass/resource-cycle.rs @@ -19,7 +19,7 @@ struct r { impl Drop for r { fn drop(&mut self) { unsafe { - info!("r's dtor: self = %x, self.v = %x, self.v's value = %x", + info2!("r's dtor: self = {:x}, self.v = {:x}, self.v's value = {:x}", cast::transmute::<*mut r, uint>(self), cast::transmute::<**int, uint>(&(self.v)), cast::transmute::<*int, uint>(self.v)); @@ -54,11 +54,11 @@ pub fn main() { next: None, r: { let rs = r(i1p); - info!("r = %x", cast::transmute::<*r, uint>(&rs)); + info2!("r = {:x}", cast::transmute::<*r, uint>(&rs)); rs } }); - info!("x1 = %x, x1.r = %x", + info2!("x1 = {:x}, x1.r = {:x}", cast::transmute::<@mut t, uint>(x1), cast::transmute::<*r, uint>(&x1.r)); @@ -66,12 +66,12 @@ pub fn main() { next: None, r: { let rs = r(i2p); - info!("r2 = %x", cast::transmute::<*r, uint>(&rs)); + info2!("r2 = {:x}", cast::transmute::<*r, uint>(&rs)); rs } }); - info!("x2 = %x, x2.r = %x", + info2!("x2 = {:x}, x2.r = {:x}", cast::transmute::<@mut t, uint>(x2), cast::transmute::<*r, uint>(&(x2.r))); diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index d92cfb5b9a54f..70adccbb9c92a 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -15,7 +15,7 @@ struct shrinky_pointer { #[unsafe_destructor] impl Drop for shrinky_pointer { fn drop(&mut self) { - error!(~"Hello!"); **(self.i) -= 1; + error2!("Hello!"); **(self.i) -= 1; } } @@ -32,6 +32,6 @@ fn shrinky_pointer(i: @@mut int) -> shrinky_pointer { pub fn main() { let my_total = @@mut 10; { let pt = shrinky_pointer(my_total); assert!((pt.look_at() == 10)); } - error!("my_total = %d", **my_total); + error2!("my_total = {}", **my_total); assert_eq!(**my_total, 9); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index 881294c4f3342..f56cf57e12e94 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -12,7 +12,7 @@ // -*- rust -*- -fn my_err(s: ~str) -> ! { error!(s); fail!(); } +fn my_err(s: ~str) -> ! { error2!("{:?}", s); fail2!(); } fn okay(i: uint) -> int { if i == 3u { my_err(~"I don't like three"); } else { return 42; } diff --git a/src/test/run-pass/rt-start-main-thread.rs b/src/test/run-pass/rt-start-main-thread.rs index 47a723ce6e14d..9a6dfb22106a4 100644 --- a/src/test/run-pass/rt-start-main-thread.rs +++ b/src/test/run-pass/rt-start-main-thread.rs @@ -13,9 +13,9 @@ #[start] fn start(argc: int, argv: **u8) -> int { do std::rt::start_on_main_thread(argc, argv) { - info!("running on main thread"); + info2!("running on main thread"); do spawn { - info!("running on another thread"); + info2!("running on another thread"); } } } diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs index e192a38dfa317..b7d6a0f391562 100644 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ b/src/test/run-pass/sendfn-generic-fn.rs @@ -26,12 +26,12 @@ fn make_generic_record(a: A, b: B) -> Pair { fn test05_start(f: &~fn(v: float, v: ~str) -> Pair) { let p = (*f)(22.22f, ~"Hi"); - info!(p.clone()); + info2!("{:?}", p.clone()); assert!(p.a == 22.22f); assert!(p.b == ~"Hi"); let q = (*f)(44.44f, ~"Ho"); - info!(q.clone()); + info2!("{:?}", q.clone()); assert!(q.a == 44.44f); assert!(q.b == ~"Ho"); } diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index 2399aa5b035cc..6cc8b27834cf0 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -20,7 +20,7 @@ fn test05_start(f: ~fn(int)) { fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { - error!(*three + n); // will copy x into the closure + error2!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index 2d3b505dfa60a..345c2aad0d38a 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -17,7 +17,7 @@ fn foo(c: ~[int]) { match none:: { some::(_) => { for _i in c.iter() { - info!(a); + info2!("{:?}", a); let a = 17; b.push(a); } diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index 11489c33eeac5..a989ac68d711d 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -57,6 +57,6 @@ pub fn main() { let p_: Path_ = Path_ { global: true, idents: ~[~"hi"], types: ~[t] }; let p: path = Spanned { data: p_, span: sp }; let x = X { sp: sp, path: p }; - error!(x.path.clone()); - error!(x.clone()); + error2!("{:?}", x.path.clone()); + error2!("{:?}", x.clone()); } diff --git a/src/test/run-pass/simple-infer.rs b/src/test/run-pass/simple-infer.rs index efdf7f2792c96..0924655a76717 100644 --- a/src/test/run-pass/simple-infer.rs +++ b/src/test/run-pass/simple-infer.rs @@ -10,4 +10,4 @@ -pub fn main() { let mut n; n = 1; info!(n); } +pub fn main() { let mut n; n = 1; info2!("{}", n); } diff --git a/src/test/run-pass/simple-match-generic-tag.rs b/src/test/run-pass/simple-match-generic-tag.rs index d8b7c99d000aa..1c080bb8146ba 100644 --- a/src/test/run-pass/simple-match-generic-tag.rs +++ b/src/test/run-pass/simple-match-generic-tag.rs @@ -14,5 +14,5 @@ enum opt { none, } pub fn main() { let x = none::; - match x { none:: => { info!("hello world"); } } + match x { none:: => { info2!("hello world"); } } } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 7c9fef93943be..d34da045c02dd 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -16,8 +16,12 @@ enum clam { a(T, int), b, } fn uhoh(v: ~[clam]) { match v[1] { - a::(ref _t, ref u) => { info!("incorrect"); info!(u); fail!(); } - b:: => { info!("correct"); } + a::(ref _t, ref u) => { + info2!("incorrect"); + info2!("{:?}", u); + fail2!(); + } + b:: => { info2!("correct"); } } } diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 1825f1bcca339..f95ddcad4d638 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -12,8 +12,8 @@ use std::task; fn x(s: ~str, n: int) { - info!(s); - info!(n); + info2!("{:?}", s); + info2!("{:?}", n); } pub fn main() { @@ -21,5 +21,5 @@ pub fn main() { task::spawn(|| x(~"hello from second spawned fn", 66) ); task::spawn(|| x(~"hello from third spawned fn", 67) ); let mut i: int = 30; - while i > 0 { i = i - 1; info!("parent sleeping"); task::deschedule(); } + while i > 0 { i = i - 1; info2!("parent sleeping"); task::deschedule(); } } diff --git a/src/test/run-pass/spawn.rs b/src/test/run-pass/spawn.rs index dff73aa7b8e98..9273752d6293b 100644 --- a/src/test/run-pass/spawn.rs +++ b/src/test/run-pass/spawn.rs @@ -17,4 +17,4 @@ pub fn main() { task::spawn(|| child(10) ); } -fn child(i: int) { error!(i); assert!((i == 10)); } +fn child(i: int) { error2!("{}", i); assert!((i == 10)); } diff --git a/src/test/run-pass/spawn2.rs b/src/test/run-pass/spawn2.rs index 61ed7053456ca..31967b31c6385 100644 --- a/src/test/run-pass/spawn2.rs +++ b/src/test/run-pass/spawn2.rs @@ -15,15 +15,15 @@ pub fn main() { task::spawn(|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); } fn child(args: (int, int, int, int, int, int, int, int, int)) { let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args; - error!(i1); - error!(i2); - error!(i3); - error!(i4); - error!(i5); - error!(i6); - error!(i7); - error!(i8); - error!(i9); + error2!("{}", i1); + error2!("{}", i2); + error2!("{}", i3); + error2!("{}", i4); + error2!("{}", i5); + error2!("{}", i6); + error2!("{}", i7); + error2!("{}", i8); + error2!("{}", i9); assert_eq!(i1, 10); assert_eq!(i2, 20); assert_eq!(i3, 30); diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index d0dde4ad3c479..676d857246413 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -23,7 +23,7 @@ pub fn main() { { match io::file_writer(&path, [io::Create, io::Truncate]) { - Err(ref e) => fail!(e.clone()), + Err(ref e) => fail2!("{}", e.clone()), Ok(f) => { for _ in range(0u, 1000) { f.write_u8(0); diff --git a/src/test/run-pass/str-append.rs b/src/test/run-pass/str-append.rs index 331701107a8a2..fe57c5dd4e511 100644 --- a/src/test/run-pass/str-append.rs +++ b/src/test/run-pass/str-append.rs @@ -16,7 +16,7 @@ extern mod extra; fn test1() { let mut s: ~str = ~"hello"; s.push_str("world"); - info!(s.clone()); + info2!("{}", s.clone()); assert_eq!(s[9], 'd' as u8); } @@ -26,8 +26,8 @@ fn test2() { let ff: ~str = ~"abc"; let a: ~str = ff + "ABC" + ff; let b: ~str = ~"ABC" + ff + "ABC"; - info!(a.clone()); - info!(b.clone()); + info2!("{}", a.clone()); + info2!("{}", b.clone()); assert_eq!(a, ~"abcABCabc"); assert_eq!(b, ~"ABCabcABC"); } diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index 89804a6e5629e..dc605c50bb0f2 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -16,6 +16,6 @@ pub fn main() { let a: ~str = ~"hello"; let b: ~str = ~"world"; let s: ~str = a + b; - info!(s.clone()); + info2!("{}", s.clone()); assert_eq!(s[9], 'd' as u8); } diff --git a/src/test/run-pass/str-idx.rs b/src/test/run-pass/str-idx.rs index 68dcc0b982294..ca80f71cca7fe 100644 --- a/src/test/run-pass/str-idx.rs +++ b/src/test/run-pass/str-idx.rs @@ -13,6 +13,6 @@ pub fn main() { let s = ~"hello"; let c: u8 = s[4]; - info!(c); + info2!("{:?}", c); assert_eq!(c, 0x6f as u8); } diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index b1b90468e94f0..f230bb38701e4 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -16,7 +16,7 @@ pub fn main() { let mut i = 20; let mut expected_len = 1u; while i > 0 { - error!(a.len()); + error2!("{}", a.len()); assert_eq!(a.len(), expected_len); a = a + a; // FIXME(#3387)---can't write a += a i -= 1; diff --git a/src/test/run-pass/struct-literal-dtor.rs b/src/test/run-pass/struct-literal-dtor.rs index f983830936a1f..a4238799d09f7 100644 --- a/src/test/run-pass/struct-literal-dtor.rs +++ b/src/test/run-pass/struct-literal-dtor.rs @@ -14,7 +14,7 @@ struct foo { impl Drop for foo { fn drop(&mut self) { - error!("%s", self.x); + error2!("{}", self.x); } } diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs index a1f5a2392b152..1cdc8d3826cc8 100644 --- a/src/test/run-pass/struct-return.rs +++ b/src/test/run-pass/struct-return.rs @@ -31,10 +31,10 @@ fn test1() { c: 0xcccc_cccc_cccc_cccc_u64, d: 0xdddd_dddd_dddd_dddd_u64 }; let qq = rustrt::rust_dbg_abi_1(q); - error!("a: %x", qq.a as uint); - error!("b: %x", qq.b as uint); - error!("c: %x", qq.c as uint); - error!("d: %x", qq.d as uint); + error2!("a: {:x}", qq.a as uint); + error2!("b: {:x}", qq.b as uint); + error2!("c: {:x}", qq.c as uint); + error2!("d: {:x}", qq.d as uint); assert_eq!(qq.a, q.c + 1u64); assert_eq!(qq.b, q.d - 1u64); assert_eq!(qq.c, q.a + 1u64); @@ -51,9 +51,9 @@ fn test2() { b: 0b_1010_1010_u8, c: 1.0987654321e-15_f64 }; let ff = rustrt::rust_dbg_abi_2(f); - error!("a: %f", ff.a as float); - error!("b: %u", ff.b as uint); - error!("c: %f", ff.c as float); + error2!("a: {}", ff.a as float); + error2!("b: {}", ff.b as uint); + error2!("c: {}", ff.c as float); assert_eq!(ff.a, f.c + 1.0f64); assert_eq!(ff.b, 0xff_u8); assert_eq!(ff.c, f.a - 1.0f64); diff --git a/src/test/run-pass/supported-cast.rs b/src/test/run-pass/supported-cast.rs index 663f36ce67395..cfa721a4ed311 100644 --- a/src/test/run-pass/supported-cast.rs +++ b/src/test/run-pass/supported-cast.rs @@ -12,236 +12,236 @@ use std::libc; pub fn main() { let f = 1 as *libc::FILE; - info!(f as int); - info!(f as uint); - info!(f as i8); - info!(f as i16); - info!(f as i32); - info!(f as i64); - info!(f as u8); - info!(f as u16); - info!(f as u32); - info!(f as u64); - - info!(1 as int); - info!(1 as uint); - info!(1 as float); - info!(1 as *libc::FILE); - info!(1 as i8); - info!(1 as i16); - info!(1 as i32); - info!(1 as i64); - info!(1 as u8); - info!(1 as u16); - info!(1 as u32); - info!(1 as u64); - info!(1 as f32); - info!(1 as f64); - - info!(1u as int); - info!(1u as uint); - info!(1u as float); - info!(1u as *libc::FILE); - info!(1u as i8); - info!(1u as i16); - info!(1u as i32); - info!(1u as i64); - info!(1u as u8); - info!(1u as u16); - info!(1u as u32); - info!(1u as u64); - info!(1u as f32); - info!(1u as f64); - - info!(1i8 as int); - info!(1i8 as uint); - info!(1i8 as float); - info!(1i8 as *libc::FILE); - info!(1i8 as i8); - info!(1i8 as i16); - info!(1i8 as i32); - info!(1i8 as i64); - info!(1i8 as u8); - info!(1i8 as u16); - info!(1i8 as u32); - info!(1i8 as u64); - info!(1i8 as f32); - info!(1i8 as f64); - - info!(1u8 as int); - info!(1u8 as uint); - info!(1u8 as float); - info!(1u8 as *libc::FILE); - info!(1u8 as i8); - info!(1u8 as i16); - info!(1u8 as i32); - info!(1u8 as i64); - info!(1u8 as u8); - info!(1u8 as u16); - info!(1u8 as u32); - info!(1u8 as u64); - info!(1u8 as f32); - info!(1u8 as f64); - - info!(1i16 as int); - info!(1i16 as uint); - info!(1i16 as float); - info!(1i16 as *libc::FILE); - info!(1i16 as i8); - info!(1i16 as i16); - info!(1i16 as i32); - info!(1i16 as i64); - info!(1i16 as u8); - info!(1i16 as u16); - info!(1i16 as u32); - info!(1i16 as u64); - info!(1i16 as f32); - info!(1i16 as f64); - - info!(1u16 as int); - info!(1u16 as uint); - info!(1u16 as float); - info!(1u16 as *libc::FILE); - info!(1u16 as i8); - info!(1u16 as i16); - info!(1u16 as i32); - info!(1u16 as i64); - info!(1u16 as u8); - info!(1u16 as u16); - info!(1u16 as u32); - info!(1u16 as u64); - info!(1u16 as f32); - info!(1u16 as f64); - - info!(1i32 as int); - info!(1i32 as uint); - info!(1i32 as float); - info!(1i32 as *libc::FILE); - info!(1i32 as i8); - info!(1i32 as i16); - info!(1i32 as i32); - info!(1i32 as i64); - info!(1i32 as u8); - info!(1i32 as u16); - info!(1i32 as u32); - info!(1i32 as u64); - info!(1i32 as f32); - info!(1i32 as f64); - - info!(1u32 as int); - info!(1u32 as uint); - info!(1u32 as float); - info!(1u32 as *libc::FILE); - info!(1u32 as i8); - info!(1u32 as i16); - info!(1u32 as i32); - info!(1u32 as i64); - info!(1u32 as u8); - info!(1u32 as u16); - info!(1u32 as u32); - info!(1u32 as u64); - info!(1u32 as f32); - info!(1u32 as f64); - - info!(1i64 as int); - info!(1i64 as uint); - info!(1i64 as float); - info!(1i64 as *libc::FILE); - info!(1i64 as i8); - info!(1i64 as i16); - info!(1i64 as i32); - info!(1i64 as i64); - info!(1i64 as u8); - info!(1i64 as u16); - info!(1i64 as u32); - info!(1i64 as u64); - info!(1i64 as f32); - info!(1i64 as f64); - - info!(1u64 as int); - info!(1u64 as uint); - info!(1u64 as float); - info!(1u64 as *libc::FILE); - info!(1u64 as i8); - info!(1u64 as i16); - info!(1u64 as i32); - info!(1u64 as i64); - info!(1u64 as u8); - info!(1u64 as u16); - info!(1u64 as u32); - info!(1u64 as u64); - info!(1u64 as f32); - info!(1u64 as f64); - - info!(1u64 as int); - info!(1u64 as uint); - info!(1u64 as float); - info!(1u64 as *libc::FILE); - info!(1u64 as i8); - info!(1u64 as i16); - info!(1u64 as i32); - info!(1u64 as i64); - info!(1u64 as u8); - info!(1u64 as u16); - info!(1u64 as u32); - info!(1u64 as u64); - info!(1u64 as f32); - info!(1u64 as f64); - - info!(true as int); - info!(true as uint); - info!(true as float); - info!(true as *libc::FILE); - info!(true as i8); - info!(true as i16); - info!(true as i32); - info!(true as i64); - info!(true as u8); - info!(true as u16); - info!(true as u32); - info!(true as u64); - info!(true as f32); - info!(true as f64); - - info!(1. as int); - info!(1. as uint); - info!(1. as float); - info!(1. as i8); - info!(1. as i16); - info!(1. as i32); - info!(1. as i64); - info!(1. as u8); - info!(1. as u16); - info!(1. as u32); - info!(1. as u64); - info!(1. as f32); - info!(1. as f64); - - info!(1f32 as int); - info!(1f32 as uint); - info!(1f32 as float); - info!(1f32 as i8); - info!(1f32 as i16); - info!(1f32 as i32); - info!(1f32 as i64); - info!(1f32 as u8); - info!(1f32 as u16); - info!(1f32 as u32); - info!(1f32 as u64); - info!(1f32 as f32); - info!(1f32 as f64); - - info!(1f64 as int); - info!(1f64 as uint); - info!(1f64 as float); - info!(1f64 as i8); - info!(1f64 as i16); - info!(1f64 as i32); - info!(1f64 as i64); - info!(1f64 as u8); - info!(1f64 as u16); - info!(1f64 as u32); - info!(1f64 as u64); - info!(1f64 as f32); - info!(1f64 as f64); + info2!("{}", f as int); + info2!("{}", f as uint); + info2!("{}", f as i8); + info2!("{}", f as i16); + info2!("{}", f as i32); + info2!("{}", f as i64); + info2!("{}", f as u8); + info2!("{}", f as u16); + info2!("{}", f as u32); + info2!("{}", f as u64); + + info2!("{}", 1 as int); + info2!("{}", 1 as uint); + info2!("{}", 1 as float); + info2!("{}", 1 as *libc::FILE); + info2!("{}", 1 as i8); + info2!("{}", 1 as i16); + info2!("{}", 1 as i32); + info2!("{}", 1 as i64); + info2!("{}", 1 as u8); + info2!("{}", 1 as u16); + info2!("{}", 1 as u32); + info2!("{}", 1 as u64); + info2!("{}", 1 as f32); + info2!("{}", 1 as f64); + + info2!("{}", 1u as int); + info2!("{}", 1u as uint); + info2!("{}", 1u as float); + info2!("{}", 1u as *libc::FILE); + info2!("{}", 1u as i8); + info2!("{}", 1u as i16); + info2!("{}", 1u as i32); + info2!("{}", 1u as i64); + info2!("{}", 1u as u8); + info2!("{}", 1u as u16); + info2!("{}", 1u as u32); + info2!("{}", 1u as u64); + info2!("{}", 1u as f32); + info2!("{}", 1u as f64); + + info2!("{}", 1i8 as int); + info2!("{}", 1i8 as uint); + info2!("{}", 1i8 as float); + info2!("{}", 1i8 as *libc::FILE); + info2!("{}", 1i8 as i8); + info2!("{}", 1i8 as i16); + info2!("{}", 1i8 as i32); + info2!("{}", 1i8 as i64); + info2!("{}", 1i8 as u8); + info2!("{}", 1i8 as u16); + info2!("{}", 1i8 as u32); + info2!("{}", 1i8 as u64); + info2!("{}", 1i8 as f32); + info2!("{}", 1i8 as f64); + + info2!("{}", 1u8 as int); + info2!("{}", 1u8 as uint); + info2!("{}", 1u8 as float); + info2!("{}", 1u8 as *libc::FILE); + info2!("{}", 1u8 as i8); + info2!("{}", 1u8 as i16); + info2!("{}", 1u8 as i32); + info2!("{}", 1u8 as i64); + info2!("{}", 1u8 as u8); + info2!("{}", 1u8 as u16); + info2!("{}", 1u8 as u32); + info2!("{}", 1u8 as u64); + info2!("{}", 1u8 as f32); + info2!("{}", 1u8 as f64); + + info2!("{}", 1i16 as int); + info2!("{}", 1i16 as uint); + info2!("{}", 1i16 as float); + info2!("{}", 1i16 as *libc::FILE); + info2!("{}", 1i16 as i8); + info2!("{}", 1i16 as i16); + info2!("{}", 1i16 as i32); + info2!("{}", 1i16 as i64); + info2!("{}", 1i16 as u8); + info2!("{}", 1i16 as u16); + info2!("{}", 1i16 as u32); + info2!("{}", 1i16 as u64); + info2!("{}", 1i16 as f32); + info2!("{}", 1i16 as f64); + + info2!("{}", 1u16 as int); + info2!("{}", 1u16 as uint); + info2!("{}", 1u16 as float); + info2!("{}", 1u16 as *libc::FILE); + info2!("{}", 1u16 as i8); + info2!("{}", 1u16 as i16); + info2!("{}", 1u16 as i32); + info2!("{}", 1u16 as i64); + info2!("{}", 1u16 as u8); + info2!("{}", 1u16 as u16); + info2!("{}", 1u16 as u32); + info2!("{}", 1u16 as u64); + info2!("{}", 1u16 as f32); + info2!("{}", 1u16 as f64); + + info2!("{}", 1i32 as int); + info2!("{}", 1i32 as uint); + info2!("{}", 1i32 as float); + info2!("{}", 1i32 as *libc::FILE); + info2!("{}", 1i32 as i8); + info2!("{}", 1i32 as i16); + info2!("{}", 1i32 as i32); + info2!("{}", 1i32 as i64); + info2!("{}", 1i32 as u8); + info2!("{}", 1i32 as u16); + info2!("{}", 1i32 as u32); + info2!("{}", 1i32 as u64); + info2!("{}", 1i32 as f32); + info2!("{}", 1i32 as f64); + + info2!("{}", 1u32 as int); + info2!("{}", 1u32 as uint); + info2!("{}", 1u32 as float); + info2!("{}", 1u32 as *libc::FILE); + info2!("{}", 1u32 as i8); + info2!("{}", 1u32 as i16); + info2!("{}", 1u32 as i32); + info2!("{}", 1u32 as i64); + info2!("{}", 1u32 as u8); + info2!("{}", 1u32 as u16); + info2!("{}", 1u32 as u32); + info2!("{}", 1u32 as u64); + info2!("{}", 1u32 as f32); + info2!("{}", 1u32 as f64); + + info2!("{}", 1i64 as int); + info2!("{}", 1i64 as uint); + info2!("{}", 1i64 as float); + info2!("{}", 1i64 as *libc::FILE); + info2!("{}", 1i64 as i8); + info2!("{}", 1i64 as i16); + info2!("{}", 1i64 as i32); + info2!("{}", 1i64 as i64); + info2!("{}", 1i64 as u8); + info2!("{}", 1i64 as u16); + info2!("{}", 1i64 as u32); + info2!("{}", 1i64 as u64); + info2!("{}", 1i64 as f32); + info2!("{}", 1i64 as f64); + + info2!("{}", 1u64 as int); + info2!("{}", 1u64 as uint); + info2!("{}", 1u64 as float); + info2!("{}", 1u64 as *libc::FILE); + info2!("{}", 1u64 as i8); + info2!("{}", 1u64 as i16); + info2!("{}", 1u64 as i32); + info2!("{}", 1u64 as i64); + info2!("{}", 1u64 as u8); + info2!("{}", 1u64 as u16); + info2!("{}", 1u64 as u32); + info2!("{}", 1u64 as u64); + info2!("{}", 1u64 as f32); + info2!("{}", 1u64 as f64); + + info2!("{}", 1u64 as int); + info2!("{}", 1u64 as uint); + info2!("{}", 1u64 as float); + info2!("{}", 1u64 as *libc::FILE); + info2!("{}", 1u64 as i8); + info2!("{}", 1u64 as i16); + info2!("{}", 1u64 as i32); + info2!("{}", 1u64 as i64); + info2!("{}", 1u64 as u8); + info2!("{}", 1u64 as u16); + info2!("{}", 1u64 as u32); + info2!("{}", 1u64 as u64); + info2!("{}", 1u64 as f32); + info2!("{}", 1u64 as f64); + + info2!("{}", true as int); + info2!("{}", true as uint); + info2!("{}", true as float); + info2!("{}", true as *libc::FILE); + info2!("{}", true as i8); + info2!("{}", true as i16); + info2!("{}", true as i32); + info2!("{}", true as i64); + info2!("{}", true as u8); + info2!("{}", true as u16); + info2!("{}", true as u32); + info2!("{}", true as u64); + info2!("{}", true as f32); + info2!("{}", true as f64); + + info2!("{}", 1. as int); + info2!("{}", 1. as uint); + info2!("{}", 1. as float); + info2!("{}", 1. as i8); + info2!("{}", 1. as i16); + info2!("{}", 1. as i32); + info2!("{}", 1. as i64); + info2!("{}", 1. as u8); + info2!("{}", 1. as u16); + info2!("{}", 1. as u32); + info2!("{}", 1. as u64); + info2!("{}", 1. as f32); + info2!("{}", 1. as f64); + + info2!("{}", 1f32 as int); + info2!("{}", 1f32 as uint); + info2!("{}", 1f32 as float); + info2!("{}", 1f32 as i8); + info2!("{}", 1f32 as i16); + info2!("{}", 1f32 as i32); + info2!("{}", 1f32 as i64); + info2!("{}", 1f32 as u8); + info2!("{}", 1f32 as u16); + info2!("{}", 1f32 as u32); + info2!("{}", 1f32 as u64); + info2!("{}", 1f32 as f32); + info2!("{}", 1f32 as f64); + + info2!("{}", 1f64 as int); + info2!("{}", 1f64 as uint); + info2!("{}", 1f64 as float); + info2!("{}", 1f64 as i8); + info2!("{}", 1f64 as i16); + info2!("{}", 1f64 as i32); + info2!("{}", 1f64 as i64); + info2!("{}", 1f64 as u8); + info2!("{}", 1f64 as u16); + info2!("{}", 1f64 as u32); + info2!("{}", 1f64 as u64); + info2!("{}", 1f64 as f32); + info2!("{}", 1f64 as f64); } diff --git a/src/test/run-pass/syntax-extension-cfg.rs b/src/test/run-pass/syntax-extension-cfg.rs index 321929207f7a6..89ca7de00e2be 100644 --- a/src/test/run-pass/syntax-extension-cfg.rs +++ b/src/test/run-pass/syntax-extension-cfg.rs @@ -13,23 +13,23 @@ fn main() { // check - if ! cfg!(foo) { fail!() } - if cfg!(not(foo)) { fail!() } + if ! cfg!(foo) { fail2!() } + if cfg!(not(foo)) { fail2!() } - if ! cfg!(bar(baz)) { fail!() } - if cfg!(not(bar(baz))) { fail!() } + if ! cfg!(bar(baz)) { fail2!() } + if cfg!(not(bar(baz))) { fail2!() } - if ! cfg!(qux="foo") { fail!() } - if cfg!(not(qux="foo")) { fail!() } + if ! cfg!(qux="foo") { fail2!() } + if cfg!(not(qux="foo")) { fail2!() } - if ! cfg!(foo, bar(baz), qux="foo") { fail!() } - if cfg!(not(foo, bar(baz), qux="foo")) { fail!() } + if ! cfg!(foo, bar(baz), qux="foo") { fail2!() } + if cfg!(not(foo, bar(baz), qux="foo")) { fail2!() } - if cfg!(not_a_cfg) { fail!() } - if cfg!(not_a_cfg, foo, bar(baz), qux="foo") { fail!() } + if cfg!(not_a_cfg) { fail2!() } + if cfg!(not_a_cfg, foo, bar(baz), qux="foo") { fail2!() } - if ! cfg!(not(not_a_cfg)) { fail!() } - if ! cfg!(not(not_a_cfg), foo, bar(baz), qux="foo") { fail!() } + if ! cfg!(not(not_a_cfg)) { fail2!() } + if ! cfg!(not(not_a_cfg), foo, bar(baz), qux="foo") { fail2!() } - if cfg!(trailing_comma, ) { fail!() } + if cfg!(trailing_comma, ) { fail2!() } } diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index 8e5892b6db194..e778645ad27b7 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -8,11 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: --cfg nofmt + extern mod extra; +macro_rules! fmt(($($arg:tt)*) => (oldfmt!($($arg)*))) + fn test(actual: ~str, expected: ~str) { - info!(actual.clone()); - info!(expected.clone()); + info2!("{}", actual.clone()); + info2!("{}", expected.clone()); assert_eq!(actual, expected); } diff --git a/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment b/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment index d5cfb94fd0b22..5d326a50f0206 100644 --- a/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment +++ b/src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment @@ -3,5 +3,5 @@ { assert!(file!().ends_with("includeme.fragment")); assert!(line!() == 5u); - fmt!("victory robot %u", line!()) + format!("victory robot {}", line!()) } diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index ee0b258fd4638..6f5ca090052f2 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -21,7 +21,7 @@ struct t_rec { pub fn main() { let x = t_rec {c8: 22u8, t: a_tag(44u64)}; - let y = fmt!("%?", x); - info!("y = %s", y); + let y = format!("{:?}", x); + info2!("y = {}", y); assert_eq!(y, ~"t_rec{c8: 22u8, t: a_tag(44u64)}"); } diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index d1dec9c44e0f2..3566eedcb5551 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -17,9 +17,9 @@ enum color { } pub fn main() { - let act = fmt!("%?", red); + let act = format!("{:?}", red); println(act); assert_eq!(~"red", act); - assert_eq!(~"green", fmt!("%?", green)); - assert_eq!(~"white", fmt!("%?", white)); + assert_eq!(~"green", format!("{:?}", green)); + assert_eq!(~"white", format!("{:?}", white)); } diff --git a/src/test/run-pass/tail-cps.rs b/src/test/run-pass/tail-cps.rs index 99371bec58bdb..9991f05aa3ac4 100644 --- a/src/test/run-pass/tail-cps.rs +++ b/src/test/run-pass/tail-cps.rs @@ -17,13 +17,13 @@ fn checktrue(rs: bool) -> bool { assert!((rs)); return true; } pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } fn evenk(n: int, k: extern fn(bool) -> bool) -> bool { - info!("evenk"); - info!(n); + info2!("evenk"); + info2!("{:?}", n); if n == 0 { return k(true); } else { return oddk(n - 1, k); } } fn oddk(n: int, k: extern fn(bool) -> bool) -> bool { - info!("oddk"); - info!(n); + info2!("oddk"); + info2!("{:?}", n); if n == 0 { return k(false); } else { return evenk(n - 1, k); } } diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index 7eb879782d1d7..69d66092abf64 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -20,21 +20,21 @@ pub fn main() { test05(); } fn test05_start(ch : &Chan) { ch.send(10); - error!("sent 10"); + error2!("sent 10"); ch.send(20); - error!("sent 20"); + error2!("sent 20"); ch.send(30); - error!("sent 30"); + error2!("sent 30"); } fn test05() { let (po, ch) = comm::stream(); task::spawn(|| test05_start(&ch) ); let mut value: int = po.recv(); - error!(value); + error2!("{}", value); value = po.recv(); - error!(value); + error2!("{}", value); value = po.recv(); - error!(value); + error2!("{}", value); assert_eq!(value, 30); } diff --git a/src/test/run-pass/task-comm-1.rs b/src/test/run-pass/task-comm-1.rs index d202bac7089b1..f169566653a3b 100644 --- a/src/test/run-pass/task-comm-1.rs +++ b/src/test/run-pass/task-comm-1.rs @@ -12,9 +12,9 @@ use std::task; pub fn main() { test00(); } -fn start() { info!("Started / Finished task."); } +fn start() { info2!("Started / Finished task."); } fn test00() { task::try(|| start() ); - info!("Completing."); + info2!("Completing."); } diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index fd0d9568845c1..023bb142e444c 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -23,10 +23,10 @@ fn start(c: &comm::Chan>) { let mut b; a = p.recv(); assert!(a == ~"A"); - error!(a); + error2!("{:?}", a); b = p.recv(); assert!(b == ~"B"); - error!(b); + error2!("{:?}", b); } pub fn main() { diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index 7e741959a9c4f..c640bd32bad32 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -14,7 +14,7 @@ use std::task; pub fn main() { test00(); } -fn start(_task_number: int) { info!("Started / Finished task."); } +fn start(_task_number: int) { info2!("Started / Finished task."); } fn test00() { let i: int = 0; @@ -35,5 +35,5 @@ fn test00() { // Try joining tasks that have already finished. result.unwrap().recv(); - info!("Joined task."); + info2!("Joined task."); } diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index b039f01bf0cd9..2bbed1497cc5e 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -21,8 +21,8 @@ fn start(c: &comm::Chan, start: int, number_of_messages: int) { } pub fn main() { - info!("Check that we don't deadlock."); + info2!("Check that we don't deadlock."); let (_p, ch) = comm::stream(); task::try(|| start(&ch, 0, 10) ); - info!("Joined task"); + info2!("Joined task"); } diff --git a/src/test/run-pass/task-comm-14.rs b/src/test/run-pass/task-comm-14.rs index a04e3525d34dd..cacaea5e8c06f 100644 --- a/src/test/run-pass/task-comm-14.rs +++ b/src/test/run-pass/task-comm-14.rs @@ -20,7 +20,7 @@ pub fn main() { // Spawn 10 tasks each sending us back one int. let mut i = 10; while (i > 0) { - info!(i); + info2!("{}", i); let ch = ch.clone(); task::spawn({let i = i; || child(i, &ch)}); i = i - 1; @@ -31,15 +31,15 @@ pub fn main() { i = 10; while (i > 0) { - info!(i); + info2!("{}", i); po.recv(); i = i - 1; } - info!("main thread exiting"); + info2!("main thread exiting"); } fn child(x: int, ch: &comm::SharedChan) { - info!(x); + info2!("{}", x); ch.send(x); } diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index ae6eb6acee417..53c3b7f17eae1 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -16,24 +16,24 @@ use std::comm::SharedChan; use std::comm; use std::task; -pub fn main() { info!("===== WITHOUT THREADS ====="); test00(); } +pub fn main() { info2!("===== WITHOUT THREADS ====="); test00(); } fn test00_start(ch: &SharedChan, message: int, count: int) { - info!("Starting test00_start"); + info2!("Starting test00_start"); let mut i: int = 0; while i < count { - info!("Sending Message"); + info2!("Sending Message"); ch.send(message + 0); i = i + 1; } - info!("Ending test00_start"); + info2!("Ending test00_start"); } fn test00() { let number_of_tasks: int = 16; let number_of_messages: int = 4; - info!("Creating tasks"); + info2!("Creating tasks"); let (po, ch) = comm::stream(); let ch = comm::SharedChan::new(ch); @@ -67,8 +67,8 @@ fn test00() { // Join spawned tasks... for r in results.iter() { r.recv(); } - info!("Completed: Final number is: "); - error!(sum); + info2!("Completed: Final number is: "); + error2!("{:?}", sum); // assert (sum == (((number_of_tasks * (number_of_tasks - 1)) / 2) * // number_of_messages)); assert_eq!(sum, 480); diff --git a/src/test/run-pass/task-comm-4.rs b/src/test/run-pass/task-comm-4.rs index ecc344e7ba6ac..80d981b0d4550 100644 --- a/src/test/run-pass/task-comm-4.rs +++ b/src/test/run-pass/task-comm-4.rs @@ -24,31 +24,31 @@ fn test00() { c.send(4); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); c.send(5); c.send(6); c.send(7); c.send(8); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); r = p.recv(); sum += r; - info!(r); + info2!("{}", r); assert_eq!(sum, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8); } diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index 86e3e24a3ee23..789425361f8c9 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -38,7 +38,7 @@ fn test00() { let mut i: int = 0; while i < number_of_messages { sum += p.recv(); - info!(r); + info2!("{:?}", r); i += 1; } diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index cde6cc102afa3..d4cb175b1bd1b 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -34,7 +34,7 @@ fn test_mkdtemp() { // to depend on std fn recursive_mkdir_rel() { let path = Path("frob"); - debug!("recursive_mkdir_rel: Making: %s in cwd %s [%?]", path.to_str(), + debug2!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.to_str(), os::getcwd().to_str(), os::path_exists(&path)); assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32)); @@ -52,13 +52,13 @@ fn recursive_mkdir_dot() { fn recursive_mkdir_rel_2() { let path = Path("./frob/baz"); - debug!("recursive_mkdir_rel_2: Making: %s in cwd %s [%?]", path.to_str(), + debug2!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.to_str(), os::getcwd().to_str(), os::path_exists(&path)); assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32)); assert!(os::path_is_dir(&path)); assert!(os::path_is_dir(&path.pop())); let path2 = Path("quux/blat"); - debug!("recursive_mkdir_rel_2: Making: %s in cwd %s", path2.to_str(), + debug2!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.to_str(), os::getcwd().to_str()); assert!(os::mkdir_recursive(&path2, (S_IRUSR | S_IWUSR | S_IXUSR) as i32)); assert!(os::path_is_dir(&path2)); @@ -73,7 +73,7 @@ pub fn test_rmdir_recursive_ok() { couldn't create temp dir"); let root = tmpdir.push("foo"); - debug!("making %s", root.to_str()); + debug2!("making {}", root.to_str()); assert!(os::make_dir(&root, rwx)); assert!(os::make_dir(&root.push("foo"), rwx)); assert!(os::make_dir(&root.push("foo").push("bar"), rwx)); diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index 65dd34ade0912..a2ba9e69bedb7 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -22,12 +22,12 @@ fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: @int = loop; } } fn test_ret() { let _x: @int = return; } fn test_fail() { - fn f() { let _x: @int = fail!(); } + fn f() { let _x: @int = fail2!(); } task::try(|| f() ); } fn test_fail_indirect() { - fn f() -> ! { fail!(); } + fn f() -> ! { fail2!(); } fn g() { let _x: @int = f(); } task::try(|| g() ); } diff --git a/src/test/run-pass/test-runner-hides-main.rs b/src/test/run-pass/test-runner-hides-main.rs index 3f1e9fe4c5197..a399d22cdad00 100644 --- a/src/test/run-pass/test-runner-hides-main.rs +++ b/src/test/run-pass/test-runner-hides-main.rs @@ -15,4 +15,4 @@ extern mod extra; // Building as a test runner means that a synthetic main will be run, // not ours -pub fn main() { fail!(); } +pub fn main() { fail2!(); } diff --git a/src/test/run-pass/threads.rs b/src/test/run-pass/threads.rs index 0c82e0194e523..81fcfd7efa0e7 100644 --- a/src/test/run-pass/threads.rs +++ b/src/test/run-pass/threads.rs @@ -16,7 +16,7 @@ use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } - info!("main thread exiting"); + info2!("main thread exiting"); } -fn child(x: int) { info!(x); } +fn child(x: int) { info2!("{}", x); } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index dbda29fc227ee..0d6246655a4df 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -38,7 +38,7 @@ impl to_str for Tree { fn to_str_(&self) -> ~str { let (l, r) = (self.left, self.right); let val = &self.val; - fmt!("[%s, %s, %s]", val.to_str_(), l.to_str_(), r.to_str_()) + format!("[{}, {}, {}]", val.to_str_(), l.to_str_(), r.to_str_()) } } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 8ecad8d4fe163..baeb9779a7f39 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -20,7 +20,7 @@ impl to_str for int { impl to_str for ~[T] { fn to_string(&self) -> ~str { - fmt!("[%s]", self.iter().map(|e| e.to_string()).collect::<~[~str]>().connect(", ")) + format!("[{}]", self.iter().map(|e| e.to_string()).to_owned_vec().connect(", ")) } } diff --git a/src/test/run-pass/traits-default-method-macro.rs b/src/test/run-pass/traits-default-method-macro.rs index a78177ea892d2..340d0bc71aa13 100644 --- a/src/test/run-pass/traits-default-method-macro.rs +++ b/src/test/run-pass/traits-default-method-macro.rs @@ -11,7 +11,7 @@ trait Foo { fn bar(&self) -> ~str { - fmt!("test") + format!("test") } } diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index 2e0cc7e5a5790..62b415422a3b5 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -19,5 +19,5 @@ pub fn main() { let (po, ch) = comm::stream(); ch.send(42); let r = po.recv(); - error!(r); + error2!("{:?}", r); } diff --git a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs index 19a3c52dea8c3..8de2c1e0814b7 100644 --- a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs +++ b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs @@ -9,7 +9,7 @@ macro_rules! test( match (a, b) { (A(x), A(y)) => A($e), (B(x), B(y)) => B($e), - _ => fail!() + _ => fail2!() } } ) diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index c14dd0471f91e..0d37c0f443d23 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -61,5 +61,5 @@ pub fn main() { assert!(!Equal::isEq(branch(@leaf(magenta), @leaf(cyan)), branch(@leaf(magenta), @leaf(magenta)))); - error!("Assertions all succeeded!"); + error2!("Assertions all succeeded!"); } diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index 18a68bc1c34f9..11973df2fec30 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -60,5 +60,5 @@ pub fn main() { assert!(!branch(@leaf(magenta), @leaf(cyan)) .isEq(branch(@leaf(magenta), @leaf(magenta)))); - error!("Assertions all succeeded!"); + error2!("Assertions all succeeded!"); } diff --git a/src/test/run-pass/unary-minus-suffix-inference.rs b/src/test/run-pass/unary-minus-suffix-inference.rs index 7300ca989a31c..e1ed28bc2ccd2 100644 --- a/src/test/run-pass/unary-minus-suffix-inference.rs +++ b/src/test/run-pass/unary-minus-suffix-inference.rs @@ -11,43 +11,43 @@ pub fn main() { let a = 1; let a_neg: i8 = -a; - error!(a_neg); + error2!("{}", a_neg); let b = 1; let b_neg: i16 = -b; - error!(b_neg); + error2!("{}", b_neg); let c = 1; let c_neg: i32 = -c; - error!(c_neg); + error2!("{}", c_neg); let d = 1; let d_neg: i64 = -d; - error!(d_neg); + error2!("{}", d_neg); let e = 1; let e_neg: int = -e; - error!(e_neg); + error2!("{}", e_neg); // intentional overflows let f = 1; let f_neg: u8 = -f; - error!(f_neg); + error2!("{}", f_neg); let g = 1; let g_neg: u16 = -g; - error!(g_neg); + error2!("{}", g_neg); let h = 1; let h_neg: u32 = -h; - error!(h_neg); + error2!("{}", h_neg); let i = 1; let i_neg: u64 = -i; - error!(i_neg); + error2!("{}", i_neg); let j = 1; let j_neg: uint = -j; - error!(j_neg); + error2!("{}", j_neg); } diff --git a/src/test/run-pass/unique-copy-box.rs b/src/test/run-pass/unique-copy-box.rs index 16fb4eba5ba08..2d91cd9b8a9fc 100644 --- a/src/test/run-pass/unique-copy-box.rs +++ b/src/test/run-pass/unique-copy-box.rs @@ -18,6 +18,6 @@ pub fn main() { let rc1 = sys::refcount(*i); let j = i.clone(); let rc2 = sys::refcount(*i); - error!("rc1: %u rc2: %u", rc1, rc2); + error2!("rc1: {} rc2: {}", rc1, rc2); assert_eq!(rc1 + 1u, rc2); } diff --git a/src/test/run-pass/unique-decl.rs b/src/test/run-pass/unique-decl.rs index 74b73d7736998..14a651943fde9 100644 --- a/src/test/run-pass/unique-decl.rs +++ b/src/test/run-pass/unique-decl.rs @@ -13,5 +13,5 @@ pub fn main() { } fn f(_i: ~int) -> ~int { - fail!(); + fail2!(); } diff --git a/src/test/run-pass/unique-in-tag.rs b/src/test/run-pass/unique-in-tag.rs index 0e7d38494615c..d0fa48a6c4d50 100644 --- a/src/test/run-pass/unique-in-tag.rs +++ b/src/test/run-pass/unique-in-tag.rs @@ -14,7 +14,7 @@ fn test1() { let x = u(~10); assert!(match x { u(a) => { - error!(a); + error2!("{:?}", a); *a } _ => { 66 } diff --git a/src/test/run-pass/unique-log.rs b/src/test/run-pass/unique-log.rs index 37cf6a262356e..24342190e3fc4 100644 --- a/src/test/run-pass/unique-log.rs +++ b/src/test/run-pass/unique-log.rs @@ -10,5 +10,5 @@ pub fn main() { let i = ~100; - error!(i); + error2!("{:?}", i); } diff --git a/src/test/run-pass/unique-pat-3.rs b/src/test/run-pass/unique-pat-3.rs index 78551b701f29b..7a9790973d011 100644 --- a/src/test/run-pass/unique-pat-3.rs +++ b/src/test/run-pass/unique-pat-3.rs @@ -14,7 +14,7 @@ enum bar { u(~int), w(int), } pub fn main() { assert!(match u(~10) { u(a) => { - error!(a); + error2!("{:?}", a); *a } _ => { 66 } diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index 0b9ad6ee194e7..d33db85eb30e0 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -11,7 +11,7 @@ fn simple() { match ~true { ~true => { } - _ => { fail!(); } + _ => { fail2!(); } } } diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs index 7b450168cc4a8..2d7234cbe3145 100644 --- a/src/test/run-pass/unit-like-struct-drop-run.rs +++ b/src/test/run-pass/unit-like-struct-drop-run.rs @@ -16,7 +16,7 @@ struct Foo; impl Drop for Foo { fn drop(&mut self) { - fail!("This failure should happen."); + fail2!("This failure should happen."); } } diff --git a/src/test/run-pass/unreachable-code-1.rs b/src/test/run-pass/unreachable-code-1.rs index d1896a258c634..e094f874c3fdd 100644 --- a/src/test/run-pass/unreachable-code-1.rs +++ b/src/test/run-pass/unreachable-code-1.rs @@ -14,7 +14,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = fail!(); + let c = fail2!(); id(c); //~ WARNING unreachable statement } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index 2c65e2283e8ed..55a359efeed45 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -15,7 +15,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = fail!(); + let c = fail2!(); id(c); } diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs index 24e898a90bb77..de65d9bbaba2b 100644 --- a/src/test/run-pass/unwind-box.rs +++ b/src/test/run-pass/unwind-box.rs @@ -14,7 +14,7 @@ use std::task; fn f() { let _a = @0; - fail!(); + fail2!(); } pub fn main() { diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index f1d5009fe8894..85676217d4f62 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -21,14 +21,14 @@ struct complainer { impl Drop for complainer { fn drop(&mut self) { - error!("About to send!"); + error2!("About to send!"); self.c.send(true); - error!("Sent!"); + error2!("Sent!"); } } fn complainer(c: SharedChan) -> complainer { - error!("Hello!"); + error2!("Hello!"); complainer { c: c } @@ -36,13 +36,13 @@ fn complainer(c: SharedChan) -> complainer { fn f(c: SharedChan) { let _c = complainer(c); - fail!(); + fail2!(); } pub fn main() { let (p, c) = stream(); let c = SharedChan::new(c); task::spawn_unlinked(|| f(c.clone()) ); - error!("hiiiiiiiii"); + error2!("hiiiiiiiii"); assert!(p.recv()); } diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs index 5b0cd17eea05e..751b9430e3b55 100644 --- a/src/test/run-pass/unwind-resource2.rs +++ b/src/test/run-pass/unwind-resource2.rs @@ -29,7 +29,7 @@ fn complainer(c: @int) -> complainer { fn f() { let _c = complainer(@0); - fail!(); + fail2!(); } pub fn main() { diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 0038392115b16..07610fe7115ca 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -14,7 +14,7 @@ use std::task; fn f() { let _a = ~0; - fail!(); + fail2!(); } pub fn main() { diff --git a/src/test/run-pass/use-uninit-match.rs b/src/test/run-pass/use-uninit-match.rs index 4e0e5347d4d22..18698a48613b8 100644 --- a/src/test/run-pass/use-uninit-match.rs +++ b/src/test/run-pass/use-uninit-match.rs @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { info!(5); } +pub fn main() { info2!("{}", 5); } diff --git a/src/test/run-pass/use-uninit-match2.rs b/src/test/run-pass/use-uninit-match2.rs index 46d3bef86b5c1..844b0521f3a39 100644 --- a/src/test/run-pass/use-uninit-match2.rs +++ b/src/test/run-pass/use-uninit-match2.rs @@ -13,7 +13,7 @@ fn foo(o: myoption) -> int { let mut x: int; match o { - none:: => { fail!(); } + none:: => { fail2!(); } some::(_t) => { x = 5; } } return x; @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { info!(5); } +pub fn main() { info2!("{}", 5); } diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index 0eb3fd75dc3da..5222b0eb984ae 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -42,10 +42,10 @@ pub fn main() { fn check_str_eq(a: ~str, b: ~str) { let mut i: int = 0; for ab in a.byte_iter() { - info!(i); - info!(ab); + info2!("{}", i); + info2!("{}", ab); let bb: u8 = b[i]; - info!(bb); + info2!("{}", bb); assert_eq!(ab, bb); i += 1; } diff --git a/src/test/run-pass/vec-concat.rs b/src/test/run-pass/vec-concat.rs index 54fe4408e48f5..0a8a9b1bab799 100644 --- a/src/test/run-pass/vec-concat.rs +++ b/src/test/run-pass/vec-concat.rs @@ -13,7 +13,7 @@ pub fn main() { let a: ~[int] = ~[1, 2, 3, 4, 5]; let b: ~[int] = ~[6, 7, 8, 9, 0]; let v: ~[int] = a + b; - info!(v[9]); + info2!("{}", v[9]); assert_eq!(v[0], 1); assert_eq!(v[7], 8); assert_eq!(v[9], 0); diff --git a/src/test/run-pass/vec-late-init.rs b/src/test/run-pass/vec-late-init.rs index 3b07a4ecbcb73..e11bd257d42fb 100644 --- a/src/test/run-pass/vec-late-init.rs +++ b/src/test/run-pass/vec-late-init.rs @@ -13,5 +13,5 @@ pub fn main() { let mut later: ~[int]; if true { later = ~[1]; } else { later = ~[2]; } - info!(later[0]); + info2!("{}", later[0]); } diff --git a/src/test/run-pass/vec-matching-autoslice.rs b/src/test/run-pass/vec-matching-autoslice.rs index 2ad21aba6cdd8..8965ee688425a 100644 --- a/src/test/run-pass/vec-matching-autoslice.rs +++ b/src/test/run-pass/vec-matching-autoslice.rs @@ -1,22 +1,22 @@ pub fn main() { let x = @[1, 2, 3]; match x { - [2, .._] => fail!(), + [2, .._] => fail2!(), [1, ..tail] => { assert_eq!(tail, [2, 3]); } - [_] => fail!(), - [] => fail!() + [_] => fail2!(), + [] => fail2!() } let y = (~[(1, true), (2, false)], 0.5); match y { - ([_, _, _], 0.5) => fail!(), + ([_, _, _], 0.5) => fail2!(), ([(1, a), (b, false), ..tail], _) => { assert_eq!(a, true); assert_eq!(b, 2); assert!(tail.is_empty()); } - ([.._tail], _) => fail!() + ([.._tail], _) => fail2!() } } diff --git a/src/test/run-pass/vec-matching.rs b/src/test/run-pass/vec-matching.rs index c09fb8d6bc7ef..dec29c8da5330 100644 --- a/src/test/run-pass/vec-matching.rs +++ b/src/test/run-pass/vec-matching.rs @@ -1,14 +1,14 @@ fn a() { let x = ~[1]; match x { - [_, _, _, _, _, .._] => fail!(), - [.._, _, _, _, _] => fail!(), - [_, .._, _, _] => fail!(), - [_, _] => fail!(), + [_, _, _, _, _, .._] => fail2!(), + [.._, _, _, _, _] => fail2!(), + [_, .._, _, _] => fail2!(), + [_, _] => fail2!(), [a] => { assert_eq!(a, 1); } - [] => fail!() + [] => fail2!() } } @@ -20,7 +20,7 @@ fn b() { assert_eq!(b, 2); assert_eq!(c, &[3]); } - _ => fail!() + _ => fail2!() } match x { [..a, b, c] => { @@ -28,7 +28,7 @@ fn b() { assert_eq!(b, 2); assert_eq!(c, 3); } - _ => fail!() + _ => fail2!() } match x { [a, ..b, c] => { @@ -36,7 +36,7 @@ fn b() { assert_eq!(b, &[2]); assert_eq!(c, 3); } - _ => fail!() + _ => fail2!() } match x { [a, b, c] => { @@ -44,14 +44,14 @@ fn b() { assert_eq!(b, 2); assert_eq!(c, 3); } - _ => fail!() + _ => fail2!() } } fn c() { let x = [1]; match x { - [2, .. _] => fail!(), + [2, .. _] => fail2!(), [.. _] => () } } diff --git a/src/test/run-pass/vec-self-append.rs b/src/test/run-pass/vec-self-append.rs index ef661c7ed6723..4d5286502b7df 100644 --- a/src/test/run-pass/vec-self-append.rs +++ b/src/test/run-pass/vec-self-append.rs @@ -47,7 +47,7 @@ fn test_loop() { let mut i = 20; let mut expected_len = 1u; while i > 0 { - error!(a.len()); + error2!("{}", a.len()); assert_eq!(a.len(), expected_len); a = a + a; // FIXME(#3387)---can't write a += a i -= 1; diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 7c20f9823d9f0..16070049151b5 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -61,17 +61,17 @@ fn canttouchthis() -> uint { fn p() -> bool { true } let _a = (assert!((true)) == (assert!(p()))); let _c = (assert!((p())) == ()); - let _b: bool = (info!("%d", 0) == (return 0u)); + let _b: bool = (info2!("{}", 0) == (return 0u)); } fn angrydome() { loop { if break { } } let mut i = 0; - loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail!("wat") } } + loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail2!("wat") } } break; } } -fn evil_lincoln() { let _evil = info!("lincoln"); } +fn evil_lincoln() { let _evil = info2!("lincoln"); } pub fn main() { strange(); diff --git a/src/test/run-pass/while-cont.rs b/src/test/run-pass/while-cont.rs index f0e6d4b45a5c4..44c3225bb1594 100644 --- a/src/test/run-pass/while-cont.rs +++ b/src/test/run-pass/while-cont.rs @@ -13,7 +13,7 @@ pub fn main() { let mut i = 1; while i > 0 { assert!((i > 0)); - info!(i); + info2!("{}", i); i -= 1; continue; } diff --git a/src/test/run-pass/while-loop-constraints-2.rs b/src/test/run-pass/while-loop-constraints-2.rs index fb629a8deae2b..a07d122c8e2ce 100644 --- a/src/test/run-pass/while-loop-constraints-2.rs +++ b/src/test/run-pass/while-loop-constraints-2.rs @@ -18,7 +18,7 @@ pub fn main() { while z < 50 { z += 1; while false { x = y; y = z; } - info!(y); + info2!("{}", y); } assert!((y == 42 && z == 50)); } diff --git a/src/test/run-pass/while-with-break.rs b/src/test/run-pass/while-with-break.rs index 185b686c24ebd..05eea29b31da0 100644 --- a/src/test/run-pass/while-with-break.rs +++ b/src/test/run-pass/while-with-break.rs @@ -5,13 +5,13 @@ pub fn main() { let mut i: int = 90; while i < 100 { - info!(i); + info2!("{}", i); i = i + 1; if i == 95 { let _v: ~[int] = ~[1, 2, 3, 4, 5]; // we check that it is freed by break - info!("breaking"); + info2!("breaking"); break; } } diff --git a/src/test/run-pass/while.rs b/src/test/run-pass/while.rs index 8c6186ef10e0d..4295c89865f11 100644 --- a/src/test/run-pass/while.rs +++ b/src/test/run-pass/while.rs @@ -13,10 +13,10 @@ pub fn main() { let mut x: int = 10; let mut y: int = 0; - while y < x { info!(y); info!("hello"); y = y + 1; } + while y < x { info2!("{}", y); info2!("hello"); y = y + 1; } while x > 0 { - info!("goodbye"); + info2!("goodbye"); x = x - 1; - info!(x); + info2!("{}", x); } } diff --git a/src/test/run-pass/writealias.rs b/src/test/run-pass/writealias.rs index 2db954d27c10b..06c2ca7be0bc8 100644 --- a/src/test/run-pass/writealias.rs +++ b/src/test/run-pass/writealias.rs @@ -22,7 +22,7 @@ pub fn main() { Some(ref z) if z.with(|b| *b) => { do z.with |b| { assert!(*b); } }, - _ => fail!() + _ => fail2!() } } } diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index 040084df911c7..48079843dfe94 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -16,14 +16,14 @@ pub fn main() { let mut builder = task::task(); builder.future_result(|r| { result = Some(r); }); builder.spawn(child); - error!("1"); + error2!("1"); task::deschedule(); - error!("2"); + error2!("2"); task::deschedule(); - error!("3"); + error2!("3"); result.unwrap().recv(); } fn child() { - error!("4"); task::deschedule(); error!("5"); task::deschedule(); error!("6"); + error2!("4"); task::deschedule(); error2!("5"); task::deschedule(); error2!("6"); } diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index cee7f5f4ef098..4cfa3a9523617 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -16,9 +16,9 @@ pub fn main() { let mut builder = task::task(); builder.future_result(|r| { result = Some(r); }); builder.spawn(child); - error!("1"); + error2!("1"); task::deschedule(); result.unwrap().recv(); } -fn child() { error!("2"); } +fn child() { error2!("2"); } diff --git a/src/test/run-pass/yield2.rs b/src/test/run-pass/yield2.rs index 5e3dde0257266..6dc96536540d4 100644 --- a/src/test/run-pass/yield2.rs +++ b/src/test/run-pass/yield2.rs @@ -13,5 +13,5 @@ use std::task; pub fn main() { let mut i: int = 0; - while i < 100 { i = i + 1; error!(i); task::deschedule(); } + while i < 100 { i = i + 1; error2!("{}", i); task::deschedule(); } } From ebf5f406ef6e291655ec9eca5aa8bd95775cc67c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 29 Sep 2013 20:06:21 -0700 Subject: [PATCH 11/16] cfail: Remove usage of fmt! --- src/test/compile-fail/assign-imm-local-twice.rs | 4 ++-- src/test/compile-fail/assign-to-method.rs | 2 +- src/test/compile-fail/autoderef-full-lval.rs | 4 ++-- src/test/compile-fail/bad-bang-ann.rs | 2 +- src/test/compile-fail/bad-const-type.rs | 2 +- ...e-neither-can-live-while-the-other-survives-1.rs | 4 ++-- ...e-neither-can-live-while-the-other-survives-2.rs | 4 ++-- ...e-neither-can-live-while-the-other-survives-3.rs | 4 ++-- ...e-neither-can-live-while-the-other-survives-4.rs | 4 ++-- src/test/compile-fail/bind-by-move-no-guards.rs | 4 ++-- .../compile-fail/bind-by-move-no-sub-bindings.rs | 4 ++-- .../compile-fail/block-arg-as-stmt-with-value.rs | 2 +- src/test/compile-fail/block-coerce-no.rs | 2 +- src/test/compile-fail/bogus-tag.rs | 4 ++-- .../compile-fail/borrowck-anon-fields-variant.rs | 8 ++++---- src/test/compile-fail/borrowck-assign-comp-idx.rs | 2 +- src/test/compile-fail/borrowck-autoref-3261.rs | 2 +- .../compile-fail/borrowck-borrow-from-owned-ptr.rs | 2 +- .../borrowck-borrow-from-stack-variable.rs | 2 +- .../compile-fail/borrowck-borrowed-uniq-rvalue-2.rs | 2 +- src/test/compile-fail/borrowck-lend-flow-if.rs | 6 +++--- src/test/compile-fail/borrowck-lend-flow-loop.rs | 4 ++-- src/test/compile-fail/borrowck-lend-flow-match.rs | 2 +- src/test/compile-fail/borrowck-lend-flow.rs | 6 +++--- .../compile-fail/borrowck-loan-blocks-move-cc.rs | 4 ++-- .../borrowck-loan-local-as-both-mut-and-imm.rs | 2 +- .../compile-fail/borrowck-move-out-of-vec-tail.rs | 2 +- .../compile-fail/borrowck-mut-addr-of-imm-var.rs | 2 +- src/test/compile-fail/borrowck-ref-into-rvalue.rs | 2 +- .../borrowck-vec-pattern-element-loan.rs | 6 +++--- .../compile-fail/borrowck-vec-pattern-nesting.rs | 2 +- .../borrowck-vec-pattern-tail-element-loan.rs | 2 +- src/test/compile-fail/class-cast-to-trait.rs | 6 +++--- src/test/compile-fail/class-missing-self.rs | 2 +- src/test/compile-fail/closure-that-fails.rs | 2 +- src/test/compile-fail/copy-a-resource.rs | 2 +- src/test/compile-fail/debug-correct-span.rs | 13 ------------- src/test/compile-fail/deref-non-pointer.rs | 2 +- src/test/compile-fail/die-not-static.rs | 8 -------- ...allowed-deconstructing-destructing-struct-let.rs | 4 ++-- ...lowed-deconstructing-destructing-struct-match.rs | 4 ++-- src/test/compile-fail/does-nothing.rs | 2 +- src/test/compile-fail/export2.rs | 2 +- src/test/compile-fail/extfmt-missing-type.rs | 2 +- src/test/compile-fail/extfmt-no-args.rs | 2 +- src/test/compile-fail/extfmt-non-literal.rs | 2 +- src/test/compile-fail/extfmt-non-literal2.rs | 2 +- src/test/compile-fail/extfmt-not-enough-args.rs | 2 +- src/test/compile-fail/extfmt-too-many-args.rs | 2 +- src/test/compile-fail/extfmt-unknown-type.rs | 2 +- src/test/compile-fail/extfmt-unsigned-plus.rs | 2 +- src/test/compile-fail/extfmt-unsigned-space.rs | 2 +- src/test/compile-fail/extfmt-unterminated-conv.rs | 2 +- src/test/compile-fail/fail-expr.rs | 2 +- src/test/compile-fail/fail-simple.rs | 2 +- src/test/compile-fail/fail-type-err.rs | 2 +- .../functional-struct-update-noncopyable.rs | 2 +- src/test/compile-fail/if-without-else-result.rs | 2 +- src/test/compile-fail/import-glob-0.rs | 8 ++++---- src/test/compile-fail/import-glob-circular.rs | 4 ++-- src/test/compile-fail/import.rs | 2 +- src/test/compile-fail/import2.rs | 2 +- src/test/compile-fail/import3.rs | 2 +- src/test/compile-fail/import4.rs | 2 +- src/test/compile-fail/issue-1448-2.rs | 4 +++- src/test/compile-fail/issue-1476.rs | 2 +- src/test/compile-fail/issue-2149.rs | 2 +- src/test/compile-fail/issue-2150.rs | 2 +- src/test/compile-fail/issue-2151.rs | 2 +- src/test/compile-fail/issue-2281-part1.rs | 2 +- src/test/compile-fail/issue-2330.rs | 2 +- src/test/compile-fail/issue-2370-2.rs | 2 +- src/test/compile-fail/issue-2370.rs | 2 +- src/test/compile-fail/issue-2611-4.rs | 2 +- src/test/compile-fail/issue-2611-5.rs | 2 +- src/test/compile-fail/issue-2823.rs | 2 +- src/test/compile-fail/issue-3021.rs | 2 +- src/test/compile-fail/issue-3038.rs | 4 ++-- src/test/compile-fail/issue-3099.rs | 6 +++--- src/test/compile-fail/issue-3521-2.rs | 2 +- src/test/compile-fail/issue-3521.rs | 2 +- src/test/compile-fail/issue-3601.rs | 2 +- src/test/compile-fail/issue-3668.rs | 2 +- src/test/compile-fail/issue-5062.rs | 2 +- src/test/compile-fail/issue-5439.rs | 2 +- src/test/compile-fail/issue-6458-1.rs | 2 +- src/test/compile-fail/issue-6458-2.rs | 2 +- src/test/compile-fail/lint-unused-unsafe.rs | 4 ++-- src/test/compile-fail/liveness-and-init.rs | 4 ++-- src/test/compile-fail/liveness-bad-bang-2.rs | 2 +- src/test/compile-fail/liveness-block-unint.rs | 2 +- src/test/compile-fail/liveness-break-uninit-2.rs | 4 ++-- src/test/compile-fail/liveness-break-uninit.rs | 4 ++-- .../compile-fail/liveness-closure-require-ret.rs | 2 +- src/test/compile-fail/liveness-if-no-else.rs | 2 +- src/test/compile-fail/liveness-if-with-else.rs | 4 ++-- src/test/compile-fail/liveness-init-in-fn-expr.rs | 2 +- src/test/compile-fail/liveness-move-in-loop.rs | 2 +- src/test/compile-fail/liveness-move-in-while.rs | 2 +- src/test/compile-fail/liveness-or-init.rs | 4 ++-- src/test/compile-fail/liveness-uninit.rs | 2 +- src/test/compile-fail/liveness-use-after-move.rs | 2 +- src/test/compile-fail/liveness-use-after-send.rs | 10 +++++----- src/test/compile-fail/liveness-while-break.rs | 2 +- src/test/compile-fail/match-join.rs | 4 ++-- src/test/compile-fail/moves-based-on-type-exprs.rs | 2 +- .../moves-based-on-type-match-bindings.rs | 2 +- ...oves-based-on-type-no-recursive-stack-closure.rs | 2 +- src/test/compile-fail/no-capture-arc.rs | 2 +- src/test/compile-fail/no-reuse-move-arc.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 2 +- .../compile-fail/non-exhaustive-match-nested.rs | 4 ++-- src/test/compile-fail/noncopyable-class.rs | 2 +- src/test/compile-fail/nonscalar-cast.rs | 2 +- src/test/compile-fail/not-enough-arguments.rs | 2 +- src/test/compile-fail/oversized-literal.rs | 2 +- .../compile-fail/packed-struct-generic-transmute.rs | 2 +- src/test/compile-fail/packed-struct-transmute.rs | 2 +- src/test/compile-fail/pattern-tyvar-2.rs | 2 +- src/test/compile-fail/pattern-tyvar.rs | 4 ++-- src/test/compile-fail/pinned-deep-copy.rs | 4 ++-- src/test/compile-fail/regions-addr-of-self.rs | 2 +- src/test/compile-fail/regions-fn-subtyping.rs | 4 ++-- .../regions-free-region-ordering-callee.rs | 2 +- src/test/compile-fail/regions-freevar.rs | 2 +- src/test/compile-fail/regions-ret-borrowed-1.rs | 2 +- src/test/compile-fail/regions-ret-borrowed.rs | 2 +- .../tag-that-dare-not-speak-its-name.rs | 2 +- src/test/compile-fail/tag-type-args.rs | 2 +- src/test/compile-fail/unconstrained-none.rs | 2 +- src/test/compile-fail/unique-pinned-nocopy.rs | 2 +- src/test/compile-fail/unique-vec-res.rs | 4 ++-- src/test/compile-fail/unsupported-cast.rs | 2 +- src/test/compile-fail/vec-field.rs | 2 +- src/test/compile-fail/vec-res-add.rs | 2 +- 135 files changed, 182 insertions(+), 201 deletions(-) delete mode 100644 src/test/compile-fail/debug-correct-span.rs delete mode 100644 src/test/compile-fail/die-not-static.rs diff --git a/src/test/compile-fail/assign-imm-local-twice.rs b/src/test/compile-fail/assign-imm-local-twice.rs index 7eeaa9435deff..f60b67cf8420f 100644 --- a/src/test/compile-fail/assign-imm-local-twice.rs +++ b/src/test/compile-fail/assign-imm-local-twice.rs @@ -11,9 +11,9 @@ fn test() { let v: int; v = 1; //~ NOTE prior assignment occurs here - info!("v=%d", v); + info2!("v={}", v); v = 2; //~ ERROR re-assignment of immutable variable - info!("v=%d", v); + info2!("v={}", v); } fn main() { diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/compile-fail/assign-to-method.rs index f300bd51b24ec..32f27f64f54d5 100644 --- a/src/test/compile-fail/assign-to-method.rs +++ b/src/test/compile-fail/assign-to-method.rs @@ -27,5 +27,5 @@ fn cat(in_x : uint, in_y : int) -> cat { fn main() { let nyan : cat = cat(52u, 99); - nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method + nyan.speak = || info2!("meow"); //~ ERROR attempted to take value of method } diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/compile-fail/autoderef-full-lval.rs index e1ad19e32bddc..ae911b5410790 100644 --- a/src/test/compile-fail/autoderef-full-lval.rs +++ b/src/test/compile-fail/autoderef-full-lval.rs @@ -21,11 +21,11 @@ fn main() { let a: clam = clam{x: @1, y: @2}; let b: clam = clam{x: @10, y: @20}; let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int` - info!(z); + info2!("{:?}", z); assert_eq!(z, 21); let forty: fish = fish{a: @40}; let two: fish = fish{a: @2}; let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int` - info!(answer); + info2!("{:?}", answer); assert_eq!(answer, 42); } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index 2ffb5dd29066f..a9e9ed64d9a37 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -12,7 +12,7 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: uint) -> ! { - if i < 0u { } else { fail!(); } + if i < 0u { } else { fail2!(); } //~^ ERROR expected `!` but found `()` } diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index 5045c87c2f3a8..095a85ab21e96 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -11,4 +11,4 @@ // error-pattern:expected `~str` but found `int` static i: ~str = 10i; -fn main() { info!(i); } +fn main() { info2!("{:?}", i); } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs index 3d1cca46085db..262248f9dc3b7 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs @@ -12,7 +12,7 @@ struct X { x: () } impl Drop for X { fn drop(&mut self) { - error!("destructor runs"); + error2!("destructor runs"); } } @@ -20,6 +20,6 @@ fn main() { let x = Some(X { x: () }); match x { Some(ref _y @ _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail!() + None => fail2!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs index a1803a621a53f..bf665e6fb60b2 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs @@ -12,7 +12,7 @@ struct X { x: (), } impl Drop for X { fn drop(&mut self) { - error!("destructor runs"); + error2!("destructor runs"); } } @@ -20,6 +20,6 @@ fn main() { let x = Some((X { x: () }, X { x: () })); match x { Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail!() + None => fail2!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs index 34a9c0b8fc26d..fcb9dbb300c82 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs @@ -12,7 +12,7 @@ struct X { x: (), } impl Drop for X { fn drop(&mut self) { - error!("destructor runs"); + error2!("destructor runs"); } } @@ -22,6 +22,6 @@ fn main() { let x = some2(X { x: () }, X { x: () }); match x { some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - none2 => fail!() + none2 => fail2!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs index 2aa3379993b7a..19076181c5122 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs @@ -12,7 +12,7 @@ struct X { x: (), } impl Drop for X { fn drop(&mut self) { - error!("destructor runs"); + error2!("destructor runs"); } } @@ -20,6 +20,6 @@ fn main() { let x = Some((X { x: () }, X { x: () })); match x { Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail!() + None => fail2!() } } diff --git a/src/test/compile-fail/bind-by-move-no-guards.rs b/src/test/compile-fail/bind-by-move-no-guards.rs index 348781d74977e..5c0274b03d09a 100644 --- a/src/test/compile-fail/bind-by-move-no-guards.rs +++ b/src/test/compile-fail/bind-by-move-no-guards.rs @@ -15,8 +15,8 @@ fn main() { let x = Some(p); c.send(false); match x { - Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard + Some(z) if z.recv() => { fail2!() }, //~ ERROR cannot bind by-move into a pattern guard Some(z) => { assert!(!z.recv()); }, - None => fail!() + None => fail2!() } } diff --git a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs index 7143ce0252b73..9b7cc41e5c875 100644 --- a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs +++ b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs @@ -12,7 +12,7 @@ struct X { x: (), } impl Drop for X { fn drop(&mut self) { - error!("destructor runs"); + error2!("destructor runs"); } } @@ -20,6 +20,6 @@ fn main() { let x = Some(X { x: () }); match x { Some(_y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings - None => fail!() + None => fail2!() } } diff --git a/src/test/compile-fail/block-arg-as-stmt-with-value.rs b/src/test/compile-fail/block-arg-as-stmt-with-value.rs index d2366c2b5bc5d..294c45093dd6f 100644 --- a/src/test/compile-fail/block-arg-as-stmt-with-value.rs +++ b/src/test/compile-fail/block-arg-as-stmt-with-value.rs @@ -17,6 +17,6 @@ fn compute1() -> float { fn main() { let x = compute1(); - info!(x); + info2!("{:?}", x); assert_eq!(x, -4f); } diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs index df9eb9fdda69b..379b71f741173 100644 --- a/src/test/compile-fail/block-coerce-no.rs +++ b/src/test/compile-fail/block-coerce-no.rs @@ -21,6 +21,6 @@ fn coerce(b: &fn()) -> extern fn() { fn main() { let i = 8; - let f = coerce(|| error!(i) ); + let f = coerce(|| error2!("{:?}", i) ); f(); } diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/compile-fail/bogus-tag.rs index 63d12b72cc635..c14989fcbbb6c 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/compile-fail/bogus-tag.rs @@ -17,7 +17,7 @@ enum color { rgb(int, int, int), rgba(int, int, int, int), } fn main() { let red: color = rgb(255, 0, 0); match red { - rgb(r, g, b) => { info!("rgb"); } - hsl(h, s, l) => { info!("hsl"); } + rgb(r, g, b) => { info2!("rgb"); } + hsl(h, s, l) => { info2!("hsl"); } } } diff --git a/src/test/compile-fail/borrowck-anon-fields-variant.rs b/src/test/compile-fail/borrowck-anon-fields-variant.rs index da0a9323d2c81..ce3aff59d7a63 100644 --- a/src/test/compile-fail/borrowck-anon-fields-variant.rs +++ b/src/test/compile-fail/borrowck-anon-fields-variant.rs @@ -10,12 +10,12 @@ fn distinct_variant() { let a = match y { Y(ref mut a, _) => a, - X => fail!() + X => fail2!() }; let b = match y { Y(_, ref mut b) => b, - X => fail!() + X => fail2!() }; *a += 1; @@ -27,12 +27,12 @@ fn same_variant() { let a = match y { Y(ref mut a, _) => a, - X => fail!() + X => fail2!() }; let b = match y { Y(ref mut b, _) => b, //~ ERROR cannot borrow - X => fail!() + X => fail2!() }; *a += 1; diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs index 0256c88b01d5d..8c4d681d9835d 100644 --- a/src/test/compile-fail/borrowck-assign-comp-idx.rs +++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs @@ -21,7 +21,7 @@ fn a() { p[0] = 5; //~ ERROR cannot assign - info!("%d", *q); + info2!("{}", *q); } fn borrow(_x: &[int], _f: &fn()) {} diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index 4bbd1b0decf57..487a16c1836d1 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -24,7 +24,7 @@ fn main() { x = X(Left((0,0))); //~ ERROR cannot assign to `x` (*f)() }, - _ => fail!() + _ => fail2!() } } } diff --git a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs index 1051c5829ec38..c7cb9ce27f2bb 100644 --- a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs +++ b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs @@ -18,7 +18,7 @@ struct Bar { int2: int, } -fn make_foo() -> ~Foo { fail!() } +fn make_foo() -> ~Foo { fail2!() } fn borrow_same_field_twice_mut_mut() { let mut foo = make_foo(); diff --git a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs index cdcf50c906e36..d01fd86f2886a 100644 --- a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs +++ b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs @@ -18,7 +18,7 @@ struct Bar { int2: int, } -fn make_foo() -> Foo { fail!() } +fn make_foo() -> Foo { fail2!() } fn borrow_same_field_twice_mut_mut() { let mut foo = make_foo(); diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs index 1c725a0dd0e03..918e06fad07d4 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs @@ -16,7 +16,7 @@ struct defer<'self> { impl<'self> Drop for defer<'self> { fn drop(&mut self) { unsafe { - error!("%?", self.x); + error2!("{:?}", self.x); } } } diff --git a/src/test/compile-fail/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck-lend-flow-if.rs index 563f63b98be05..1058211a6e455 100644 --- a/src/test/compile-fail/borrowck-lend-flow-if.rs +++ b/src/test/compile-fail/borrowck-lend-flow-if.rs @@ -16,9 +16,9 @@ fn borrow(_v: &int) {} fn borrow_mut(_v: &mut int) {} -fn cond() -> bool { fail!() } -fn for_func(_f: &fn() -> bool) { fail!() } -fn produce() -> T { fail!(); } +fn cond() -> bool { fail2!() } +fn for_func(_f: &fn() -> bool) { fail2!() } +fn produce() -> T { fail2!(); } fn inc(v: &mut ~int) { *v = ~(**v + 1); diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index 869ef0591e4be..fff8a25847972 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -16,8 +16,8 @@ fn borrow(_v: &int) {} fn borrow_mut(_v: &mut int) {} -fn cond() -> bool { fail!() } -fn produce() -> T { fail!(); } +fn cond() -> bool { fail2!() } +fn produce() -> T { fail2!(); } fn inc(v: &mut ~int) { *v = ~(**v + 1); diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs index d5c5597e57fce..b6a30da46f830 100644 --- a/src/test/compile-fail/borrowck-lend-flow-match.rs +++ b/src/test/compile-fail/borrowck-lend-flow-match.rs @@ -13,7 +13,7 @@ #[allow(unused_variable)]; #[allow(dead_assignment)]; -fn cond() -> bool { fail!() } +fn cond() -> bool { fail2!() } fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true } fn separate_arms() { diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs index ea840a28b4e6a..c51d6117e5ca1 100644 --- a/src/test/compile-fail/borrowck-lend-flow.rs +++ b/src/test/compile-fail/borrowck-lend-flow.rs @@ -16,9 +16,9 @@ fn borrow(_v: &int) {} fn borrow_mut(_v: &mut int) {} -fn cond() -> bool { fail!() } -fn for_func(_f: &fn() -> bool) { fail!() } -fn produce() -> T { fail!(); } +fn cond() -> bool { fail2!() } +fn for_func(_f: &fn() -> bool) { fail2!() } +fn produce() -> T { fail2!(); } fn inc(v: &mut ~int) { *v = ~(**v + 1); diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index 87ab36348c6a6..32dfa59927f51 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -18,14 +18,14 @@ fn box_imm() { let v = ~3; let _w = &v; do task::spawn { - info!("v=%d", *v); + info2!("v={}", *v); //~^ ERROR cannot move `v` into closure } let v = ~3; let _w = &v; task::spawn(|| { - info!("v=%d", *v); + info2!("v={}", *v); //~^ ERROR cannot move }); } diff --git a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs index 01ca3cd1c282f..db9d8d7ceafba 100644 --- a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs @@ -16,7 +16,7 @@ use std::either::{Either, Left, Right}; *x = Right(1.0); *z } - _ => fail!() + _ => fail2!() } } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index ef37f9b1bb207..145aaa405a6e8 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -23,7 +23,7 @@ pub fn main() { } } let z = tail[0].clone(); - info!(fmt!("%?", z)); + info2!("{:?}", z); } _ => { unreachable!(); diff --git a/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs b/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs index f69036ff9d913..56e047e5bc522 100644 --- a/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs +++ b/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs @@ -12,5 +12,5 @@ fn main() { let x: int = 3; let y: &mut int = &mut x; //~ ERROR cannot borrow *y = 5; - info!(*y); + info2!("{:?}", *y); } diff --git a/src/test/compile-fail/borrowck-ref-into-rvalue.rs b/src/test/compile-fail/borrowck-ref-into-rvalue.rs index cb56e929754da..bd0b4afe730c9 100644 --- a/src/test/compile-fail/borrowck-ref-into-rvalue.rs +++ b/src/test/compile-fail/borrowck-ref-into-rvalue.rs @@ -14,7 +14,7 @@ fn main() { Some(ref m) => { //~ ERROR borrowed value does not live long enough msg = m; }, - None => { fail!() } + None => { fail2!() } } println(*msg); } diff --git a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs index ca20d68e4cdcb..53e69fc1611aa 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs @@ -2,7 +2,7 @@ fn a() -> &[int] { let vec = ~[1, 2, 3, 4]; let tail = match vec { [_, ..tail] => tail, //~ ERROR does not live long enough - _ => fail!("a") + _ => fail2!("a") }; tail } @@ -11,7 +11,7 @@ fn b() -> &[int] { let vec = ~[1, 2, 3, 4]; let init = match vec { [..init, _] => init, //~ ERROR does not live long enough - _ => fail!("b") + _ => fail2!("b") }; init } @@ -20,7 +20,7 @@ fn c() -> &[int] { let vec = ~[1, 2, 3, 4]; let slice = match vec { [_, ..slice, _] => slice, //~ ERROR does not live long enough - _ => fail!("c") + _ => fail2!("c") }; slice } diff --git a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs index 02ba1b9d2fffb..b31e49bceb505 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs @@ -4,7 +4,7 @@ fn a() { [~ref _a] => { vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed } - _ => fail!("foo") + _ => fail2!("foo") } } diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs index e542238d03566..e0c2d08e41339 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs @@ -2,7 +2,7 @@ fn a() -> &int { let vec = ~[1, 2, 3, 4]; let tail = match vec { [_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough - _ => fail!("foo") + _ => fail2!("foo") }; tail } diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/compile-fail/class-cast-to-trait.rs index 0d1582bf85713..6f483b82d8183 100644 --- a/src/test/compile-fail/class-cast-to-trait.rs +++ b/src/test/compile-fail/class-cast-to-trait.rs @@ -22,12 +22,12 @@ struct cat { impl cat { pub fn eat(&self) -> bool { if self.how_hungry > 0 { - error!("OM NOM NOM"); + error2!("OM NOM NOM"); self.how_hungry -= 2; return true; } else { - error!("Not hungry!"); + error2!("Not hungry!"); return false; } } @@ -40,7 +40,7 @@ impl noisy for cat { impl cat { fn meow(&self) { - error!("Meow"); + error2!("Meow"); self.meows += 1; if self.meows % 5 == 0 { self.how_hungry += 1; diff --git a/src/test/compile-fail/class-missing-self.rs b/src/test/compile-fail/class-missing-self.rs index c27c27b5942e1..101f96ce0b47c 100644 --- a/src/test/compile-fail/class-missing-self.rs +++ b/src/test/compile-fail/class-missing-self.rs @@ -15,7 +15,7 @@ struct cat { impl cat { fn sleep(&self) { loop{} } fn meow(&self) { - error!("Meow"); + error2!("Meow"); meows += 1u; //~ ERROR unresolved name sleep(); //~ ERROR unresolved name } diff --git a/src/test/compile-fail/closure-that-fails.rs b/src/test/compile-fail/closure-that-fails.rs index aad0e8bcbb6dd..6663cff9b5632 100644 --- a/src/test/compile-fail/closure-that-fails.rs +++ b/src/test/compile-fail/closure-that-fails.rs @@ -2,6 +2,6 @@ fn foo(f: &fn() -> !) {} fn main() { // Type inference didn't use to be able to handle this: - foo(|| fail!()); + foo(|| fail2!()); foo(|| 22); //~ ERROR mismatched types } diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/compile-fail/copy-a-resource.rs index c5f5861de825d..771f2b2dfb680 100644 --- a/src/test/compile-fail/copy-a-resource.rs +++ b/src/test/compile-fail/copy-a-resource.rs @@ -26,5 +26,5 @@ fn main() { let x = foo(10); let _y = x.clone(); //~^ ERROR does not implement any method in scope - error!(x); + error2!("{:?}", x); } diff --git a/src/test/compile-fail/debug-correct-span.rs b/src/test/compile-fail/debug-correct-span.rs deleted file mode 100644 index f143e6c00a2ed..0000000000000 --- a/src/test/compile-fail/debug-correct-span.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - debug!("%s %s", 3); //~ ERROR: not enough arguments -} diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/compile-fail/deref-non-pointer.rs index 7b1b0f6243ac4..86c56f7ae8190 100644 --- a/src/test/compile-fail/deref-non-pointer.rs +++ b/src/test/compile-fail/deref-non-pointer.rs @@ -10,6 +10,6 @@ fn main() { match *1 { //~ ERROR: cannot be dereferenced - _ => { fail!(); } + _ => { fail2!(); } } } diff --git a/src/test/compile-fail/die-not-static.rs b/src/test/compile-fail/die-not-static.rs deleted file mode 100644 index 40a4232717db2..0000000000000 --- a/src/test/compile-fail/die-not-static.rs +++ /dev/null @@ -1,8 +0,0 @@ -use std::str; - -fn main() { - let v = ~"test"; - let sslice = v.slice(0, v.len()); - //~^ ERROR borrowed value does not live long enough - fail!(sslice); -} diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs index 2a4d46941b977..aac6cd118b204 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs @@ -14,7 +14,7 @@ struct X { impl Drop for X { fn drop(&mut self) { - error!("value: %s", self.x); + error2!("value: {}", self.x); } } @@ -26,5 +26,5 @@ fn unwrap(x: X) -> ~str { fn main() { let x = X { x: ~"hello" }; let y = unwrap(x); - error!("contents: %s", y); + error2!("contents: {}", y); } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs index ecb02c4307d3e..e14900c4bb44c 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs @@ -14,7 +14,7 @@ struct X { impl Drop for X { fn drop(&mut self) { - error!("value: %s", self.x); + error2!("value: {}", self.x); } } @@ -22,7 +22,7 @@ fn main() { let x = X { x: ~"hello" }; match x { - X { x: y } => error!("contents: %s", y) + X { x: y } => error2!("contents: {}", y) //~^ ERROR cannot move out of type `X`, which defines the `Drop` trait } } diff --git a/src/test/compile-fail/does-nothing.rs b/src/test/compile-fail/does-nothing.rs index 9d2b68ddb81ef..dc32e8e10226c 100644 --- a/src/test/compile-fail/does-nothing.rs +++ b/src/test/compile-fail/does-nothing.rs @@ -1,2 +1,2 @@ // error-pattern: unresolved name `this_does_nothing_what_the`. -fn main() { info!("doing"); this_does_nothing_what_the; info!("boing"); } +fn main() { info2!("doing"); this_does_nothing_what_the; info2!("boing"); } diff --git a/src/test/compile-fail/export2.rs b/src/test/compile-fail/export2.rs index 22762eb4a7eb5..3fdd4000b1b9a 100644 --- a/src/test/compile-fail/export2.rs +++ b/src/test/compile-fail/export2.rs @@ -15,7 +15,7 @@ mod foo { } mod bar { - fn x() { info!("x"); } + fn x() { info2!("x"); } pub fn y() { } } diff --git a/src/test/compile-fail/extfmt-missing-type.rs b/src/test/compile-fail/extfmt-missing-type.rs index 012d761c0e6b1..7602656eabb07 100644 --- a/src/test/compile-fail/extfmt-missing-type.rs +++ b/src/test/compile-fail/extfmt-missing-type.rs @@ -10,4 +10,4 @@ // error-pattern:missing type -fn main() { fmt!("%+"); } +fn main() { oldfmt!("%+"); } diff --git a/src/test/compile-fail/extfmt-no-args.rs b/src/test/compile-fail/extfmt-no-args.rs index cd9308e7b3f25..2721c780ac6cf 100644 --- a/src/test/compile-fail/extfmt-no-args.rs +++ b/src/test/compile-fail/extfmt-no-args.rs @@ -10,4 +10,4 @@ // error-pattern:fmt! takes at least 1 argument -fn main() { fmt!(); } +fn main() { oldfmt!(); } diff --git a/src/test/compile-fail/extfmt-non-literal.rs b/src/test/compile-fail/extfmt-non-literal.rs index 12e9c641d541f..7aa744a11caac 100644 --- a/src/test/compile-fail/extfmt-non-literal.rs +++ b/src/test/compile-fail/extfmt-non-literal.rs @@ -14,5 +14,5 @@ fn main() { // fmt!'s first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = fmt!("a" + "b"); + let x = oldfmt!("a" + "b"); } diff --git a/src/test/compile-fail/extfmt-non-literal2.rs b/src/test/compile-fail/extfmt-non-literal2.rs index a38565844d0cc..e25eae821275f 100644 --- a/src/test/compile-fail/extfmt-non-literal2.rs +++ b/src/test/compile-fail/extfmt-non-literal2.rs @@ -14,5 +14,5 @@ fn main() { // fmt!'s first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = fmt!(20); + let x = oldfmt!(20); } diff --git a/src/test/compile-fail/extfmt-not-enough-args.rs b/src/test/compile-fail/extfmt-not-enough-args.rs index f18ae748ee07f..5fd17fe92c145 100644 --- a/src/test/compile-fail/extfmt-not-enough-args.rs +++ b/src/test/compile-fail/extfmt-not-enough-args.rs @@ -12,4 +12,4 @@ extern mod extra; -fn main() { let s = fmt!("%s%s%s", "test", "test"); } +fn main() { let s = oldfmt!("%s%s%s", "test", "test"); } diff --git a/src/test/compile-fail/extfmt-too-many-args.rs b/src/test/compile-fail/extfmt-too-many-args.rs index 2a72dcf89889e..5e12543ce8f0e 100644 --- a/src/test/compile-fail/extfmt-too-many-args.rs +++ b/src/test/compile-fail/extfmt-too-many-args.rs @@ -12,4 +12,4 @@ extern mod extra; -fn main() { let s = fmt!("%s", "test", "test"); } +fn main() { let s = oldfmt!("%s", "test", "test"); } diff --git a/src/test/compile-fail/extfmt-unknown-type.rs b/src/test/compile-fail/extfmt-unknown-type.rs index 80950232b9535..94ded1c528fdb 100644 --- a/src/test/compile-fail/extfmt-unknown-type.rs +++ b/src/test/compile-fail/extfmt-unknown-type.rs @@ -10,4 +10,4 @@ // error-pattern:unknown type -fn main() { fmt!("%w"); } +fn main() { oldfmt!("%w"); } diff --git a/src/test/compile-fail/extfmt-unsigned-plus.rs b/src/test/compile-fail/extfmt-unsigned-plus.rs index 652f5b74f809e..4e165153c0bdc 100644 --- a/src/test/compile-fail/extfmt-unsigned-plus.rs +++ b/src/test/compile-fail/extfmt-unsigned-plus.rs @@ -12,5 +12,5 @@ fn main() { // Can't use a sign on unsigned conversions - fmt!("%+u", 10u); + oldfmt!("%+u", 10u); } diff --git a/src/test/compile-fail/extfmt-unsigned-space.rs b/src/test/compile-fail/extfmt-unsigned-space.rs index afd6cbbe1f1f7..8396ecc25c16e 100644 --- a/src/test/compile-fail/extfmt-unsigned-space.rs +++ b/src/test/compile-fail/extfmt-unsigned-space.rs @@ -12,5 +12,5 @@ fn main() { // Can't use a space on unsigned conversions - fmt!("% u", 10u); + oldfmt!("% u", 10u); } diff --git a/src/test/compile-fail/extfmt-unterminated-conv.rs b/src/test/compile-fail/extfmt-unterminated-conv.rs index 158a38ed1b55e..373a10e99cfd0 100644 --- a/src/test/compile-fail/extfmt-unterminated-conv.rs +++ b/src/test/compile-fail/extfmt-unterminated-conv.rs @@ -10,4 +10,4 @@ // error-pattern:unterminated conversion -fn main() { fmt!("%"); } +fn main() { oldfmt!("%"); } diff --git a/src/test/compile-fail/fail-expr.rs b/src/test/compile-fail/fail-expr.rs index 98270bdc58383..4dce462bd416d 100644 --- a/src/test/compile-fail/fail-expr.rs +++ b/src/test/compile-fail/fail-expr.rs @@ -10,4 +10,4 @@ // error-pattern:failed to find an implementation of trait std::sys::FailWithCause for int -fn main() { fail!(5); } +fn main() { fail2!(5); } diff --git a/src/test/compile-fail/fail-simple.rs b/src/test/compile-fail/fail-simple.rs index 7def16770a790..bcede4483c744 100644 --- a/src/test/compile-fail/fail-simple.rs +++ b/src/test/compile-fail/fail-simple.rs @@ -12,5 +12,5 @@ // error-pattern:unexpected token fn main() { - fail!(@); + fail2!(@); } diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs index b6755249bcf98..341f60eeedf8d 100644 --- a/src/test/compile-fail/fail-type-err.rs +++ b/src/test/compile-fail/fail-type-err.rs @@ -9,4 +9,4 @@ // except according to those terms. // error-pattern:failed to find an implementation of trait std::sys::FailWithCause for ~[int] -fn main() { fail!(~[0i]); } +fn main() { fail2!(~[0i]); } diff --git a/src/test/compile-fail/functional-struct-update-noncopyable.rs b/src/test/compile-fail/functional-struct-update-noncopyable.rs index 7fccdba172353..284787a817264 100644 --- a/src/test/compile-fail/functional-struct-update-noncopyable.rs +++ b/src/test/compile-fail/functional-struct-update-noncopyable.rs @@ -17,7 +17,7 @@ use extra::arc::*; struct A { y: Arc, x: Arc } impl Drop for A { - fn drop(&mut self) { println(fmt!("x=%?", self.x.get())); } + fn drop(&mut self) { println(format!("x={:?}", self.x.get())); } } fn main() { let a = A { y: Arc::new(1), x: Arc::new(2) }; diff --git a/src/test/compile-fail/if-without-else-result.rs b/src/test/compile-fail/if-without-else-result.rs index 8e3318f6945ac..c5fb22c682106 100644 --- a/src/test/compile-fail/if-without-else-result.rs +++ b/src/test/compile-fail/if-without-else-result.rs @@ -12,5 +12,5 @@ fn main() { let a = if true { true }; - info!(a); + info2!("{:?}", a); } diff --git a/src/test/compile-fail/import-glob-0.rs b/src/test/compile-fail/import-glob-0.rs index 805aace081d02..0e920d137a85c 100644 --- a/src/test/compile-fail/import-glob-0.rs +++ b/src/test/compile-fail/import-glob-0.rs @@ -13,10 +13,10 @@ use module_of_many_things::*; mod module_of_many_things { - pub fn f1() { info!("f1"); } - pub fn f2() { info!("f2"); } - fn f3() { info!("f3"); } - pub fn f4() { info!("f4"); } + pub fn f1() { info2!("f1"); } + pub fn f2() { info2!("f2"); } + fn f3() { info2!("f3"); } + pub fn f4() { info2!("f4"); } } diff --git a/src/test/compile-fail/import-glob-circular.rs b/src/test/compile-fail/import-glob-circular.rs index 49ee1ad55c0ca..334ddbeceee62 100644 --- a/src/test/compile-fail/import-glob-circular.rs +++ b/src/test/compile-fail/import-glob-circular.rs @@ -12,13 +12,13 @@ mod circ1 { pub use circ2::f2; - pub fn f1() { info!("f1"); } + pub fn f1() { info2!("f1"); } pub fn common() -> uint { return 0u; } } mod circ2 { pub use circ1::f1; - pub fn f2() { info!("f2"); } + pub fn f2() { info2!("f2"); } pub fn common() -> uint { return 1u; } } diff --git a/src/test/compile-fail/import.rs b/src/test/compile-fail/import.rs index 5177dc4e47570..129a4aece8f5e 100644 --- a/src/test/compile-fail/import.rs +++ b/src/test/compile-fail/import.rs @@ -12,6 +12,6 @@ use zed::bar; use zed::baz; mod zed { - pub fn bar() { info!("bar"); } + pub fn bar() { info2!("bar"); } } fn main(args: ~[str]) { bar(); } diff --git a/src/test/compile-fail/import2.rs b/src/test/compile-fail/import2.rs index e67a79130b1f9..8cebbdbc176fb 100644 --- a/src/test/compile-fail/import2.rs +++ b/src/test/compile-fail/import2.rs @@ -13,6 +13,6 @@ use baz::zed::bar; //~ ERROR unresolved import mod baz {} mod zed { - pub fn bar() { info!("bar3"); } + pub fn bar() { info2!("bar3"); } } fn main(args: ~[str]) { bar(); } diff --git a/src/test/compile-fail/import3.rs b/src/test/compile-fail/import3.rs index 7a7f4f20aea07..f05a90acc9dd3 100644 --- a/src/test/compile-fail/import3.rs +++ b/src/test/compile-fail/import3.rs @@ -11,4 +11,4 @@ // error-pattern: unresolved use main::bar; -fn main(args: ~[str]) { info!("foo"); } +fn main(args: ~[str]) { info2!("foo"); } diff --git a/src/test/compile-fail/import4.rs b/src/test/compile-fail/import4.rs index 087842d78c709..bcc93407ec15a 100644 --- a/src/test/compile-fail/import4.rs +++ b/src/test/compile-fail/import4.rs @@ -13,4 +13,4 @@ mod a { pub use b::foo; } mod b { pub use a::foo; } -fn main(args: ~[str]) { info!("loop"); } +fn main(args: ~[str]) { info2!("loop"); } diff --git a/src/test/compile-fail/issue-1448-2.rs b/src/test/compile-fail/issue-1448-2.rs index ba0a2cbab5022..bf419db39541f 100644 --- a/src/test/compile-fail/issue-1448-2.rs +++ b/src/test/compile-fail/issue-1448-2.rs @@ -10,6 +10,8 @@ // Regression test for issue #1448 and #1386 +fn foo(a: uint) -> uint { a } + fn main() { - info!("%u", 10i); //~ ERROR mismatched types + info2!("{:u}", foo(10i)); //~ ERROR mismatched types } diff --git a/src/test/compile-fail/issue-1476.rs b/src/test/compile-fail/issue-1476.rs index f223cd428ec13..5e1a69227e57d 100644 --- a/src/test/compile-fail/issue-1476.rs +++ b/src/test/compile-fail/issue-1476.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - error!(x); //~ ERROR unresolved name `x`. + error2!("{:?}", x); //~ ERROR unresolved name `x`. } diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index dcb85d8670632..3f393621fd908 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -14,7 +14,7 @@ trait vec_monad { impl vec_monad for ~[A] { fn bind(&self, f: &fn(A) -> ~[B]) { - let mut r = fail!(); + let mut r = fail2!(); for elt in self.iter() { r = r + f(*elt); } //~^ WARNING unreachable expression //~^^ ERROR the type of this value must be known diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index 64344ab427793..1c4df25f353bf 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -13,7 +13,7 @@ fn fail_len(v: ~[int]) -> uint { let mut i = 3; - fail!(); + fail2!(); for x in v.iter() { i += 1u; } //~^ ERROR: unreachable statement return i; diff --git a/src/test/compile-fail/issue-2151.rs b/src/test/compile-fail/issue-2151.rs index 5559ba344ed17..db02bb5e55b60 100644 --- a/src/test/compile-fail/issue-2151.rs +++ b/src/test/compile-fail/issue-2151.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let x = fail!(); + let x = fail2!(); x.clone(); //~ ERROR the type of this value must be known in this context } diff --git a/src/test/compile-fail/issue-2281-part1.rs b/src/test/compile-fail/issue-2281-part1.rs index 0d94e378a4ca8..b9b26e12b40fe 100644 --- a/src/test/compile-fail/issue-2281-part1.rs +++ b/src/test/compile-fail/issue-2281-part1.rs @@ -10,4 +10,4 @@ // error-pattern: unresolved name `foobar`. -fn main(args: ~[str]) { info!(foobar); } +fn main(args: ~[str]) { info2!("{:?}", foobar); } diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index 6152e82294d1b..c8f835ccdc9aa 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -16,7 +16,7 @@ trait channel { // `chan` is not a trait, it's an enum impl chan for int { //~ ERROR chan is not a trait - fn send(&self, v: int) { fail!() } + fn send(&self, v: int) { fail2!() } } fn main() { diff --git a/src/test/compile-fail/issue-2370-2.rs b/src/test/compile-fail/issue-2370-2.rs index 540089bd59dc3..247ef3d751f48 100644 --- a/src/test/compile-fail/issue-2370-2.rs +++ b/src/test/compile-fail/issue-2370-2.rs @@ -15,5 +15,5 @@ struct cat { fn main() { let kitty : cat = cat { x: () }; - error!(*kitty); + error2!("{:?}", *kitty); } diff --git a/src/test/compile-fail/issue-2370.rs b/src/test/compile-fail/issue-2370.rs index cd17cc2afaa0d..5754b4bb472e0 100644 --- a/src/test/compile-fail/issue-2370.rs +++ b/src/test/compile-fail/issue-2370.rs @@ -15,5 +15,5 @@ struct cat { fn main() { let nyan = cat { foo: () }; - error!(*nyan); + error2!("{:?}", *nyan); } diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index c62c28745253d..77f07a9d793e2 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -20,7 +20,7 @@ struct E { } impl A for E { - fn b(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Freeze` + fn b(_x: F) -> F { fail2!() } //~ ERROR type parameter 0 requires `Freeze` } fn main() {} diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs index 9b8346da5c5d9..7dc6dd6a85208 100644 --- a/src/test/compile-fail/issue-2611-5.rs +++ b/src/test/compile-fail/issue-2611-5.rs @@ -21,7 +21,7 @@ struct E { impl A for E { // n.b. The error message is awful -- see #3404 - fn b(&self, _x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type + fn b(&self, _x: G) -> G { fail2!() } //~ ERROR method `b` has an incompatible type } fn main() {} diff --git a/src/test/compile-fail/issue-2823.rs b/src/test/compile-fail/issue-2823.rs index 58b216e8d119b..49bc3b9ba6c3f 100644 --- a/src/test/compile-fail/issue-2823.rs +++ b/src/test/compile-fail/issue-2823.rs @@ -14,7 +14,7 @@ struct C { impl Drop for C { fn drop(&mut self) { - error!("dropping: %?", self.x); + error2!("dropping: {:?}", self.x); } } diff --git a/src/test/compile-fail/issue-3021.rs b/src/test/compile-fail/issue-3021.rs index 56ade814db020..f8e355360d709 100644 --- a/src/test/compile-fail/issue-3021.rs +++ b/src/test/compile-fail/issue-3021.rs @@ -25,7 +25,7 @@ fn siphash(k0 : u64) -> SipHash { //~^ ERROR unresolved name `k0`. } } - fail!(); + fail2!(); } fn main() {} diff --git a/src/test/compile-fail/issue-3038.rs b/src/test/compile-fail/issue-3038.rs index e16b9f933f79d..3ab44b6674806 100644 --- a/src/test/compile-fail/issue-3038.rs +++ b/src/test/compile-fail/issue-3038.rs @@ -19,13 +19,13 @@ fn main() { let _z = match g(1, 2) { - g(x, x) => { info!(x + x); } + g(x, x) => { info2!("{:?}", x + x); } //~^ ERROR Identifier `x` is bound more than once in the same pattern }; let _z = match i(l(1, 2), m(3, 4)) { i(l(x, _), m(_, x)) //~ ERROR Identifier `x` is bound more than once in the same pattern - => { error!(x + x); } + => { error2!("{:?}", x + x); } }; let _z = match (1, 2) { diff --git a/src/test/compile-fail/issue-3099.rs b/src/test/compile-fail/issue-3099.rs index abc76b9da0fd7..d65001f2b0410 100644 --- a/src/test/compile-fail/issue-3099.rs +++ b/src/test/compile-fail/issue-3099.rs @@ -9,13 +9,13 @@ // except according to those terms. fn a(x: ~str) -> ~str { - fmt!("First function with %s", x) + format!("First function with {}", x) } fn a(x: ~str, y: ~str) -> ~str { //~ ERROR duplicate definition of value `a` - fmt!("Second function with %s and %s", x, y) + format!("Second function with {} and {}", x, y) } fn main() { - info!("Result: "); + info2!("Result: "); } diff --git a/src/test/compile-fail/issue-3521-2.rs b/src/test/compile-fail/issue-3521-2.rs index 431f98d8181a0..7c56064c2990a 100644 --- a/src/test/compile-fail/issue-3521-2.rs +++ b/src/test/compile-fail/issue-3521-2.rs @@ -13,5 +13,5 @@ fn main() { static y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant - error!(y); + error2!("{}", y); } diff --git a/src/test/compile-fail/issue-3521.rs b/src/test/compile-fail/issue-3521.rs index d070a9735e48b..aa82ade449d1f 100644 --- a/src/test/compile-fail/issue-3521.rs +++ b/src/test/compile-fail/issue-3521.rs @@ -15,5 +15,5 @@ fn main() { Bar = foo //~ ERROR attempt to use a non-constant value in a constant } - error!(Bar); + error2!("{:?}", Bar); } diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs index c37c5a3e5afa5..4718c5b88a671 100644 --- a/src/test/compile-fail/issue-3601.rs +++ b/src/test/compile-fail/issue-3601.rs @@ -37,6 +37,6 @@ fn main() { ~Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns ~HTMLImageElement(ref d) if d.image.is_some() => { true } }, - _ => fail!("WAT") //~ ERROR unreachable pattern + _ => fail2!("WAT") //~ ERROR unreachable pattern }; } diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs index 77e2e4f21e8a1..b6bfe79800f67 100644 --- a/src/test/compile-fail/issue-3668.rs +++ b/src/test/compile-fail/issue-3668.rs @@ -16,7 +16,7 @@ trait PTrait { impl PTrait for P { fn getChildOption(&self) -> Option<@P> { static childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant - fail!(); + fail2!(); } } diff --git a/src/test/compile-fail/issue-5062.rs b/src/test/compile-fail/issue-5062.rs index 26fb69f2cd0f8..8ff81df938d4e 100644 --- a/src/test/compile-fail/issue-5062.rs +++ b/src/test/compile-fail/issue-5062.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { fmt!("%?", None); } //~ ERROR unconstrained type +fn main() { format!("{:?}", None); } //~ ERROR unconstrained type diff --git a/src/test/compile-fail/issue-5439.rs b/src/test/compile-fail/issue-5439.rs index 8bd9bb326316e..03fe86cb87977 100644 --- a/src/test/compile-fail/issue-5439.rs +++ b/src/test/compile-fail/issue-5439.rs @@ -25,5 +25,5 @@ impl Bar { fn main () { let bar = Bar { bar: 1 }; let foo = bar.make_foo(2); - println(fmt!("%d", foo.foo)); + println!("{}", foo.foo); } diff --git a/src/test/compile-fail/issue-6458-1.rs b/src/test/compile-fail/issue-6458-1.rs index a54f05ec34807..77ff58e7427bb 100644 --- a/src/test/compile-fail/issue-6458-1.rs +++ b/src/test/compile-fail/issue-6458-1.rs @@ -9,4 +9,4 @@ // except according to those terms. fn foo(t: T) {} -fn main() { foo(fail!()) } //~ ERROR cannot determine a type for this expression: unconstrained type +fn main() { foo(fail2!()) } //~ ERROR cannot determine a type for this expression: unconstrained type diff --git a/src/test/compile-fail/issue-6458-2.rs b/src/test/compile-fail/issue-6458-2.rs index 8621b37146ff3..f395b7fdd76af 100644 --- a/src/test/compile-fail/issue-6458-2.rs +++ b/src/test/compile-fail/issue-6458-2.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - fmt!("%?", None); //~ ERROR: cannot determine a type for this expression: unconstrained type + format!("{:?}", None); //~ ERROR: cannot determine a type for this bounded } diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs index 6f0c2f1de1ab4..9deb7d6fba42b 100644 --- a/src/test/compile-fail/lint-unused-unsafe.rs +++ b/src/test/compile-fail/lint-unused-unsafe.rs @@ -19,7 +19,7 @@ mod foo { } } -fn callback(_f: &fn() -> T) -> T { fail!() } +fn callback(_f: &fn() -> T) -> T { fail2!() } unsafe fn unsf() {} fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block @@ -49,7 +49,7 @@ fn good2() { sure that when purity is inherited that the source of the unsafe-ness is tracked correctly */ unsafe { - unsafe fn what() -> ~[~str] { fail!() } + unsafe fn what() -> ~[~str] { fail2!() } do callback { what(); diff --git a/src/test/compile-fail/liveness-and-init.rs b/src/test/compile-fail/liveness-and-init.rs index 64618bb2f7a53..71d063130bf76 100644 --- a/src/test/compile-fail/liveness-and-init.rs +++ b/src/test/compile-fail/liveness-and-init.rs @@ -11,6 +11,6 @@ fn main() { let i: int; - info!(false && { i = 5; true }); - info!(i); //~ ERROR use of possibly uninitialized variable: `i` + info2!("{}", false && { i = 5; true }); + info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` } diff --git a/src/test/compile-fail/liveness-bad-bang-2.rs b/src/test/compile-fail/liveness-bad-bang-2.rs index e9ab87f09e26d..87cd83d8aeaf6 100644 --- a/src/test/compile-fail/liveness-bad-bang-2.rs +++ b/src/test/compile-fail/liveness-bad-bang-2.rs @@ -12,6 +12,6 @@ // Tests that a function with a ! annotation always actually fails // error-pattern: some control paths may return -fn bad_bang(i: uint) -> ! { info!(3); } +fn bad_bang(i: uint) -> ! { info2!("{}", 3); } fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/liveness-block-unint.rs b/src/test/compile-fail/liveness-block-unint.rs index 159c945f3c219..9438aa0e52e8a 100644 --- a/src/test/compile-fail/liveness-block-unint.rs +++ b/src/test/compile-fail/liveness-block-unint.rs @@ -12,6 +12,6 @@ fn force(f: &fn()) { f(); } fn main() { let x: int; force(|| { - info!(x); //~ ERROR capture of possibly uninitialized variable: `x` + info2!("{}", x); //~ ERROR capture of possibly uninitialized variable: `x` }); } diff --git a/src/test/compile-fail/liveness-break-uninit-2.rs b/src/test/compile-fail/liveness-break-uninit-2.rs index 2c3004056eae0..37a91338d8d2e 100644 --- a/src/test/compile-fail/liveness-break-uninit-2.rs +++ b/src/test/compile-fail/liveness-break-uninit-2.rs @@ -16,9 +16,9 @@ fn foo() -> int { x = 0; } - info!(x); //~ ERROR use of possibly uninitialized variable: `x` + info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` return 17; } -fn main() { info!(foo()); } +fn main() { info2!("{}", foo()); } diff --git a/src/test/compile-fail/liveness-break-uninit.rs b/src/test/compile-fail/liveness-break-uninit.rs index 9e8a1e8a4d350..5aae93df0dcd5 100644 --- a/src/test/compile-fail/liveness-break-uninit.rs +++ b/src/test/compile-fail/liveness-break-uninit.rs @@ -16,9 +16,9 @@ fn foo() -> int { x = 0; } - info!(x); //~ ERROR use of possibly uninitialized variable: `x` + info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` return 17; } -fn main() { info!(foo()); } +fn main() { info2!("{}", foo()); } diff --git a/src/test/compile-fail/liveness-closure-require-ret.rs b/src/test/compile-fail/liveness-closure-require-ret.rs index f624bfe800f5f..69aa47bd567ae 100644 --- a/src/test/compile-fail/liveness-closure-require-ret.rs +++ b/src/test/compile-fail/liveness-closure-require-ret.rs @@ -9,4 +9,4 @@ // except according to those terms. fn force(f: &fn() -> int) -> int { f() } -fn main() { info!(force(|| {})); } //~ ERROR mismatched types +fn main() { info2!("{:?}", force(|| {})); } //~ ERROR mismatched types diff --git a/src/test/compile-fail/liveness-if-no-else.rs b/src/test/compile-fail/liveness-if-no-else.rs index e9f831219e0c7..a0436d984167b 100644 --- a/src/test/compile-fail/liveness-if-no-else.rs +++ b/src/test/compile-fail/liveness-if-no-else.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x: int) { info!(x); } +fn foo(x: int) { info2!("{}", x); } fn main() { let x: int; if 1 > 2 { x = 10; } diff --git a/src/test/compile-fail/liveness-if-with-else.rs b/src/test/compile-fail/liveness-if-with-else.rs index e2cf820f1911a..cf13f7117eea2 100644 --- a/src/test/compile-fail/liveness-if-with-else.rs +++ b/src/test/compile-fail/liveness-if-with-else.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x: int) { info!(x); } +fn foo(x: int) { info2!("{:?}", x); } fn main() { let x: int; if 1 > 2 { - info!("whoops"); + info2!("whoops"); } else { x = 10; } diff --git a/src/test/compile-fail/liveness-init-in-fn-expr.rs b/src/test/compile-fail/liveness-init-in-fn-expr.rs index b6c7895235b10..db8afdf45ae22 100644 --- a/src/test/compile-fail/liveness-init-in-fn-expr.rs +++ b/src/test/compile-fail/liveness-init-in-fn-expr.rs @@ -13,5 +13,5 @@ fn main() { let i: int; i //~ ERROR use of possibly uninitialized variable: `i` }; - error!(f()); + error2!("{:?}", f()); } diff --git a/src/test/compile-fail/liveness-move-in-loop.rs b/src/test/compile-fail/liveness-move-in-loop.rs index b6cecf0145ce9..769de1e7ef3da 100644 --- a/src/test/compile-fail/liveness-move-in-loop.rs +++ b/src/test/compile-fail/liveness-move-in-loop.rs @@ -12,7 +12,7 @@ fn main() { let y: ~int = ~42; let mut x: ~int; loop { - info!(y); + info2!("{:?}", y); loop { loop { loop { diff --git a/src/test/compile-fail/liveness-move-in-while.rs b/src/test/compile-fail/liveness-move-in-while.rs index eed7ba16da415..752c6c9f1b718 100644 --- a/src/test/compile-fail/liveness-move-in-while.rs +++ b/src/test/compile-fail/liveness-move-in-while.rs @@ -13,7 +13,7 @@ fn main() { let y: ~int = ~42; let mut x: ~int; loop { - info!(y); //~ ERROR use of moved value: `y` + info2!("{:?}", y); //~ ERROR use of moved value: `y` while true { while true { while true { x = y; x.clone(); } } } //~^ ERROR use of moved value: `y` } diff --git a/src/test/compile-fail/liveness-or-init.rs b/src/test/compile-fail/liveness-or-init.rs index ee2a550d98370..9ab7a64e8bdf9 100644 --- a/src/test/compile-fail/liveness-or-init.rs +++ b/src/test/compile-fail/liveness-or-init.rs @@ -11,6 +11,6 @@ fn main() { let i: int; - info!(false || { i = 5; true }); - info!(i); //~ ERROR use of possibly uninitialized variable: `i` + info2!("{}", false || { i = 5; true }); + info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` } diff --git a/src/test/compile-fail/liveness-uninit.rs b/src/test/compile-fail/liveness-uninit.rs index 015f824f6891b..439aff342bc61 100644 --- a/src/test/compile-fail/liveness-uninit.rs +++ b/src/test/compile-fail/liveness-uninit.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x: int) { info!(x); } +fn foo(x: int) { info2!("{}", x); } fn main() { let x: int; diff --git a/src/test/compile-fail/liveness-use-after-move.rs b/src/test/compile-fail/liveness-use-after-move.rs index 3423c780c4aec..8ef3c5494aec6 100644 --- a/src/test/compile-fail/liveness-use-after-move.rs +++ b/src/test/compile-fail/liveness-use-after-move.rs @@ -11,6 +11,6 @@ fn main() { let x = ~5; let y = x; - info!(*x); //~ ERROR use of moved value: `x` + info2!("{:?}", *x); //~ ERROR use of moved value: `x` y.clone(); } diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/compile-fail/liveness-use-after-send.rs index 5a748fbc81c9e..4f2d84ad13b02 100644 --- a/src/test/compile-fail/liveness-use-after-send.rs +++ b/src/test/compile-fail/liveness-use-after-send.rs @@ -9,9 +9,9 @@ // except according to those terms. fn send(ch: _chan, data: T) { - info!(ch); - info!(data); - fail!(); + info2!("{:?}", ch); + info2!("{:?}", data); + fail2!(); } struct _chan(int); @@ -20,7 +20,7 @@ struct _chan(int); // message after the send deinitializes it fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) { send(ch, message); - info!(message); //~ ERROR use of moved value: `message` + info2!("{:?}", message); //~ ERROR use of moved value: `message` } -fn main() { fail!(); } +fn main() { fail2!(); } diff --git a/src/test/compile-fail/liveness-while-break.rs b/src/test/compile-fail/liveness-while-break.rs index 712d586852af4..02d8656baff17 100644 --- a/src/test/compile-fail/liveness-while-break.rs +++ b/src/test/compile-fail/liveness-while-break.rs @@ -14,7 +14,7 @@ fn test(cond: bool) { v = 3; break; } - info!("%d", v); //~ ERROR use of possibly uninitialized variable: `v` + info2!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` } fn main() { diff --git a/src/test/compile-fail/match-join.rs b/src/test/compile-fail/match-join.rs index 818671e113322..5d9ae958ce0c1 100644 --- a/src/test/compile-fail/match-join.rs +++ b/src/test/compile-fail/match-join.rs @@ -11,11 +11,11 @@ // a good test that we merge paths correctly in the presence of a // variable that's used before it's declared -fn my_fail() -> ! { fail!(); } +fn my_fail() -> ! { fail2!(); } fn main() { match true { false => { my_fail(); } true => { } } - info!(x); //~ ERROR unresolved name `x`. + info2!("{:?}", x); //~ ERROR unresolved name `x`. let x: int; } diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index fec0f89adbaf8..6531ae035843a 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -2,7 +2,7 @@ // they occur as part of various kinds of expressions. struct Foo { f: A } -fn guard(_s: ~str) -> bool {fail!()} +fn guard(_s: ~str) -> bool {fail2!()} fn touch(_a: &A) {} fn f10() { diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/compile-fail/moves-based-on-type-match-bindings.rs index 42944a206b360..4893c8b71979b 100644 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ b/src/test/compile-fail/moves-based-on-type-match-bindings.rs @@ -3,7 +3,7 @@ // terms of the binding, not the discriminant. struct Foo { f: A } -fn guard(_s: ~str) -> bool {fail!()} +fn guard(_s: ~str) -> bool {fail2!()} fn touch(_a: &A) {} fn f10() { diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index 2762140be3793..d1eae1ae6134b 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -30,7 +30,7 @@ fn innocent_looking_victim() { (f.c)(f, true); println!("{:?}", msg); }, - None => fail!("oops"), + None => fail2!("oops"), } } } diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/compile-fail/no-capture-arc.rs index fd54b6638c65f..90a68d796f307 100644 --- a/src/test/compile-fail/no-capture-arc.rs +++ b/src/test/compile-fail/no-capture-arc.rs @@ -26,5 +26,5 @@ fn main() { assert_eq!((arc_v.get())[2], 3); - info!(arc_v); + info2!("{:?}", arc_v); } diff --git a/src/test/compile-fail/no-reuse-move-arc.rs b/src/test/compile-fail/no-reuse-move-arc.rs index a17196ae298e7..9eca132982453 100644 --- a/src/test/compile-fail/no-reuse-move-arc.rs +++ b/src/test/compile-fail/no-reuse-move-arc.rs @@ -24,5 +24,5 @@ fn main() { assert_eq!((arc_v.get())[2], 3); //~ ERROR use of moved value: `arc_v` - info!(arc_v); //~ ERROR use of moved value: `arc_v` + info2!("{:?}", arc_v); //~ ERROR use of moved value: `arc_v` } diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index e7b897ad90683..f6d1aceab6469 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -33,6 +33,6 @@ fn main() { do task::spawn { let y = x.take(); //~ ERROR does not fulfill `Send` - error!(y); + error2!("{:?}", y); } } diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index b87b3c5245a8c..f5660fd35106c 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -16,7 +16,7 @@ enum u { c, d } fn main() { let x = a(c); match x { - a(d) => { fail!("hello"); } - b => { fail!("goodbye"); } + a(d) => { fail2!("hello"); } + b => { fail2!("goodbye"); } } } diff --git a/src/test/compile-fail/noncopyable-class.rs b/src/test/compile-fail/noncopyable-class.rs index 9d057998c790d..199bdaa397adb 100644 --- a/src/test/compile-fail/noncopyable-class.rs +++ b/src/test/compile-fail/noncopyable-class.rs @@ -39,5 +39,5 @@ fn foo(i:int) -> foo { fn main() { let x = foo(10); let _y = x.clone(); //~ ERROR does not implement any method in scope - error!(x); + error2!("{:?}", x); } diff --git a/src/test/compile-fail/nonscalar-cast.rs b/src/test/compile-fail/nonscalar-cast.rs index 9cfd63dd51fdb..45efa8929890a 100644 --- a/src/test/compile-fail/nonscalar-cast.rs +++ b/src/test/compile-fail/nonscalar-cast.rs @@ -15,5 +15,5 @@ struct foo { } fn main() { - info!(foo{ x: 1 } as int); + info2!("{:?}", foo{ x: 1 } as int); } diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/compile-fail/not-enough-arguments.rs index 57eca3666ef14..a53736580d9b2 100644 --- a/src/test/compile-fail/not-enough-arguments.rs +++ b/src/test/compile-fail/not-enough-arguments.rs @@ -13,7 +13,7 @@ // unrelated errors. fn foo(a: int, b: int, c: int, d:int) { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/compile-fail/oversized-literal.rs b/src/test/compile-fail/oversized-literal.rs index f46ef0563164e..5b5cab25e0464 100644 --- a/src/test/compile-fail/oversized-literal.rs +++ b/src/test/compile-fail/oversized-literal.rs @@ -10,4 +10,4 @@ // error-pattern:literal out of range -fn main() { info!(300u8); } +fn main() { info2!("{}", 300u8); } diff --git a/src/test/compile-fail/packed-struct-generic-transmute.rs b/src/test/compile-fail/packed-struct-generic-transmute.rs index 8e15f11231e97..0a5bc4ad8bb85 100644 --- a/src/test/compile-fail/packed-struct-generic-transmute.rs +++ b/src/test/compile-fail/packed-struct-generic-transmute.rs @@ -32,6 +32,6 @@ fn main() { let foo = Foo { bar: [1u8, 2, 3, 4, 5], baz: 10i32 }; unsafe { let oof: Oof<[u8, .. 5], i32> = cast::transmute(foo); - info!(oof); + info2!("{:?}", oof); } } diff --git a/src/test/compile-fail/packed-struct-transmute.rs b/src/test/compile-fail/packed-struct-transmute.rs index 38419b8df88a2..79978dedb567f 100644 --- a/src/test/compile-fail/packed-struct-transmute.rs +++ b/src/test/compile-fail/packed-struct-transmute.rs @@ -32,6 +32,6 @@ fn main() { let foo = Foo { bar: 1, baz: 10 }; unsafe { let oof: Oof = cast::transmute(foo); - info!(oof); + info2!("{:?}", oof); } } diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 537d095d2d7a3..216280b34e922 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -15,6 +15,6 @@ extern mod extra; enum bar { t1((), Option<~[int]>), t2, } // n.b. my change changes this error message, but I think it's right -- tjc -fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation * cannot be applied to +fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail2!(); } } } //~ ERROR binary operation * cannot be applied to fn main() { } diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index 49ad8f87de339..67a4bacbe9a9d 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -18,9 +18,9 @@ enum bar { t1((), Option<~[int]>), t2, } fn foo(t: bar) { match t { t1(_, Some::(x)) => { - info!(x); + info2!("{:?}", x); } - _ => { fail!(); } + _ => { fail2!(); } } } diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs index 822c681211634..8baba6cccc118 100644 --- a/src/test/compile-fail/pinned-deep-copy.rs +++ b/src/test/compile-fail/pinned-deep-copy.rs @@ -37,7 +37,7 @@ fn main() { // Can't do this copy let x = ~~~A {y: r(i)}; let _z = x.clone(); //~ ERROR failed to find an implementation - info!(x); + info2!("{:?}", x); } - error!(*i); + error2!("{:?}", *i); } diff --git a/src/test/compile-fail/regions-addr-of-self.rs b/src/test/compile-fail/regions-addr-of-self.rs index 4565d897c72ba..1904f0826176e 100644 --- a/src/test/compile-fail/regions-addr-of-self.rs +++ b/src/test/compile-fail/regions-addr-of-self.rs @@ -33,5 +33,5 @@ fn dog() -> dog { fn main() { let mut d = dog(); d.chase_cat(); - info!("cats_chased: %u", d.cats_chased); + info2!("cats_chased: {}", d.cats_chased); } diff --git a/src/test/compile-fail/regions-fn-subtyping.rs b/src/test/compile-fail/regions-fn-subtyping.rs index 5928d31a66860..10107f64158d4 100644 --- a/src/test/compile-fail/regions-fn-subtyping.rs +++ b/src/test/compile-fail/regions-fn-subtyping.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn of() -> &fn(T) { fail!(); } -fn subtype(x: &fn(T)) { fail!(); } +fn of() -> &fn(T) { fail2!(); } +fn subtype(x: &fn(T)) { fail2!(); } fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) { // Here, x, y, and z are free. Other letters diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/compile-fail/regions-free-region-ordering-callee.rs index 66ab4b7705433..872491adaacc8 100644 --- a/src/test/compile-fail/regions-free-region-ordering-callee.rs +++ b/src/test/compile-fail/regions-free-region-ordering-callee.rs @@ -27,7 +27,7 @@ fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint { // Do not infer an ordering from the return value. let z: &'b uint = &*x; //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements - fail!(); + fail2!(); } fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: &fn(&'a &'b uint)) { diff --git a/src/test/compile-fail/regions-freevar.rs b/src/test/compile-fail/regions-freevar.rs index 6bc93e3af7c74..06e91ddcf56de 100644 --- a/src/test/compile-fail/regions-freevar.rs +++ b/src/test/compile-fail/regions-freevar.rs @@ -13,6 +13,6 @@ fn wants_static_fn(_x: &'static fn()) {} fn main() { let i = 3; do wants_static_fn { //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements - info!("i=%d", i); + info2!("i={}", i); } } diff --git a/src/test/compile-fail/regions-ret-borrowed-1.rs b/src/test/compile-fail/regions-ret-borrowed-1.rs index de4a05c9895c3..885d50b7efc4c 100644 --- a/src/test/compile-fail/regions-ret-borrowed-1.rs +++ b/src/test/compile-fail/regions-ret-borrowed-1.rs @@ -24,5 +24,5 @@ fn return_it<'a>() -> &'a int { fn main() { let x = return_it(); - info!("foo=%d", *x); + info2!("foo={}", *x); } diff --git a/src/test/compile-fail/regions-ret-borrowed.rs b/src/test/compile-fail/regions-ret-borrowed.rs index 1aa2329aaec61..5dea40f4ac7c9 100644 --- a/src/test/compile-fail/regions-ret-borrowed.rs +++ b/src/test/compile-fail/regions-ret-borrowed.rs @@ -27,5 +27,5 @@ fn return_it() -> &int { fn main() { let x = return_it(); - info!("foo=%d", *x); + info2!("foo={}", *x); } diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index ebd3320d90126..ce6d12a22655e 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -16,7 +16,7 @@ extern mod std; fn last(v: ~[&T]) -> std::option::Option { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/compile-fail/tag-type-args.rs b/src/test/compile-fail/tag-type-args.rs index f2ef1d1952505..a88435bff6eb0 100644 --- a/src/test/compile-fail/tag-type-args.rs +++ b/src/test/compile-fail/tag-type-args.rs @@ -14,4 +14,4 @@ enum quux { bar } fn foo(c: quux) { assert!((false)); } -fn main() { fail!(); } +fn main() { fail2!(); } diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/compile-fail/unconstrained-none.rs index 7993df80b8d1b..798b92fd57b83 100644 --- a/src/test/compile-fail/unconstrained-none.rs +++ b/src/test/compile-fail/unconstrained-none.rs @@ -11,5 +11,5 @@ // Issue #5062 fn main() { - fmt!("%?", None); //~ ERROR cannot determine a type for this expression: unconstrained type + None; //~ ERROR cannot determine a type for this expression: unconstrained type } diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index 50bb074fc7ac7..8882bd1e2681a 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -19,5 +19,5 @@ impl Drop for r { fn main() { let i = ~r { b: true }; let _j = i.clone(); //~ ERROR failed to find an implementation - info!(i); + info2!("{:?}", i); } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 0fcbc847850be..4bc181cbdfa97 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -31,6 +31,6 @@ fn main() { let r2 = ~[~r { i: i2 }]; f(r1.clone(), r2.clone()); //~^ ERROR failed to find an implementation of - info!((r2, *i1)); - info!((r1, *i2)); + info2!("{:?}", (r2, *i1)); + info2!("{:?}", (r1, *i2)); } diff --git a/src/test/compile-fail/unsupported-cast.rs b/src/test/compile-fail/unsupported-cast.rs index faa0069a1136a..d9a5302aedcb9 100644 --- a/src/test/compile-fail/unsupported-cast.rs +++ b/src/test/compile-fail/unsupported-cast.rs @@ -13,5 +13,5 @@ use std::libc; fn main() { - info!(1.0 as *libc::FILE); // Can't cast float to foreign. + info2!("{:?}", 1.0 as *libc::FILE); // Can't cast float to foreign. } diff --git a/src/test/compile-fail/vec-field.rs b/src/test/compile-fail/vec-field.rs index bc2786b2c19a8..38bba1efea574 100644 --- a/src/test/compile-fail/vec-field.rs +++ b/src/test/compile-fail/vec-field.rs @@ -13,7 +13,7 @@ fn f() { let v = ~[1i]; - info!(v.some_field_name); //type error + info2!("{}", v.some_field_name); //type error } fn main() { } diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index e7441a2c96818..48db83bd92f33 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -25,5 +25,5 @@ fn main() { let i = ~[r(0)]; let j = ~[r(1)]; let k = i + j; - info!(j); + info2!("{}", j); } From 02054ac8a1490211a5a6873fdefe186bd0758b7b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 29 Sep 2013 21:08:46 -0700 Subject: [PATCH 12/16] rfail: Remove usage of fmt! --- src/test/run-fail/args-fail.rs | 4 ++-- src/test/run-fail/assert-macro-fmt.rs | 2 +- src/test/run-fail/binop-fail-2.rs | 2 +- src/test/run-fail/binop-fail-3.rs | 2 +- src/test/run-fail/binop-fail.rs | 2 +- src/test/run-fail/bug-2470-bounds-check-overflow.rs | 10 +++++----- src/test/run-fail/bug-811.rs | 4 ++-- src/test/run-fail/die-macro-expr.rs | 2 +- src/test/run-fail/die-macro-pure.rs | 2 +- src/test/run-fail/die-macro.rs | 2 +- src/test/run-fail/doublefail.rs | 4 ++-- src/test/run-fail/explicit-fail-msg.rs | 2 +- src/test/run-fail/explicit-fail.rs | 2 +- src/test/run-fail/expr-fn-fail.rs | 2 +- src/test/run-fail/expr-if-fail-fn.rs | 2 +- src/test/run-fail/expr-if-fail.rs | 2 +- src/test/run-fail/expr-match-fail-fn.rs | 2 +- src/test/run-fail/expr-match-fail.rs | 2 +- src/test/run-fail/extern-fail.rs | 2 +- src/test/run-fail/fail-arg.rs | 4 ++-- src/test/run-fail/fail-macro-explicit.rs | 2 +- src/test/run-fail/fail-macro-fmt.rs | 2 +- src/test/run-fail/fail-macro-owned.rs | 2 +- src/test/run-fail/fail-macro-static.rs | 2 +- src/test/run-fail/fail-main.rs | 2 +- src/test/run-fail/fail-parens.rs | 4 ++-- src/test/run-fail/fmt-fail.rs | 2 +- src/test/run-fail/for-each-loop-fail.rs | 2 +- src/test/run-fail/if-check-fail.rs | 4 ++-- src/test/run-fail/if-cond-bot.rs | 2 +- src/test/run-fail/issue-2156.rs | 2 +- src/test/run-fail/issue-2272.rs | 2 +- src/test/run-fail/issue-2444.rs | 2 +- src/test/run-fail/issue-3029.rs | 2 +- src/test/run-fail/issue-948.rs | 2 +- src/test/run-fail/linked-failure2.rs | 2 +- src/test/run-fail/linked-failure3.rs | 2 +- src/test/run-fail/match-bot-fail.rs | 2 +- src/test/run-fail/match-disc-bot.rs | 2 +- src/test/run-fail/match-wildcards.rs | 8 ++++---- src/test/run-fail/morestack1.rs | 2 +- src/test/run-fail/morestack2.rs | 2 +- src/test/run-fail/morestack3.rs | 2 +- src/test/run-fail/morestack4.rs | 2 +- src/test/run-fail/result-get-fail.rs | 2 +- src/test/run-fail/rhs-type.rs | 2 +- src/test/run-fail/rt-set-exit-status-fail.rs | 4 ++-- src/test/run-fail/rt-set-exit-status-fail2.rs | 4 ++-- src/test/run-fail/rt-set-exit-status.rs | 2 +- src/test/run-fail/run-unexported-tests.rs | 2 +- src/test/run-fail/small-negative-indexing.rs | 2 +- src/test/run-fail/spawnfail.rs | 2 +- src/test/run-fail/task-comm-recv-block.rs | 4 ++-- src/test/run-fail/tls-exit-status.rs | 2 +- src/test/run-fail/unique-fail.rs | 2 +- src/test/run-fail/unwind-box-fn-unique.rs | 6 +++--- src/test/run-fail/unwind-box-res.rs | 4 ++-- src/test/run-fail/unwind-box-str.rs | 4 ++-- src/test/run-fail/unwind-box-trait.rs | 4 ++-- src/test/run-fail/unwind-box-unique-unique.rs | 4 ++-- src/test/run-fail/unwind-box-unique.rs | 4 ++-- src/test/run-fail/unwind-box-vec.rs | 4 ++-- src/test/run-fail/unwind-box.rs | 2 +- src/test/run-fail/unwind-fail.rs | 2 +- src/test/run-fail/unwind-initializer-indirect.rs | 2 +- src/test/run-fail/unwind-initializer.rs | 2 +- src/test/run-fail/unwind-interleaved.rs | 2 +- src/test/run-fail/unwind-iter.rs | 2 +- src/test/run-fail/unwind-iter2.rs | 2 +- src/test/run-fail/unwind-lambda.rs | 2 +- src/test/run-fail/unwind-match.rs | 2 +- src/test/run-fail/unwind-misc-1.rs | 2 +- src/test/run-fail/unwind-move.rs | 2 +- src/test/run-fail/unwind-nested.rs | 2 +- src/test/run-fail/unwind-partial-box.rs | 2 +- src/test/run-fail/unwind-partial-unique.rs | 2 +- src/test/run-fail/unwind-partial-vec.rs | 2 +- src/test/run-fail/unwind-rec.rs | 2 +- src/test/run-fail/unwind-rec2.rs | 2 +- src/test/run-fail/unwind-resource-fail.rs | 2 +- src/test/run-fail/unwind-resource-fail2.rs | 4 ++-- src/test/run-fail/unwind-resource-fail3.rs | 2 +- src/test/run-fail/unwind-stacked.rs | 2 +- src/test/run-fail/unwind-tup.rs | 2 +- src/test/run-fail/unwind-tup2.rs | 2 +- src/test/run-fail/unwind-uninitialized.rs | 2 +- src/test/run-fail/unwind-unique.rs | 2 +- src/test/run-fail/while-body-fails.rs | 2 +- src/test/run-fail/while-fail.rs | 2 +- 89 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/test/run-fail/args-fail.rs b/src/test/run-fail/args-fail.rs index b803d7488b073..d936368cc33d3 100644 --- a/src/test/run-fail/args-fail.rs +++ b/src/test/run-fail/args-fail.rs @@ -9,6 +9,6 @@ // except according to those terms. // error-pattern:meep -fn f(_a: int, _b: int, _c: @int) { fail!("moop"); } +fn f(_a: int, _b: int, _c: @int) { fail2!("moop"); } -fn main() { f(1, fail!("meep"), @42); } +fn main() { f(1, fail2!("meep"), @42); } diff --git a/src/test/run-fail/assert-macro-fmt.rs b/src/test/run-fail/assert-macro-fmt.rs index 2159f68cc7170..53a37c5d68445 100644 --- a/src/test/run-fail/assert-macro-fmt.rs +++ b/src/test/run-fail/assert-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'test-assert-fmt 42 rust' fn main() { - assert!(false, "test-assert-fmt %d %s", 42, "rust"); + assert!(false, "test-assert-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/binop-fail-2.rs b/src/test/run-fail/binop-fail-2.rs index a49f96fced51f..1038d2025c783 100644 --- a/src/test/run-fail/binop-fail-2.rs +++ b/src/test/run-fail/binop-fail-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); } +fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); } fn main() { 3u == my_err(~"bye"); } diff --git a/src/test/run-fail/binop-fail-3.rs b/src/test/run-fail/binop-fail-3.rs index 150544f16af0c..b46d5251e2234 100644 --- a/src/test/run-fail/binop-fail-3.rs +++ b/src/test/run-fail/binop-fail-3.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn foo() -> ! { fail!("quux"); } +fn foo() -> ! { fail2!("quux"); } fn main() { foo() == foo(); } diff --git a/src/test/run-fail/binop-fail.rs b/src/test/run-fail/binop-fail.rs index a49f96fced51f..1038d2025c783 100644 --- a/src/test/run-fail/binop-fail.rs +++ b/src/test/run-fail/binop-fail.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); } +fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); } fn main() { 3u == my_err(~"bye"); } diff --git a/src/test/run-fail/bug-2470-bounds-check-overflow.rs b/src/test/run-fail/bug-2470-bounds-check-overflow.rs index 0fdaf31c59361..083ea5b8f190c 100644 --- a/src/test/run-fail/bug-2470-bounds-check-overflow.rs +++ b/src/test/run-fail/bug-2470-bounds-check-overflow.rs @@ -24,13 +24,13 @@ fn main() { do x.as_imm_buf |p, _len| { let base = p as uint; let idx = base / sys::size_of::(); - error!("ov1 base = 0x%x", base); - error!("ov1 idx = 0x%x", idx); - error!("ov1 sizeof::() = 0x%x", sys::size_of::()); - error!("ov1 idx * sizeof::() = 0x%x", + error2!("ov1 base = 0x{:x}", base); + error2!("ov1 idx = 0x{:x}", idx); + error2!("ov1 sizeof::() = 0x{:x}", sys::size_of::()); + error2!("ov1 idx * sizeof::() = 0x{:x}", idx * sys::size_of::()); // This should fail. - error!("ov1 0x%x", x[idx]); + error2!("ov1 0x{:x}", x[idx]); } } diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index 2a256b9a4e384..b41062043cfd8 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -19,6 +19,6 @@ struct chan_t { port: port_id, } -fn send(_ch: chan_t, _data: T) { fail!(); } +fn send(_ch: chan_t, _data: T) { fail2!(); } -fn main() { fail!("quux"); } +fn main() { fail2!("quux"); } diff --git a/src/test/run-fail/die-macro-expr.rs b/src/test/run-fail/die-macro-expr.rs index 8ff62d5a43d10..3310ffe909a7f 100644 --- a/src/test/run-fail/die-macro-expr.rs +++ b/src/test/run-fail/die-macro-expr.rs @@ -1,5 +1,5 @@ // error-pattern:test fn main() { - let _i: int = fail!("test"); + let _i: int = fail2!("test"); } diff --git a/src/test/run-fail/die-macro-pure.rs b/src/test/run-fail/die-macro-pure.rs index bb62a7e8beff6..6d0f5909c4ded 100644 --- a/src/test/run-fail/die-macro-pure.rs +++ b/src/test/run-fail/die-macro-pure.rs @@ -1,7 +1,7 @@ // error-pattern:test fn f() { - fail!("test"); + fail2!("test"); } fn main() { diff --git a/src/test/run-fail/die-macro.rs b/src/test/run-fail/die-macro.rs index 71cc7317e6ef2..678ac65558045 100644 --- a/src/test/run-fail/die-macro.rs +++ b/src/test/run-fail/die-macro.rs @@ -1,5 +1,5 @@ // error-pattern:test fn main() { - fail!("test"); + fail2!("test"); } diff --git a/src/test/run-fail/doublefail.rs b/src/test/run-fail/doublefail.rs index 1ceeee1b6ed11..ee59823e8ad27 100644 --- a/src/test/run-fail/doublefail.rs +++ b/src/test/run-fail/doublefail.rs @@ -12,6 +12,6 @@ //error-pattern:One fn main() { - fail!("One"); - fail!("Two"); + fail2!("One"); + fail2!("Two"); } diff --git a/src/test/run-fail/explicit-fail-msg.rs b/src/test/run-fail/explicit-fail-msg.rs index ab8cea0a3051a..c1d2e986f1247 100644 --- a/src/test/run-fail/explicit-fail-msg.rs +++ b/src/test/run-fail/explicit-fail-msg.rs @@ -15,5 +15,5 @@ fn main() { let mut a = 1; if 1 == 1 { a = 2; } - fail!(~"woooo" + "o"); + fail2!(~"woooo" + "o"); } diff --git a/src/test/run-fail/explicit-fail.rs b/src/test/run-fail/explicit-fail.rs index 8c204b66e3657..78a407bbbd5f9 100644 --- a/src/test/run-fail/explicit-fail.rs +++ b/src/test/run-fail/explicit-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit -fn main() { fail!(); } +fn main() { fail2!(); } diff --git a/src/test/run-fail/expr-fn-fail.rs b/src/test/run-fail/expr-fn-fail.rs index e645ea34df564..a8714fdbdc835 100644 --- a/src/test/run-fail/expr-fn-fail.rs +++ b/src/test/run-fail/expr-fn-fail.rs @@ -12,6 +12,6 @@ // error-pattern:explicit failure -fn f() -> ! { fail!() } +fn f() -> ! { fail2!() } fn main() { f(); } diff --git a/src/test/run-fail/expr-if-fail-fn.rs b/src/test/run-fail/expr-if-fail-fn.rs index 99f798147f28f..8ecc2cdf0f4f6 100644 --- a/src/test/run-fail/expr-if-fail-fn.rs +++ b/src/test/run-fail/expr-if-fail-fn.rs @@ -12,7 +12,7 @@ // error-pattern:explicit failure -fn f() -> ! { fail!() } +fn f() -> ! { fail2!() } fn g() -> int { let x = if true { f() } else { 10 }; return x; } diff --git a/src/test/run-fail/expr-if-fail.rs b/src/test/run-fail/expr-if-fail.rs index 73259e6e140f5..50778f6556043 100644 --- a/src/test/run-fail/expr-if-fail.rs +++ b/src/test/run-fail/expr-if-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit failure -fn main() { let _x = if false { 0 } else if true { fail!() } else { 10 }; } +fn main() { let _x = if false { 0 } else if true { fail2!() } else { 10 }; } diff --git a/src/test/run-fail/expr-match-fail-fn.rs b/src/test/run-fail/expr-match-fail-fn.rs index 6476e57a35b84..98cc3c230a049 100644 --- a/src/test/run-fail/expr-match-fail-fn.rs +++ b/src/test/run-fail/expr-match-fail-fn.rs @@ -12,7 +12,7 @@ // error-pattern:explicit failure -fn f() -> ! { fail!() } +fn f() -> ! { fail2!() } fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; } diff --git a/src/test/run-fail/expr-match-fail.rs b/src/test/run-fail/expr-match-fail.rs index 075f6f5b4b190..c8cab907d7d1c 100644 --- a/src/test/run-fail/expr-match-fail.rs +++ b/src/test/run-fail/expr-match-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit failure -fn main() { let _x = match true { false => { 0 } true => { fail!() } }; } +fn main() { let _x = match true { false => { 0 } true => { fail2!() } }; } diff --git a/src/test/run-fail/extern-fail.rs b/src/test/run-fail/extern-fail.rs index ce5ea56502cc7..17059107c011b 100644 --- a/src/test/run-fail/extern-fail.rs +++ b/src/test/run-fail/extern-fail.rs @@ -45,7 +45,7 @@ fn main() { do task::spawn { let result = count(5u); info!("result = %?", result); - fail!(); + fail2!(); }; } } diff --git a/src/test/run-fail/fail-arg.rs b/src/test/run-fail/fail-arg.rs index 844bac9d3d037..29baa4b31704e 100644 --- a/src/test/run-fail/fail-arg.rs +++ b/src/test/run-fail/fail-arg.rs @@ -9,6 +9,6 @@ // except according to those terms. // error-pattern:woe -fn f(a: int) { info!(a); } +fn f(a: int) { info2!("{}", a); } -fn main() { f(fail!("woe")); } +fn main() { f(fail2!("woe")); } diff --git a/src/test/run-fail/fail-macro-explicit.rs b/src/test/run-fail/fail-macro-explicit.rs index 13e3a6a31a8fa..ca6abee03bfa9 100644 --- a/src/test/run-fail/fail-macro-explicit.rs +++ b/src/test/run-fail/fail-macro-explicit.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'explicit failure' fn main() { - fail!(); + fail2!(); } diff --git a/src/test/run-fail/fail-macro-fmt.rs b/src/test/run-fail/fail-macro-fmt.rs index 5fc51ac674581..90d9ff9b0ec89 100644 --- a/src/test/run-fail/fail-macro-fmt.rs +++ b/src/test/run-fail/fail-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'test-fail-fmt 42 rust' fn main() { - fail!("test-fail-fmt %d %s", 42, "rust"); + fail2!("test-fail-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/fail-macro-owned.rs b/src/test/run-fail/fail-macro-owned.rs index e59f5bdcaa179..fa461fefb88c1 100644 --- a/src/test/run-fail/fail-macro-owned.rs +++ b/src/test/run-fail/fail-macro-owned.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'test-fail-owned' fn main() { - fail!("test-fail-owned"); + fail2!("test-fail-owned"); } diff --git a/src/test/run-fail/fail-macro-static.rs b/src/test/run-fail/fail-macro-static.rs index 688ca4ce7e572..f05a68a5fcb24 100644 --- a/src/test/run-fail/fail-macro-static.rs +++ b/src/test/run-fail/fail-macro-static.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'test-fail-static' fn main() { - fail!("test-fail-static"); + fail2!("test-fail-static"); } diff --git a/src/test/run-fail/fail-main.rs b/src/test/run-fail/fail-main.rs index f007e03041c14..2691beed27252 100644 --- a/src/test/run-fail/fail-main.rs +++ b/src/test/run-fail/fail-main.rs @@ -10,4 +10,4 @@ // error-pattern:moop extern mod extra; -fn main() { fail!("moop"); } +fn main() { fail2!("moop"); } diff --git a/src/test/run-fail/fail-parens.rs b/src/test/run-fail/fail-parens.rs index 90a44e4275937..79f46f47fb30c 100644 --- a/src/test/run-fail/fail-parens.rs +++ b/src/test/run-fail/fail-parens.rs @@ -13,8 +13,8 @@ // error-pattern:oops fn bigfail() { - while (fail!("oops")) { if (fail!()) { - match (fail!()) { () => { + while (fail2!("oops")) { if (fail2!()) { + match (fail2!()) { () => { } } }}; diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index d34ca029023f3..1c6298a6c8d2b 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -11,4 +11,4 @@ // error-pattern:meh extern mod extra; -fn main() { let str_var: ~str = ~"meh"; fail!(fmt!("%s", str_var)); } +fn main() { let str_var: ~str = ~"meh"; fail2!("{}", str_var); } diff --git a/src/test/run-fail/for-each-loop-fail.rs b/src/test/run-fail/for-each-loop-fail.rs index 3c9397fc07ff3..032460d20796a 100644 --- a/src/test/run-fail/for-each-loop-fail.rs +++ b/src/test/run-fail/for-each-loop-fail.rs @@ -11,4 +11,4 @@ // error-pattern:moop extern mod extra; -fn main() { for _ in range(0u, 10u) { fail!("moop"); } } +fn main() { for _ in range(0u, 10u) { fail2!("moop"); } } diff --git a/src/test/run-fail/if-check-fail.rs b/src/test/run-fail/if-check-fail.rs index f7d37d1532973..e8a1cad53ad11 100644 --- a/src/test/run-fail/if-check-fail.rs +++ b/src/test/run-fail/if-check-fail.rs @@ -17,9 +17,9 @@ fn even(x: uint) -> bool { fn foo(x: uint) { if even(x) { - info!(x); + info2!("{}", x); } else { - fail!("Number is odd"); + fail2!("Number is odd"); } } diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index 9a36681da5f16..d596a11f1cbdc 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); } +fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); } fn main() { if my_err(~"bye") { } } diff --git a/src/test/run-fail/issue-2156.rs b/src/test/run-fail/issue-2156.rs index 863663334f8ed..78422347f7842 100644 --- a/src/test/run-fail/issue-2156.rs +++ b/src/test/run-fail/issue-2156.rs @@ -19,6 +19,6 @@ use std::io; fn main() { do io::with_str_reader(~"") |rdr| { - match rdr.read_char() { '=' => { } _ => { fail!() } } + match rdr.read_char() { '=' => { } _ => { fail2!() } } } } diff --git a/src/test/run-fail/issue-2272.rs b/src/test/run-fail/issue-2272.rs index 5ce89bc181496..9b8ecca96a6fa 100644 --- a/src/test/run-fail/issue-2272.rs +++ b/src/test/run-fail/issue-2272.rs @@ -22,5 +22,5 @@ fn main() { }, a: ~0 }; - fail!(); + fail2!(); } diff --git a/src/test/run-fail/issue-2444.rs b/src/test/run-fail/issue-2444.rs index c1357988f7db5..b15c54c7b6eb8 100644 --- a/src/test/run-fail/issue-2444.rs +++ b/src/test/run-fail/issue-2444.rs @@ -15,7 +15,7 @@ use extra::arc; enum e { e(arc::Arc) } -fn foo() -> e {fail!();} +fn foo() -> e {fail2!();} fn main() { let _f = foo(); diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 44364007c067e..5d20c49945e08 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -16,7 +16,7 @@ fn main() { let mut x = ~[]; let y = ~[3]; - fail!("so long"); + fail2!("so long"); x.push_all_move(y); ~"good" + ~"bye"; } diff --git a/src/test/run-fail/issue-948.rs b/src/test/run-fail/issue-948.rs index db954bc59466a..39d741e5169e2 100644 --- a/src/test/run-fail/issue-948.rs +++ b/src/test/run-fail/issue-948.rs @@ -16,5 +16,5 @@ struct Point { x: int, y: int } fn main() { let origin = Point {x: 0, y: 0}; - let f: Point = Point {x: (fail!("beep boop")),.. origin}; + let f: Point = Point {x: (fail2!("beep boop")),.. origin}; } diff --git a/src/test/run-fail/linked-failure2.rs b/src/test/run-fail/linked-failure2.rs index 52a67872d4cff..d99cfe40da43e 100644 --- a/src/test/run-fail/linked-failure2.rs +++ b/src/test/run-fail/linked-failure2.rs @@ -16,7 +16,7 @@ use std::comm; use std::task; -fn child() { fail!(); } +fn child() { fail2!(); } fn main() { let (p, _c) = comm::stream::<()>(); diff --git a/src/test/run-fail/linked-failure3.rs b/src/test/run-fail/linked-failure3.rs index f40eae20bc0bc..fd330bba1c57e 100644 --- a/src/test/run-fail/linked-failure3.rs +++ b/src/test/run-fail/linked-failure3.rs @@ -16,7 +16,7 @@ use std::comm; use std::task; -fn grandchild() { fail!("grandchild dies"); } +fn grandchild() { fail2!("grandchild dies"); } fn child() { let (p, _c) = comm::stream::(); diff --git a/src/test/run-fail/match-bot-fail.rs b/src/test/run-fail/match-bot-fail.rs index a54422ef8f535..7b1d6bea499d3 100644 --- a/src/test/run-fail/match-bot-fail.rs +++ b/src/test/run-fail/match-bot-fail.rs @@ -17,6 +17,6 @@ fn foo(s: ~str) { } fn main() { let i = - match Some::(3) { None:: => { fail!() } Some::(_) => { fail!() } }; + match Some::(3) { None:: => { fail2!() } Some::(_) => { fail2!() } }; foo(i); } diff --git a/src/test/run-fail/match-disc-bot.rs b/src/test/run-fail/match-disc-bot.rs index 13ccd118c6186..9b38a381a58ed 100644 --- a/src/test/run-fail/match-disc-bot.rs +++ b/src/test/run-fail/match-disc-bot.rs @@ -9,6 +9,6 @@ // except according to those terms. // error-pattern:quux -fn f() -> ! { fail!("quux") } +fn f() -> ! { fail2!("quux") } fn g() -> int { match f() { true => { 1 } false => { 0 } } } fn main() { g(); } diff --git a/src/test/run-fail/match-wildcards.rs b/src/test/run-fail/match-wildcards.rs index 22613f45b3bc4..535b3340a4d01 100644 --- a/src/test/run-fail/match-wildcards.rs +++ b/src/test/run-fail/match-wildcards.rs @@ -11,10 +11,10 @@ // error-pattern:squirrelcupcake fn cmp() -> int { match (Some('a'), None::) { - (Some(_), _) => { fail!("squirrelcupcake"); } - (_, Some(_)) => { fail!(); } - _ => { fail!("wat"); } + (Some(_), _) => { fail2!("squirrelcupcake"); } + (_, Some(_)) => { fail2!(); } + _ => { fail2!("wat"); } } } -fn main() { error!(cmp()); } +fn main() { error2!("{}", cmp()); } diff --git a/src/test/run-fail/morestack1.rs b/src/test/run-fail/morestack1.rs index d3e3be6c2caab..35c19c47f5286 100644 --- a/src/test/run-fail/morestack1.rs +++ b/src/test/run-fail/morestack1.rs @@ -14,7 +14,7 @@ fn getbig(i: int) { if i != 0 { getbig(i - 1); } else { - fail!(); + fail2!(); } } diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index 5ac3092640038..9af45cebe6871 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -35,7 +35,7 @@ fn getbig_call_c_and_fail(i: int) { } else { unsafe { rustrt::rust_get_argc(); - fail!(); + fail2!(); } } } diff --git a/src/test/run-fail/morestack3.rs b/src/test/run-fail/morestack3.rs index e6f219710b37b..fea9155116131 100644 --- a/src/test/run-fail/morestack3.rs +++ b/src/test/run-fail/morestack3.rs @@ -22,7 +22,7 @@ fn getbig_and_fail(i: int) { if i != 0 { getbig_and_fail(i - 1); } else { - fail!(); + fail2!(); } } diff --git a/src/test/run-fail/morestack4.rs b/src/test/run-fail/morestack4.rs index 02a65e91d0445..a4df5e57923f2 100644 --- a/src/test/run-fail/morestack4.rs +++ b/src/test/run-fail/morestack4.rs @@ -22,7 +22,7 @@ fn getbig_and_fail(i: int) { if i != 0 { getbig_and_fail(i - 1); } else { - fail!(); + fail2!(); } } diff --git a/src/test/run-fail/result-get-fail.rs b/src/test/run-fail/result-get-fail.rs index 4f552bc8f4216..c3f4250b05385 100644 --- a/src/test/run-fail/result-get-fail.rs +++ b/src/test/run-fail/result-get-fail.rs @@ -13,5 +13,5 @@ use std::result; fn main() { - error!(result::Err::(~"kitty").unwrap()); + error2!("{:?}", result::Err::(~"kitty").unwrap()); } diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index ca267608025c3..5e09536fb4d32 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -18,6 +18,6 @@ struct T { t: ~str } fn main() { - let pth = fail!("bye"); + let pth = fail2!("bye"); let _rs: T = T {t: pth}; } diff --git a/src/test/run-fail/rt-set-exit-status-fail.rs b/src/test/run-fail/rt-set-exit-status-fail.rs index 6b5c2b554a4db..5c854825c28a2 100644 --- a/src/test/run-fail/rt-set-exit-status-fail.rs +++ b/src/test/run-fail/rt-set-exit-status-fail.rs @@ -13,10 +13,10 @@ use std::os; fn main() { - error!(~"whatever"); + error2!("whatever"); // Setting the exit status only works when the scheduler terminates // normally. In this case we're going to fail, so instead of of // returning 50 the process will return the typical rt failure code. os::set_exit_status(50); - fail!(); + fail2!(); } diff --git a/src/test/run-fail/rt-set-exit-status-fail2.rs b/src/test/run-fail/rt-set-exit-status-fail2.rs index 01f745850906e..493420e3ee622 100644 --- a/src/test/run-fail/rt-set-exit-status-fail2.rs +++ b/src/test/run-fail/rt-set-exit-status-fail2.rs @@ -33,9 +33,9 @@ fn r(x:int) -> r { } fn main() { - error!(~"whatever"); + error2!("whatever"); do task::spawn { let _i = r(5); }; - fail!(); + fail2!(); } diff --git a/src/test/run-fail/rt-set-exit-status.rs b/src/test/run-fail/rt-set-exit-status.rs index 4f71cdc67e9c2..4dc1386d850de 100644 --- a/src/test/run-fail/rt-set-exit-status.rs +++ b/src/test/run-fail/rt-set-exit-status.rs @@ -13,7 +13,7 @@ use std::os; fn main() { - error!(~"whatever"); + error2!("whatever"); // 101 is the code the runtime uses on task failure and the value // compiletest expects run-fail tests to return. os::set_exit_status(101); diff --git a/src/test/run-fail/run-unexported-tests.rs b/src/test/run-fail/run-unexported-tests.rs index e9d3c41faa6cc..622e2e326e564 100644 --- a/src/test/run-fail/run-unexported-tests.rs +++ b/src/test/run-fail/run-unexported-tests.rs @@ -17,5 +17,5 @@ mod m { pub fn exported() { } #[test] - fn unexported() { fail!("runned an unexported test"); } + fn unexported() { fail2!("runned an unexported test"); } } diff --git a/src/test/run-fail/small-negative-indexing.rs b/src/test/run-fail/small-negative-indexing.rs index ee58f76fc99ee..a016af24451ae 100644 --- a/src/test/run-fail/small-negative-indexing.rs +++ b/src/test/run-fail/small-negative-indexing.rs @@ -15,5 +15,5 @@ use std::vec; fn main() { let v = vec::from_fn(1024u, {|n| n}); // this should trip a bounds check - error!(v[-1i8]); + error2!("{:?}", v[-1i8]); } diff --git a/src/test/run-fail/spawnfail.rs b/src/test/run-fail/spawnfail.rs index 122ea901805bb..dad8ead8d65a6 100644 --- a/src/test/run-fail/spawnfail.rs +++ b/src/test/run-fail/spawnfail.rs @@ -17,7 +17,7 @@ use std::task; // We don't want to see any invalid reads fn main() { fn f() { - fail!(); + fail2!(); } task::spawn(|| f() ); } diff --git a/src/test/run-fail/task-comm-recv-block.rs b/src/test/run-fail/task-comm-recv-block.rs index fb2d90e99cf19..840db545dec77 100644 --- a/src/test/run-fail/task-comm-recv-block.rs +++ b/src/test/run-fail/task-comm-recv-block.rs @@ -16,7 +16,7 @@ use std::task; fn goodfail() { task::deschedule(); - fail!("goodfail"); + fail2!("goodfail"); } fn main() { @@ -25,5 +25,5 @@ fn main() { // We shouldn't be able to get past this recv since there's no // message available let i: int = po.recv(); - fail!("badfail"); + fail2!("badfail"); } diff --git a/src/test/run-fail/tls-exit-status.rs b/src/test/run-fail/tls-exit-status.rs index 1858ceb283648..419d8c1320f91 100644 --- a/src/test/run-fail/tls-exit-status.rs +++ b/src/test/run-fail/tls-exit-status.rs @@ -15,5 +15,5 @@ use std::os; fn main() { os::args(); - fail!("please have a nonzero exit status"); + fail2!("please have a nonzero exit status"); } diff --git a/src/test/run-fail/unique-fail.rs b/src/test/run-fail/unique-fail.rs index 86fde5b7f9781..d1d816f7f7932 100644 --- a/src/test/run-fail/unique-fail.rs +++ b/src/test/run-fail/unique-fail.rs @@ -9,4 +9,4 @@ // except according to those terms. // error-pattern: fail -fn main() { ~fail!(); } +fn main() { ~fail2!(); } diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs index 38a72353a1e39..0050002a22e8e 100644 --- a/src/test/run-fail/unwind-box-fn-unique.rs +++ b/src/test/run-fail/unwind-box-fn-unique.rs @@ -11,14 +11,14 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { let y = ~0; let x: @~fn() = @(|| { - error!(y.clone()); + error2!("{:?}", y.clone()); }); failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index c8a3e77a18c46..02d2218f536d4 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -13,7 +13,7 @@ use std::cast; fn failfn() { - fail!(); + fail2!(); } struct r { @@ -41,6 +41,6 @@ fn main() { cast::forget(i1); let x = @r(i1p); failfn(); - error!(x); + error2!("{:?}", x); } } diff --git a/src/test/run-fail/unwind-box-str.rs b/src/test/run-fail/unwind-box-str.rs index 213220164f102..2086a23c6af7e 100644 --- a/src/test/run-fail/unwind-box-str.rs +++ b/src/test/run-fail/unwind-box-str.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { let x = @~"hi"; failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-trait.rs b/src/test/run-fail/unwind-box-trait.rs index 2ed3b39a44573..b8534483fb52e 100644 --- a/src/test/run-fail/unwind-box-trait.rs +++ b/src/test/run-fail/unwind-box-trait.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } trait i { @@ -25,5 +25,5 @@ impl i for ~int { fn main() { let x = @~0 as @i; failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-unique-unique.rs b/src/test/run-fail/unwind-box-unique-unique.rs index 12b00f0c14b9f..3abf5330e408f 100644 --- a/src/test/run-fail/unwind-box-unique-unique.rs +++ b/src/test/run-fail/unwind-box-unique-unique.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { let x = @~~0; failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-unique.rs b/src/test/run-fail/unwind-box-unique.rs index edc6ab9d984c7..5b3bf74f89e25 100644 --- a/src/test/run-fail/unwind-box-unique.rs +++ b/src/test/run-fail/unwind-box-unique.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { let x = @~0; failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-vec.rs b/src/test/run-fail/unwind-box-vec.rs index 0a579a8dbbfb2..3b767839a0dd6 100644 --- a/src/test/run-fail/unwind-box-vec.rs +++ b/src/test/run-fail/unwind-box-vec.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { let x = @~[0, 1, 2, 3, 4, 5]; failfn(); - error!(x); + error2!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box.rs b/src/test/run-fail/unwind-box.rs index 21308945253b5..0b144b6c1edd4 100644 --- a/src/test/run-fail/unwind-box.rs +++ b/src/test/run-fail/unwind-box.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/unwind-fail.rs b/src/test/run-fail/unwind-fail.rs index 4d4bc0d53eba2..df6c2be860f7a 100644 --- a/src/test/run-fail/unwind-fail.rs +++ b/src/test/run-fail/unwind-fail.rs @@ -12,5 +12,5 @@ fn main() { @0; - fail!(); + fail2!(); } diff --git a/src/test/run-fail/unwind-initializer-indirect.rs b/src/test/run-fail/unwind-initializer-indirect.rs index fd1ab88ff9647..8a71d1d34560a 100644 --- a/src/test/run-fail/unwind-initializer-indirect.rs +++ b/src/test/run-fail/unwind-initializer-indirect.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> @int { fail!(); } +fn f() -> @int { fail2!(); } fn main() { let _a: @int = f(); diff --git a/src/test/run-fail/unwind-initializer.rs b/src/test/run-fail/unwind-initializer.rs index 0d1584f3dc8db..a4161ad424b17 100644 --- a/src/test/run-fail/unwind-initializer.rs +++ b/src/test/run-fail/unwind-initializer.rs @@ -12,6 +12,6 @@ fn main() { let _a: @int = { - fail!(); + fail2!(); }; } diff --git a/src/test/run-fail/unwind-interleaved.rs b/src/test/run-fail/unwind-interleaved.rs index 365204d5c9e4d..cfd8d555c2e8b 100644 --- a/src/test/run-fail/unwind-interleaved.rs +++ b/src/test/run-fail/unwind-interleaved.rs @@ -12,7 +12,7 @@ fn a() { } -fn b() { fail!(); } +fn b() { fail2!(); } fn main() { let _x = ~[0]; diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs index 51c6cb3adf318..4c9125bde99c8 100644 --- a/src/test/run-fail/unwind-iter.rs +++ b/src/test/run-fail/unwind-iter.rs @@ -14,7 +14,7 @@ #[allow(unused_variable)]; fn x(it: &fn(int)) { - fail!(); + fail2!(); it(0); } diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs index 17936df6959f2..11fbcfaff78c5 100644 --- a/src/test/run-fail/unwind-iter2.rs +++ b/src/test/run-fail/unwind-iter2.rs @@ -16,5 +16,5 @@ fn x(it: &fn(int)) { } fn main() { - x(|_x| fail!() ); + x(|_x| fail2!() ); } diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index 65d9fce5ff5dc..4857a38519c19 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -22,7 +22,7 @@ fn main() { let cheese = cheese.clone(); let f: &fn() = || { let _chew = mush + cheese; - fail!("so yummy") + fail2!("so yummy") }; f(); }); diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs index a9761017c73f5..c017ddc49f0f8 100644 --- a/src/test/run-fail/unwind-match.rs +++ b/src/test/run-fail/unwind-match.rs @@ -15,7 +15,7 @@ fn test_box() { } fn test_str() { let res = match false { true => { ~"happy" }, - _ => fail!("non-exhaustive match failure") }; + _ => fail2!("non-exhaustive match failure") }; assert_eq!(res, ~"happy"); } fn main() { diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index d215927c7d03f..dc5e5a3b9956f 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -19,7 +19,7 @@ fn main() { arr.push(@~"key stuff"); map.insert(arr.clone(), arr + &[@~"value stuff"]); if arr.len() == 5 { - fail!(); + fail2!(); } } } diff --git a/src/test/run-fail/unwind-move.rs b/src/test/run-fail/unwind-move.rs index 8f1b34d17cd99..626228cd22595 100644 --- a/src/test/run-fail/unwind-move.rs +++ b/src/test/run-fail/unwind-move.rs @@ -10,7 +10,7 @@ // error-pattern:fail fn f(_a: @int) { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/unwind-nested.rs b/src/test/run-fail/unwind-nested.rs index f8a63be2e9ad0..ae543c9a88c42 100644 --- a/src/test/run-fail/unwind-nested.rs +++ b/src/test/run-fail/unwind-nested.rs @@ -15,7 +15,7 @@ fn main() { { let _b = @0; { - fail!(); + fail2!(); } } } diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs index 88f71a5ed7cea..933bd62bc0cae 100644 --- a/src/test/run-fail/unwind-partial-box.rs +++ b/src/test/run-fail/unwind-partial-box.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail!(); } +fn f() -> ~[int] { fail2!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. diff --git a/src/test/run-fail/unwind-partial-unique.rs b/src/test/run-fail/unwind-partial-unique.rs index e9bbbd46c03ff..b627103485ca2 100644 --- a/src/test/run-fail/unwind-partial-unique.rs +++ b/src/test/run-fail/unwind-partial-unique.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail!(); } +fn f() -> ~[int] { fail2!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs index 3d6d26937dbac..348989659067a 100644 --- a/src/test/run-fail/unwind-partial-vec.rs +++ b/src/test/run-fail/unwind-partial-vec.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail!(); } +fn f() -> ~[int] { fail2!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. diff --git a/src/test/run-fail/unwind-rec.rs b/src/test/run-fail/unwind-rec.rs index 016654500b4ac..3858fe3923f1b 100644 --- a/src/test/run-fail/unwind-rec.rs +++ b/src/test/run-fail/unwind-rec.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn build() -> ~[int] { - fail!(); + fail2!(); } struct Blk { node: ~[int] } diff --git a/src/test/run-fail/unwind-rec2.rs b/src/test/run-fail/unwind-rec2.rs index 49a35181a8b2e..a5aaf46b4b2ef 100644 --- a/src/test/run-fail/unwind-rec2.rs +++ b/src/test/run-fail/unwind-rec2.rs @@ -15,7 +15,7 @@ fn build1() -> ~[int] { } fn build2() -> ~[int] { - fail!(); + fail2!(); } struct Blk { node: ~[int], span: ~[int] } diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs index 6526455b8e2e0..5b9917979694d 100644 --- a/src/test/run-fail/unwind-resource-fail.rs +++ b/src/test/run-fail/unwind-resource-fail.rs @@ -15,7 +15,7 @@ struct r { } impl Drop for r { - fn drop(&mut self) { fail!("squirrel") } + fn drop(&mut self) { fail2!("squirrel") } } fn r(i: int) -> r { r { i: i } } diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs index 67e1d0e8f92ac..652bf31dee405 100644 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ b/src/test/run-fail/unwind-resource-fail2.rs @@ -16,7 +16,7 @@ struct r { } impl Drop for r { - fn drop(&mut self) { fail!("wombat") } + fn drop(&mut self) { fail2!("wombat") } } fn r(i: int) -> r { r { i: i } } @@ -24,5 +24,5 @@ fn r(i: int) -> r { r { i: i } } fn main() { @0; let r = r(0); - fail!(); + fail2!(); } diff --git a/src/test/run-fail/unwind-resource-fail3.rs b/src/test/run-fail/unwind-resource-fail3.rs index 231f6e7b7d579..92b10cef31998 100644 --- a/src/test/run-fail/unwind-resource-fail3.rs +++ b/src/test/run-fail/unwind-resource-fail3.rs @@ -20,7 +20,7 @@ fn faily_box(i: @int) -> faily_box { faily_box { i: i } } #[unsafe_destructor] impl Drop for faily_box { fn drop(&mut self) { - fail!("quux"); + fail2!("quux"); } } diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs index 8249807af74ad..ab28cb8a9ee44 100644 --- a/src/test/run-fail/unwind-stacked.rs +++ b/src/test/run-fail/unwind-stacked.rs @@ -12,7 +12,7 @@ fn f() { let _a = @0; - fail!(); + fail2!(); } fn g() { diff --git a/src/test/run-fail/unwind-tup.rs b/src/test/run-fail/unwind-tup.rs index 15fa3ceed5356..efb69b9f9576f 100644 --- a/src/test/run-fail/unwind-tup.rs +++ b/src/test/run-fail/unwind-tup.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn fold_local() -> @~[int]{ - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/unwind-tup2.rs b/src/test/run-fail/unwind-tup2.rs index 236ff8172207b..20d394bafac83 100644 --- a/src/test/run-fail/unwind-tup2.rs +++ b/src/test/run-fail/unwind-tup2.rs @@ -15,7 +15,7 @@ fn fold_local() -> @~[int]{ } fn fold_remote() -> @~[int]{ - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs index d5a06ffb9036b..d61a4927db8bc 100644 --- a/src/test/run-fail/unwind-uninitialized.rs +++ b/src/test/run-fail/unwind-uninitialized.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn f() { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/unwind-unique.rs b/src/test/run-fail/unwind-unique.rs index 53b2a55602c29..9ede24d28c486 100644 --- a/src/test/run-fail/unwind-unique.rs +++ b/src/test/run-fail/unwind-unique.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail!(); + fail2!(); } fn main() { diff --git a/src/test/run-fail/while-body-fails.rs b/src/test/run-fail/while-body-fails.rs index 32e1425b28c8a..c0a1033efe046 100644 --- a/src/test/run-fail/while-body-fails.rs +++ b/src/test/run-fail/while-body-fails.rs @@ -11,4 +11,4 @@ #[allow(while_true)]; // error-pattern:quux -fn main() { let _x: int = { while true { fail!("quux"); } ; 8 } ; } +fn main() { let _x: int = { while true { fail2!("quux"); } ; 8 } ; } diff --git a/src/test/run-fail/while-fail.rs b/src/test/run-fail/while-fail.rs index a0b437814fd8d..e42cb5e778cf2 100644 --- a/src/test/run-fail/while-fail.rs +++ b/src/test/run-fail/while-fail.rs @@ -12,5 +12,5 @@ // error-pattern:giraffe fn main() { - fail!({ while true { fail!("giraffe") }; "clandestine" }); + fail2!({ while true { fail2!("giraffe") }; "clandestine" }); } From 73c6c9109fb334edf159ad08f67cc2e66c7035a5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 29 Sep 2013 23:13:47 -0700 Subject: [PATCH 13/16] bench: Remove usage of fmt! --- src/test/bench/core-set.rs | 2 +- src/test/bench/core-std.rs | 4 ++-- src/test/bench/core-uint-to-str.rs | 2 +- src/test/bench/msgsend-pipes-shared.rs | 18 +++++++++--------- src/test/bench/msgsend-pipes.rs | 18 +++++++++--------- src/test/bench/shootout-chameneos-redux.rs | 6 +++--- src/test/bench/shootout-k-nucleotide-pipes.rs | 13 +++++++------ src/test/bench/shootout-pfib.rs | 8 ++++---- src/test/bench/std-smallintmap.rs | 8 ++++---- src/test/bench/sudoku.rs | 8 ++++---- src/test/bench/task-perf-alloc-unwind.rs | 8 ++++---- src/test/bench/task-perf-jargon-metal-smoke.rs | 2 +- src/test/bench/task-perf-linked-failure.rs | 12 ++++++------ 13 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index ead1128e99437..a4c07371f6780 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -128,7 +128,7 @@ fn write_header(header: &str) { } fn write_row(label: &str, value: float) { - io::stdout().write_str(fmt!("%30s %f s\n", label, value)); + io::stdout().write_str(format!("{:30s} {} s\n", label, value)); } fn write_results(label: &str, results: &Results) { diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 82c1b196c1257..fa2b74ef44c63 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -133,7 +133,7 @@ fn is_utf8_ascii() { for _ in range(0u, 20000) { v.push('b' as u8); if !str::is_utf8(v) { - fail!("is_utf8 failed"); + fail2!("is_utf8 failed"); } } } @@ -144,7 +144,7 @@ fn is_utf8_multibyte() { for _ in range(0u, 5000) { v.push_all(s.as_bytes()); if !str::is_utf8(v) { - fail!("is_utf8 failed"); + fail2!("is_utf8 failed"); } } } diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 6b1319aa0c90f..ef6610cd93a3f 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -25,6 +25,6 @@ fn main() { for i in range(0u, n) { let x = i.to_str(); - info!(x); + info2!("{}", x); } } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index af15acc153579..ba7682f5bbd4d 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -42,7 +42,7 @@ fn server(requests: &Port, responses: &Chan) { match requests.try_recv() { Some(get_count) => { responses.send(count.clone()); } Some(bytes(b)) => { - //error!("server: received %? bytes", b); + //error2!("server: received {:?} bytes", b); count += b; } None => { done = true; } @@ -50,7 +50,7 @@ fn server(requests: &Port, responses: &Chan) { } } responses.send(count); - //error!("server exiting"); + //error2!("server exiting"); } fn run(args: &[~str]) { @@ -70,10 +70,10 @@ fn run(args: &[~str]) { builder.future_result(|r| worker_results.push(r)); do builder.spawn { for _ in range(0u, size / workers) { - //error!("worker %?: sending %? bytes", i, num_bytes); + //error2!("worker {:?}: sending {:?} bytes", i, num_bytes); to_child.send(bytes(num_bytes)); } - //error!("worker %? exiting", i); + //error2!("worker {:?} exiting", i); } } do task::spawn || { @@ -84,16 +84,16 @@ fn run(args: &[~str]) { r.recv(); } - //error!("sending stop message"); + //error2!("sending stop message"); to_child.send(stop); move_out(to_child); let result = from_child.recv(); let end = extra::time::precise_time_s(); let elapsed = end - start; - io::stdout().write_str(fmt!("Count is %?\n", result)); - io::stdout().write_str(fmt!("Test took %? seconds\n", elapsed)); + io::stdout().write_str(format!("Count is {:?}\n", result)); + io::stdout().write_str(format!("Test took {:?} seconds\n", elapsed)); let thruput = ((size / workers * workers) as float) / (elapsed as float); - io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput)); + io::stdout().write_str(format!("Throughput={} per sec\n", thruput)); assert_eq!(result, num_bytes * size); } @@ -107,6 +107,6 @@ fn main() { args.clone() }; - info!("%?", args); + info2!("{:?}", args); run(args); } diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 3b095650b7ed9..1db73f9a95d12 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -37,7 +37,7 @@ fn server(requests: &Port, responses: &Chan) { match requests.try_recv() { Some(get_count) => { responses.send(count.clone()); } Some(bytes(b)) => { - //error!("server: received %? bytes", b); + //error2!("server: received {:?} bytes", b); count += b; } None => { done = true; } @@ -45,7 +45,7 @@ fn server(requests: &Port, responses: &Chan) { } } responses.send(count); - //error!("server exiting"); + //error2!("server exiting"); } fn run(args: &[~str]) { @@ -64,10 +64,10 @@ fn run(args: &[~str]) { builder.future_result(|r| worker_results.push(r)); do builder.spawn { for _ in range(0u, size / workers) { - //error!("worker %?: sending %? bytes", i, num_bytes); + //error2!("worker {:?}: sending {:?} bytes", i, num_bytes); to_child.send(bytes(num_bytes)); } - //error!("worker %? exiting", i); + //error2!("worker {:?} exiting", i); }; } do task::spawn || { @@ -78,16 +78,16 @@ fn run(args: &[~str]) { r.recv(); } - //error!("sending stop message"); + //error2!("sending stop message"); to_child.send(stop); move_out(to_child); let result = from_child.recv(); let end = extra::time::precise_time_s(); let elapsed = end - start; - io::stdout().write_str(fmt!("Count is %?\n", result)); - io::stdout().write_str(fmt!("Test took %? seconds\n", elapsed)); + io::stdout().write_str(format!("Count is {:?}\n", result)); + io::stdout().write_str(format!("Test took {:?} seconds\n", elapsed)); let thruput = ((size / workers * workers) as float) / (elapsed as float); - io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput)); + io::stdout().write_str(format!("Throughput={} per sec\n", thruput)); assert_eq!(result, num_bytes * size); } @@ -101,6 +101,6 @@ fn main() { args.clone() }; - info!("%?", args); + info2!("{:?}", args); run(args); } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index e4f395e5eca1b..c3296cbff9be1 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -66,7 +66,7 @@ fn show_digit(nn: uint) -> ~str { 7 => {~"seven"} 8 => {~"eight"} 9 => {~"nine"} - _ => {fail!("expected digits from 0 to 9...")} + _ => {fail2!("expected digits from 0 to 9...")} } } @@ -129,8 +129,8 @@ fn creature( } option::None => { // log creatures met and evil clones of self - let report = fmt!("%u %s", - creatures_met, show_number(evil_clones_met)); + let report = format!("{} {}", + creatures_met, show_number(evil_clones_met)); to_rendezvous_log.send(report); break; } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index f0bf7fc7a6b01..4c246bbe3f706 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -75,7 +75,8 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str { let b = str::raw::from_utf8(k); // FIXME: #4318 Instead of to_ascii and to_str_ascii, could use // to_ascii_move and to_str_move to not do a unnecessary copy. - buffer.push_str(fmt!("%s %0.3f\n", b.to_ascii().to_upper().to_str_ascii(), v)); + buffer.push_str(format!("{} {:0.3f}\n", + b.to_ascii().to_upper().to_str_ascii(), v)); } } @@ -142,11 +143,11 @@ fn make_sequence_processor(sz: uint, let buffer = match sz { 1u => { sort_and_fmt(&freqs, total) } 2u => { sort_and_fmt(&freqs, total) } - 3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), "GGT") } - 4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), "GGTA") } - 6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), "GGTATT") } - 12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), "GGTATTTTAATT") } - 18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), "GGTATTTTAATTTATAGT") } + 3u => { format!("{}\t{}", find(&freqs, ~"GGT"), "GGT") } + 4u => { format!("{}\t{}", find(&freqs, ~"GGTA"), "GGTA") } + 6u => { format!("{}\t{}", find(&freqs, ~"GGTATT"), "GGTATT") } + 12u => { format!("{}\t{}", find(&freqs, ~"GGTATTTTAATT"), "GGTATTTTAATT") } + 18u => { format!("{}\t{}", find(&freqs, ~"GGTATTTTAATTTATAGT"), "GGTATTTTAATTTATAGT") } _ => { ~"" } }; diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 0896682b32225..5a1f735001028 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -66,7 +66,7 @@ fn parse_opts(argv: ~[~str]) -> Config { Ok(ref m) => { return Config {stress: m.opt_present("stress")} } - Err(_) => { fail!(); } + Err(_) => { fail2!(); } } } @@ -76,7 +76,7 @@ fn stress_task(id: int) { let n = 15; assert_eq!(fib(n), fib(n)); i += 1; - error!("%d: Completed %d iterations", id, i); + error2!("{}: Completed {} iterations", id, i); } } @@ -123,8 +123,8 @@ fn main() { let elapsed = stop - start; - out.write_line(fmt!("%d\t%d\t%s", n, fibn, - elapsed.to_str())); + out.write_line(format!("{}\t{}\t{}", n, fibn, + elapsed.to_str())); } } } diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index 6940c97d76e34..2e812ba2d0958 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -59,8 +59,8 @@ fn main() { let maxf = max as float; - io::stdout().write_str(fmt!("insert(): %? seconds\n", checkf)); - io::stdout().write_str(fmt!(" : %f op/sec\n", maxf/checkf)); - io::stdout().write_str(fmt!("get() : %? seconds\n", appendf)); - io::stdout().write_str(fmt!(" : %f op/sec\n", maxf/appendf)); + io::stdout().write_str(format!("insert(): {:?} seconds\n", checkf)); + io::stdout().write_str(format!(" : {} op/sec\n", maxf/checkf)); + io::stdout().write_str(format!("get() : {:?} seconds\n", appendf)); + io::stdout().write_str(format!(" : {} op/sec\n", maxf/appendf)); } diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 2c5b434a4760f..91d9c9656af96 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -79,7 +79,7 @@ impl Sudoku { g[row][col] = from_str::(comps[2]).unwrap() as u8; } else { - fail!("Invalid sudoku file"); + fail2!("Invalid sudoku file"); } } return Sudoku::new(g) @@ -87,9 +87,9 @@ impl Sudoku { pub fn write(&self, writer: @io::Writer) { for row in range(0u8, 9u8) { - writer.write_str(fmt!("%u", self.grid[row][0] as uint)); + writer.write_str(format!("{}", self.grid[row][0] as uint)); for col in range(1u8, 9u8) { - writer.write_str(fmt!(" %u", self.grid[row][col] as uint)); + writer.write_str(format!(" {}", self.grid[row][col] as uint)); } writer.write_char('\n'); } @@ -117,7 +117,7 @@ impl Sudoku { ptr = ptr + 1u; } else { // no: redo this field aft recoloring pred; unless there is none - if ptr == 0u { fail!("No solution found for this sudoku"); } + if ptr == 0u { fail2!("No solution found for this sudoku"); } ptr = ptr - 1u; } } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 991c102e9f0b0..639cbd05cbf7a 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -31,11 +31,11 @@ fn main() { fn run(repeat: int, depth: int) { for _ in range(0, repeat) { - info!("starting %.4f", precise_time_s()); + info2!("starting {:.4f}", precise_time_s()); do task::try { recurse_or_fail(depth, None) }; - info!("stopping %.4f", precise_time_s()); + info2!("stopping {:.4f}", precise_time_s()); } } @@ -68,8 +68,8 @@ fn r(l: @nillist) -> r { fn recurse_or_fail(depth: int, st: Option) { if depth == 0 { - info!("unwinding %.4f", precise_time_s()); - fail!(); + info2!("unwinding {:.4f}", precise_time_s()); + fail2!(); } else { let depth = depth - 1; diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 0827f7d34475b..ac028686f08e1 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -54,6 +54,6 @@ fn main() { let (p,c) = comm::stream(); child_generation(from_str::(args[1]).unwrap(), c); if p.try_recv().is_none() { - fail!("it happened when we slumbered"); + fail2!("it happened when we slumbered"); } } diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index 5aeba3f415da3..b029d9e4fc844 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -43,13 +43,13 @@ fn grandchild_group(num_tasks: uint) { p.recv(); // block forever } } - error!("Grandchild group getting started"); + error2!("Grandchild group getting started"); for _ in range(0, num_tasks) { // Make sure all above children are fully spawned; i.e., enlisted in // their ancestor groups. po.recv(); } - error!("Grandchild group ready to go."); + error2!("Grandchild group ready to go."); // Master grandchild task exits early. } @@ -59,7 +59,7 @@ fn spawn_supervised_blocking(myname: &str, f: ~fn()) { builder.future_result(|r| res = Some(r)); builder.supervised(); builder.spawn(f); - error!("%s group waiting", myname); + error2!("{} group waiting", myname); let x = res.unwrap().recv(); assert_eq!(x, task::Success); } @@ -85,11 +85,11 @@ fn main() { grandchild_group(num_tasks); } // When grandchild group is ready to go, make the middle group exit. - error!("Middle group wakes up and exits"); + error2!("Middle group wakes up and exits"); } // Grandparent group waits for middle group to be gone, then fails - error!("Grandparent group wakes up and fails"); - fail!(); + error2!("Grandparent group wakes up and fails"); + fail2!(); }; assert!(x.is_err()); } From 9ce31f6dd9ea52c857131fb4a10465e0f5756c67 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Sep 2013 10:32:28 -0700 Subject: [PATCH 14/16] tutorial: Remove usage of fmt! --- doc/rust.md | 46 ++++++++++++++++++++------------------ doc/tutorial-conditions.md | 14 ++++++------ doc/tutorial-macros.md | 6 ++--- doc/tutorial-tasks.md | 11 +++++---- doc/tutorial.md | 37 ++++++++++++++++-------------- 5 files changed, 59 insertions(+), 55 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index e941e4f7956d7..0ae03198f3639 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -683,15 +683,15 @@ mod math { type complex = (f64, f64); fn sin(f: f64) -> f64 { ... -# fail!(); +# fail2!(); } fn cos(f: f64) -> f64 { ... -# fail!(); +# fail2!(); } fn tan(f: f64) -> f64 { ... -# fail!(); +# fail2!(); } } ~~~~~~~~ @@ -817,12 +817,14 @@ An example of `use` declarations: use std::num::sin; use std::option::{Some, None}; +# fn foo(_: T){} + fn main() { - // Equivalent to 'info!(std::num::sin(1.0));' - info!(sin(1.0)); + // Equivalent to 'std::num::sin(1.0);' + sin(1.0); - // Equivalent to 'info!(~[std::option::Some(1.0), std::option::None]);' - info!(~[Some(1.0), None]); + // Equivalent to 'foo(~[std::option::Some(1.0), std::option::None]);' + foo(~[Some(1.0), None]); } ~~~~ @@ -1040,8 +1042,8 @@ output slot type would normally be. For example: ~~~~ fn my_err(s: &str) -> ! { - info!(s); - fail!(); + info2!("{}", s); + fail2!(); } ~~~~ @@ -1059,7 +1061,7 @@ were declared without the `!` annotation, the following code would not typecheck: ~~~~ -# fn my_err(s: &str) -> ! { fail!() } +# fn my_err(s: &str) -> ! { fail2!() } fn f(i: int) -> int { if i == 42 { @@ -2382,7 +2384,7 @@ fn ten_times(f: &fn(int)) { } } -ten_times(|j| println(fmt!("hello, %d", j))); +ten_times(|j| println!("hello, {}", j)); ~~~~ @@ -2594,9 +2596,9 @@ enum List { Nil, Cons(X, @List) } let x: List = Cons(10, @Cons(11, @Nil)); match x { - Cons(_, @Nil) => fail!("singleton list"), + Cons(_, @Nil) => fail2!("singleton list"), Cons(*) => return, - Nil => fail!("empty list") + Nil => fail2!("empty list") } ~~~~ @@ -2633,7 +2635,7 @@ match x { return; } _ => { - fail!(); + fail2!(); } } ~~~~ @@ -2687,7 +2689,7 @@ guard may refer to the variables bound within the pattern they follow. let message = match maybe_digit { Some(x) if x < 10 => process_digit(x), Some(x) => process_other(x), - None => fail!() + None => fail2!() }; ~~~~ @@ -3472,10 +3474,10 @@ that demonstrates all four of them: ```rust fn main() { - error!("This is an error log") - warn!("This is a warn log") - info!("this is an info log") - debug!("This is a debug log") + error2!("This is an error log") + warn2!("This is a warn log") + info2!("this is an info log") + debug2!("This is a debug log") } ``` @@ -3483,9 +3485,9 @@ These four log levels correspond to levels 1-4, as controlled by `RUST_LOG`: ```bash $ RUST_LOG=rust=3 ./rust -rust: ~"\"This is an error log\"" -rust: ~"\"This is a warn log\"" -rust: ~"\"this is an info log\"" +This is an error log +This is a warn log +this is an info log ``` # Appendix: Rationales and design tradeoffs diff --git a/doc/tutorial-conditions.md b/doc/tutorial-conditions.md index bdf3c6089f885..726b8bb2b8001 100644 --- a/doc/tutorial-conditions.md +++ b/doc/tutorial-conditions.md @@ -66,7 +66,7 @@ use std::int; fn main() { let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } @@ -281,7 +281,7 @@ fn main() { // The protected logic. let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } }; @@ -387,7 +387,7 @@ condition! { fn main() { let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } @@ -462,7 +462,7 @@ fn main() { // The protected logic. let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } @@ -540,7 +540,7 @@ fn main() { // The protected logic. let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } @@ -636,7 +636,7 @@ fn main() { // The protected logic. let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } @@ -766,7 +766,7 @@ fn main() { // The protected logic. let pairs = read_int_pairs(); for &(a,b) in pairs.iter() { - println(fmt!("%4.4d, %4.4d", a, b)); + println!("{:4.4d}, {:4.4d}", a, b); } } diff --git a/doc/tutorial-macros.md b/doc/tutorial-macros.md index f1f4ade0542d5..a70b29f910058 100644 --- a/doc/tutorial-macros.md +++ b/doc/tutorial-macros.md @@ -226,7 +226,7 @@ match x { // complicated stuff goes here return result + val; }, - _ => fail!("Didn't get good_2") + _ => fail2!("Didn't get good_2") } } _ => return 0 // default value @@ -268,7 +268,7 @@ macro_rules! biased_match ( biased_match!((x) ~ (good_1(g1, val)) else { return 0 }; binds g1, val ) biased_match!((g1.body) ~ (good_2(result) ) - else { fail!("Didn't get good_2") }; + else { fail2!("Didn't get good_2") }; binds result ) // complicated stuff goes here return result + val; @@ -369,7 +369,7 @@ macro_rules! biased_match ( # fn f(x: t1) -> uint { biased_match!( (x) ~ (good_1(g1, val)) else { return 0 }; - (g1.body) ~ (good_2(result) ) else { fail!("Didn't get good_2") }; + (g1.body) ~ (good_2(result) ) else { fail2!("Didn't get good_2") }; binds val, result ) // complicated stuff goes here return result + val; diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index 3ab44cb544167..09d3469871f65 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -99,7 +99,6 @@ execution. Like any closure, the function passed to `spawn` may capture an environment that it carries across tasks. ~~~ -# use std::io::println; # use std::task::spawn; # fn generate_task_number() -> int { 0 } // Generate some state locally @@ -107,7 +106,7 @@ let child_task_number = generate_task_number(); do spawn { // Capture it in the remote task - println(fmt!("I am child number %d", child_task_number)); + println!("I am child number {}", child_task_number); } ~~~ @@ -282,7 +281,7 @@ fn fib(n: uint) -> uint { let mut delayed_fib = extra::future::Future::spawn (|| fib(50) ); make_a_sandwich(); -println(fmt!("fib(50) = %?", delayed_fib.get())) +println!("fib(50) = {:?}", delayed_fib.get()) ~~~ The call to `future::spawn` returns immediately a `future` object regardless of how long it @@ -310,7 +309,7 @@ fn main() { for ft in futures.mut_iter() { final_res += ft.get(); } - println(fmt!("π^2/6 is not far from : %?", final_res)); + println!("π^2/6 is not far from : {}", final_res); } ~~~ @@ -338,7 +337,7 @@ fn pnorm(nums: &~[float], p: uint) -> float { fn main() { let numbers = vec::from_fn(1000000, |_| rand::random::()); - println(fmt!("Inf-norm = %?", *numbers.iter().max().unwrap())); + println!("Inf-norm = {}", *numbers.iter().max().unwrap()); let numbers_arc = Arc::new(numbers); @@ -349,7 +348,7 @@ fn main() { do spawn { let local_arc : Arc<~[float]> = port.recv(); let task_numbers = local_arc.get(); - println(fmt!("%u-norm = %?", num, pnorm(task_numbers, num))); + println!("{}-norm = {}", num, pnorm(task_numbers, num)); } } } diff --git a/doc/tutorial.md b/doc/tutorial.md index 1c56257ee9f46..f9109fcb8ea39 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -225,7 +225,7 @@ let hi = "hi"; let mut count = 0; while count < 10 { - println(fmt!("count: %?", count)); + println!("count: {}", count); count += 1; } ~~~~ @@ -388,23 +388,26 @@ assert!(y == 4u); but are instead provided by the libraries. To make it clear to the reader when a name refers to a syntax extension, the names of all syntax extensions end with `!`. The standard library defines a few syntax extensions, the most -useful of which is `fmt!`, a `sprintf`-style text formatter that you will -often see in examples. +useful of which is [`format!`][fmt], a `sprintf`-like text formatter that you +will often see in examples, and its related family of macros: `print!`, +`println!`, and `write!`. -`fmt!` supports most of the directives that [printf][pf] supports, but unlike -printf, will give you a compile-time error when the types of the directives -don't match the types of the arguments. +`format!` draws syntax from python, but contains many of the same principles +that [printf][pf] has. Unlike printf, `format!` will give you a compile-time +error when the types of the directives don't match the types of the arguments. ~~~~ # let mystery_object = (); -println(fmt!("%s is %d", "the answer", 43)); +// {} will print the "default format" of a type +println!("{} is {}", "the answer", 43); -// %? will conveniently print any type -println(fmt!("what is this thing: %?", mystery_object)); +// {:?} will conveniently print any type +println!("what is this thing: {:?}", mystery_object); ~~~~ [pf]: http://en.cppreference.com/w/cpp/io/c/fprintf +[fmt]: http://static.rust-lang.org/doc/master/std/fmt/index.html You can define your own syntax extensions with the macro system. For details, see the [macro tutorial][macros]. @@ -737,7 +740,7 @@ fn area(sh: Shape) -> float { match sh { Circle { radius: radius, _ } => float::consts::pi * square(radius), Rectangle { top_left: top_left, bottom_right: bottom_right } => { - (bottom_right.x - top_left.x) * (top_left.y - bottom_right.y) + (bottom_right.x - top_left.x) * (top_left.y - bottom_right.y) } } } @@ -753,7 +756,7 @@ unit, `()`, as the empty tuple if you like). ~~~~ let mytup: (int, int, float) = (10, 20, 30.0); match mytup { - (a, b, c) => info!(a + b + (c as int)) + (a, b, c) => info2!("{}", a + b + (c as int)) } ~~~~ @@ -769,7 +772,7 @@ For example: struct MyTup(int, int, float); let mytup: MyTup = MyTup(10, 20, 30.0); match mytup { - MyTup(a, b, c) => info!(a + b + (c as int)) + MyTup(a, b, c) => info2!("{}", a + b + (c as int)) } ~~~~ @@ -1238,7 +1241,7 @@ something silly like ~~~ # struct Point { x: float, y: float } let point = &@~Point { x: 10f, y: 20f }; -println(fmt!("%f", point.x)); +println!("{:f}", point.x); ~~~ The indexing operator (`[]`) also auto-dereferences. @@ -1443,7 +1446,7 @@ the enclosing scope. fn call_closure_with_ten(b: &fn(int)) { b(10); } let captured_var = 20; -let closure = |arg| println(fmt!("captured_var=%d, arg=%d", captured_var, arg)); +let closure = |arg| println!("captured_var={}, arg={}", captured_var, arg); call_closure_with_ten(closure); ~~~~ @@ -1566,7 +1569,7 @@ arguments. use std::task::spawn; do spawn() || { - debug!("I'm a task, whatever"); + debug2!("I'm a task, whatever"); } ~~~~ @@ -1578,7 +1581,7 @@ may be omitted from `do` expressions. use std::task::spawn; do spawn { - debug!("Kablam!"); + debug2!("Kablam!"); } ~~~~ @@ -1916,7 +1919,7 @@ and `~str`. ~~~~ # trait Printable { fn print(&self); } impl Printable for int { - fn print(&self) { println(fmt!("%d", *self)) } + fn print(&self) { println!("{}", *self) } } impl Printable for ~str { From 1f52cf439bec551cd88010fa6d9bcdf681a8b3af Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Sep 2013 10:46:00 -0700 Subject: [PATCH 15/16] pretty: Remove usage of fmt! --- src/test/pretty/block-comment-wchar.pp | 2 +- src/test/pretty/block-comment-wchar.rs | 2 +- src/test/pretty/issue-929.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index 805aca129e999..d727f45e316bb 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -110,6 +110,6 @@ '\u2028', '\u2029', '\u202F', '\u205F', '\u3000']; for c in chars.iter() { let ws = c.is_whitespace(); - println(fmt!("%? %?" , c , ws)); + println!("{:?} {:?}" , c , ws); } } diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs index f09a7c1428c95..abe4546d69fec 100644 --- a/src/test/pretty/block-comment-wchar.rs +++ b/src/test/pretty/block-comment-wchar.rs @@ -104,6 +104,6 @@ fn main() { '\u2028', '\u2029', '\u202F', '\u205F', '\u3000']; for c in chars.iter() { let ws = c.is_whitespace(); - println(fmt!("%? %?", c , ws)); + println!("{:?} {:?}", c , ws); } } diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs index 636fac82b6b00..a82a8ec41c75c 100644 --- a/src/test/pretty/issue-929.rs +++ b/src/test/pretty/issue-929.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f() { if (1 == fail!()) { } else { } } +fn f() { if (1 == fail2!()) { } else { } } fn main() { } From dec37051dd01b3faf921163a5d8370223ff77682 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Sep 2013 23:21:54 -0700 Subject: [PATCH 16/16] Merge fall out of removing fmt! --- src/libstd/os.rs | 8 ++++---- src/test/run-pass/issue-9446.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 6d56aab3ec9d4..7b9bb249a3cc4 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1164,7 +1164,7 @@ pub fn last_os_error() -> ~str { len as DWORD, ptr::null()); if res == 0 { - fail2!("[%?] FormatMessage failure", errno()); + fail2!("[{}] FormatMessage failure", errno()); } } @@ -1596,15 +1596,15 @@ impl Drop for MemoryMap { if libc::VirtualFree(self.data as *mut c_void, self.len, libc::MEM_RELEASE) == FALSE { - error!(format!("VirtualFree failed: {}", errno())); + error2!("VirtualFree failed: {}", errno()); } }, MapFile(mapping) => { if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE { - error!(format!("UnmapViewOfFile failed: {}", errno())); + error2!("UnmapViewOfFile failed: {}", errno()); } if libc::CloseHandle(mapping as HANDLE) == FALSE { - error!(format!("CloseHandle failed: {}", errno())); + error2!("CloseHandle failed: {}", errno()); } } } diff --git a/src/test/run-pass/issue-9446.rs b/src/test/run-pass/issue-9446.rs index e97960b3f0209..542d1e611ac64 100644 --- a/src/test/run-pass/issue-9446.rs +++ b/src/test/run-pass/issue-9446.rs @@ -16,7 +16,7 @@ impl Wrapper { } pub fn say_hi(&self) { - println(fmt!("hello %s", **self)); + println!("hello {}", **self); } }