From daf5f5a4d10513ff42e79fa7ef8819b170f3a13d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 21 Oct 2013 13:08:31 -0700 Subject: Drop the '2' suffix from logging macros Who doesn't like a massive renaming? --- src/libstd/at_vec.rs | 2 +- src/libstd/c_str.rs | 8 ++--- src/libstd/cell.rs | 4 +-- src/libstd/char.rs | 6 ++-- src/libstd/cleanup.rs | 2 +- src/libstd/condition.rs | 38 ++++++++++----------- src/libstd/either.rs | 4 +-- src/libstd/hash.rs | 6 ++-- src/libstd/hashmap.rs | 16 ++++----- src/libstd/io.rs | 34 +++++++++---------- src/libstd/iter.rs | 12 +++---- src/libstd/local_data.rs | 16 ++++----- src/libstd/num/f32.rs | 2 +- src/libstd/num/f64.rs | 2 +- src/libstd/num/strconv.rs | 10 +++--- src/libstd/option.rs | 12 +++---- src/libstd/os.rs | 68 +++++++++++++++++++------------------- src/libstd/path/mod.rs | 6 ++-- src/libstd/ptr.rs | 14 ++++---- src/libstd/rand/mod.rs | 10 +++--- src/libstd/rand/reader.rs | 4 +-- src/libstd/repr.rs | 8 ++--- src/libstd/result.rs | 12 +++---- src/libstd/rt/args.rs | 6 ++-- src/libstd/rt/comm.rs | 6 ++-- src/libstd/rt/crate_map.rs | 2 +- src/libstd/rt/io/comm_adapters.rs | 22 ++++++------ src/libstd/rt/io/extensions.rs | 2 +- src/libstd/rt/io/file.rs | 18 +++++----- 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 | 4 +-- src/libstd/rt/io/native/process.rs | 40 +++++++++++----------- src/libstd/rt/io/net/tcp.rs | 6 ++-- src/libstd/rt/io/net/udp.rs | 28 ++++++++-------- src/libstd/rt/io/net/unix.rs | 16 ++++----- src/libstd/rt/io/pipe.rs | 4 +-- src/libstd/rt/kill.rs | 8 ++--- src/libstd/rt/sched.rs | 4 +-- src/libstd/rt/task.rs | 6 ++-- src/libstd/rt/test.rs | 6 ++-- src/libstd/rt/uv/file.rs | 2 +- src/libstd/rt/uv/net.rs | 2 +- src/libstd/run.rs | 2 +- src/libstd/select.rs | 6 ++-- src/libstd/str.rs | 12 +++---- src/libstd/task/mod.rs | 54 +++++++++++++++--------------- src/libstd/task/spawn.rs | 12 +++---- src/libstd/trie.rs | 4 +-- src/libstd/unstable/dynamic_lib.rs | 10 +++--- src/libstd/unstable/finally.rs | 2 +- src/libstd/unstable/sync.rs | 6 ++-- src/libstd/vec.rs | 32 +++++++++--------- 54 files changed, 321 insertions(+), 321 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index 8607710edc3..ee0b9b0df0b 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -238,7 +238,7 @@ pub mod raw { let alloc = n * (*ty).size; let total_size = alloc + mem::size_of::>(); if alloc / (*ty).size != n || total_size < alloc { - fail2!("vector size is too large: {}", n); + fail!("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 8118907322b..acfa02a4def 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() { fail2!("CString is null!"); } + if self.buf.is_null() { fail!("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() { fail2!("CString is null!"); } + if self.buf.is_null() { fail!("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() { fail2!("CString is null!"); } + if self.buf.is_null() { fail!("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() { - fail2!("failed to allocate memory!"); + fail!("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 4bbb0a5935a..a1459b780df 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() { - fail2!("attempt to take an empty cell"); + fail!("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() { - fail2!("attempt to put a value back into a full cell"); + fail!("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 54613adf3fe..643498f000a 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 { - fail2!("to_digit: radix {} is to high (maximum 36)", radix); + fail!("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 { - fail2!("from_digit: radix {} is to high (maximum 36)", num); + fail!("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, - _ => fail2!("invalid character!"), + _ => fail!("invalid character!"), } } diff --git a/src/libstd/cleanup.rs b/src/libstd/cleanup.rs index a8c4d9fdca3..a9070a7a7a2 100644 --- a/src/libstd/cleanup.rs +++ b/src/libstd/cleanup.rs @@ -123,7 +123,7 @@ pub unsafe fn annihilate() { if debug_mem() { // We do logging here w/o allocation. - debug2!("annihilator stats:\n \ + debug!("annihilator stats:\n \ total boxes: {}\n \ unique boxes: {}\n \ bytes freed: {}", diff --git a/src/libstd/condition.rs b/src/libstd/condition.rs index 7828fa09d97..cb9552b189c 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 `fail2!()` and will terminate. +the task invokes `fail!()` and will terminate. ## More Info @@ -128,7 +128,7 @@ impl Condition { /// function will not return. pub fn raise(&self, t: T) -> U { let msg = format!("Unhandled condition: {}: {:?}", self.name, t); - self.raise_default(t, || fail2!("{}", msg.clone())) + self.raise_default(t, || fail!("{}", 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 => { - debug2!("Condition.raise: found no handler"); + debug!("Condition.raise: found no handler"); default() } Some(handler) => { - debug2!("Condition.raise: found handler"); + debug!("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 }; - debug2!("Trap: pushing handler to TLS"); + debug!("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) { - debug2!("Guard: popping handler from TLS"); + debug!("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) { - debug2!("trouble: raising condition"); + debug!("trouble: raising condition"); let j = sadness::cond.raise(i); - debug2!("trouble: handler recovered with {}", j); + debug!("trouble: handler recovered with {}", j); } fn nested_trap_test_inner() { let mut inner_trapped = false; do sadness::cond.trap(|_j| { - debug2!("nested_trap_test_inner: in handler"); + debug!("nested_trap_test_inner: in handler"); inner_trapped = true; 0 }).inside { - debug2!("nested_trap_test_inner: in protected block"); + debug!("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| { - debug2!("nested_trap_test_outer: in handler"); + debug!("nested_trap_test_outer: in handler"); outer_trapped = true; 0 }).inside { - debug2!("nested_guard_test_outer: in protected block"); + debug!("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| { - debug2!("nested_reraise_trap_test_inner: in handler"); + debug!("nested_reraise_trap_test_inner: in handler"); inner_trapped = true; let i = 10; - debug2!("nested_reraise_trap_test_inner: handler re-raising"); + debug!("nested_reraise_trap_test_inner: handler re-raising"); sadness::cond.raise(i) }).inside { - debug2!("nested_reraise_trap_test_inner: in protected block"); + debug!("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| { - debug2!("nested_reraise_trap_test_outer: in handler"); + debug!("nested_reraise_trap_test_outer: in handler"); outer_trapped = true; 0 }).inside { - debug2!("nested_reraise_trap_test_outer: in protected block"); + debug!("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| { - debug2!("test_default: in handler"); + debug!("test_default: in handler"); sadness::cond.raise_default(j, || { trapped=true; 5 }) }).inside { - debug2!("test_default: in protected block"); + debug!("test_default: in protected block"); trouble(1); } diff --git a/src/libstd/either.rs b/src/libstd/either.rs index 657212fc692..262cdaed492 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(_) => fail2!("{}", reason.to_owned()) + Right(_) => fail!("{}", reason.to_owned()) } } @@ -94,7 +94,7 @@ impl Either { pub fn expect_right(self, reason: &str) -> R { match self { Right(x) => x, - Left(_) => fail2!("{}", reason.to_owned()) + Left(_) => fail!("{}", reason.to_owned()) } } diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index d63acb74acd..ed7fc9eb1d9 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -493,10 +493,10 @@ mod tests { } while t < 64 { - debug2!("siphash test {}", t); + debug!("siphash test {}", t); let vec = u8to64_le!(vecs[t], 0); let out = Bytes(buf.as_slice()).hash_keyed(k0, k1); - debug2!("got {:?}, expected {:?}", out, vec); + debug!("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]); - debug2!("{}: ({}) => inc={} full={}", t, v, i, f); + debug!("{}: ({}) => inc={} full={}", t, v, i, f); assert!(f == i && f == v); diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index 7816480efab..edefd39ebb4 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 => fail2!("HashMap::find: internal logic error"), + None => fail!("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 => { fail2!("Internal logic error"); } + TableFull => { fail!("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 => { fail2!("insert_internal: Internal logic error") } + None => { fail!("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 => fail2!("Internal logic error"), + TableFull => fail!("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 => fail2!("No entry found for key: {:?}", k), + None => fail!("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 => fail2!("No entry found for key: {:?}", k), + None => fail!("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 => fail2!(), Some(x) => *x = new + None => fail!(), 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 => fail2!(), + None => fail!(), Some(v) => assert!(*v == 2) } } diff --git a/src/libstd/io.rs b/src/libstd/io.rs index b92806d715f..94a6b7cfea8 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -946,8 +946,8 @@ impl Reader for *libc::FILE { match libc::ferror(*self) { 0 => (), _ => { - error2!("error reading buffer: {}", os::last_os_error()); - fail2!(); + error!("error reading buffer: {}", os::last_os_error()); + fail!(); } } } @@ -1194,8 +1194,8 @@ impl Writer for *libc::FILE { len as size_t, *self); if nout != len as size_t { - error2!("error writing buffer: {}", os::last_os_error()); - fail2!(); + error!("error writing buffer: {}", os::last_os_error()); + fail!(); } } } @@ -1255,8 +1255,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 { - error2!("error writing buffer: {}", os::last_os_error()); - fail2!(); + error!("error writing buffer: {}", os::last_os_error()); + fail!(); } count += nout as uint; } @@ -1264,12 +1264,12 @@ impl Writer for fd_t { } } fn seek(&self, _offset: int, _whence: SeekStyle) { - error2!("need 64-bit foreign calls for seek, sorry"); - fail2!(); + error!("need 64-bit foreign calls for seek, sorry"); + fail!(); } fn tell(&self) -> uint { - error2!("need 64-bit foreign calls for tell, sorry"); - fail2!(); + error!("need 64-bit foreign calls for tell, sorry"); + fail!(); } fn flush(&self) -> int { 0 } fn get_type(&self) -> WriterType { @@ -1895,17 +1895,17 @@ mod tests { #[test] fn test_simple() { let tmpfile = &Path::new("tmp/lib-io-test-simple.tmp"); - debug2!("{}", tmpfile.display()); + debug!("{}", tmpfile.display()); let frood: ~str = ~"A hoopy frood who really knows where his towel is."; - debug2!("{}", frood.clone()); + debug!("{}", 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(); - debug2!("{}", frood2.clone()); + debug!("{}", frood2.clone()); assert_eq!(frood, frood2); } @@ -1922,14 +1922,14 @@ mod tests { { let file = io::file_reader(&path).unwrap(); do file.each_byte() |_| { - fail2!("must be empty") + fail!("must be empty") }; } { let file = io::file_reader(&path).unwrap(); do file.each_char() |_| { - fail2!("must be empty") + fail!("must be empty") }; } } @@ -2016,7 +2016,7 @@ mod tests { Err(e) => { assert_eq!(e, ~"error opening not a file"); } - Ok(_) => fail2!() + Ok(_) => fail!() } } @@ -2056,7 +2056,7 @@ mod tests { Err(e) => { assert!(e.starts_with("error opening")); } - Ok(_) => fail2!() + Ok(_) => fail!() } } diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 4d2abd2633f..01af3d93157 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -742,7 +742,7 @@ pub trait ExactSize : DoubleEndedIterator { Some(x) => { i = match i.checked_sub(&1) { Some(x) => x, - None => fail2!("rposition: incorrect ExactSize") + None => fail!("rposition: incorrect ExactSize") }; if predicate(x) { return Some(i) @@ -2487,7 +2487,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(|_| fail2!())); + assert!(v.slice(0, 0).iter().all(|_| fail!())); } #[test] @@ -2496,7 +2496,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(|_| fail2!())); + assert!(!v.slice(0, 0).iter().any(|_| fail!())); } #[test] @@ -2646,7 +2646,7 @@ mod tests { let mut i = 0; do v.iter().rposition |_elt| { if i == 2 { - fail2!() + fail!() } i += 1; false @@ -2790,12 +2790,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() { - fail2!("unreachable"); + fail!("unreachable"); } assert_eq!(range(11u, 14).invert().collect::<~[uint]>(), ~[13u, 12, 11]); for _ in range(10u, 0).invert() { - fail2!("unreachable"); + fail!("unreachable"); } } diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 64f02539d0f..30175d6609b 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -144,7 +144,7 @@ pub fn pop(key: Key) -> Option { match *entry { Some((k, _, loan)) if k == key_value => { if loan != NoLoan { - fail2!("TLS value cannot be removed because it is currently \ + fail!("TLS value cannot be removed because it is currently \ borrowed as {}", loan.describe()); } // Move the data out of the `entry` slot via util::replace. @@ -241,7 +241,7 @@ fn get_with(key: Key, } (ImmLoan, ImmLoan) => {} (want, cur) => { - fail2!("TLS slot cannot be borrowed as {} because \ + fail!("TLS slot cannot be borrowed as {} because \ it is already borrowed as {}", want.describe(), cur.describe()); } @@ -305,7 +305,7 @@ pub fn set(key: Key, data: T) { match *entry { Some((ekey, _, loan)) if key == ekey => { if loan != NoLoan { - fail2!("TLS value cannot be overwritten because it is + fail!("TLS value cannot be overwritten because it is already borrowed as {}", loan.describe()) } true @@ -389,15 +389,15 @@ mod tests { static my_key: Key<@~str> = &Key; modify(my_key, |data| { match data { - Some(@ref val) => fail2!("unwelcome value: {}", *val), + Some(@ref val) => fail!("unwelcome value: {}", *val), None => Some(@~"first data") } }); modify(my_key, |data| { match data { Some(@~"first data") => Some(@~"next data"), - Some(@ref val) => fail2!("wrong value: {}", *val), - None => fail2!("missing value") + Some(@ref val) => fail!("wrong value: {}", *val), + None => fail!("missing value") } }); assert!(*(pop(my_key).unwrap()) == ~"next data"); @@ -457,11 +457,11 @@ mod tests { set(str_key, @~"string data"); set(box_key, @@()); set(int_key, @42); - fail2!(); + fail!(); } // Not quite nondeterministic. set(int_key, @31337); - fail2!(); + fail!(); } #[test] diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index e99dcd6b2eb..3103731a52f 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -820,7 +820,7 @@ 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 { fail2!("number has a special value, \ + if special { fail!("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 f367de376d4..da8270703d7 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -868,7 +868,7 @@ 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 { fail2!("number has a special value, \ + if special { fail!("number has a special value, \ try to_str_radix_special() if those are expected") } r } diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 0f253a26ccf..d17c947ab56 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -473,19 +473,19 @@ pub fn from_str_bytes_common+ ) -> Option { match exponent { ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e' - => fail2!("from_str_bytes_common: radix {:?} incompatible with \ + => fail!("from_str_bytes_common: radix {:?} incompatible with \ use of 'e' as decimal exponent", radix), ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p' - => fail2!("from_str_bytes_common: radix {:?} incompatible with \ + => fail!("from_str_bytes_common: radix {:?} incompatible with \ use of 'p' as binary exponent", radix), _ if special && radix >= DIGIT_I_RADIX // first digit of 'inf' - => fail2!("from_str_bytes_common: radix {:?} incompatible with \ + => fail!("from_str_bytes_common: radix {:?} incompatible with \ special values 'inf' and 'NaN'", radix), _ if (radix as int) < 2 - => fail2!("from_str_bytes_common: radix {:?} to low, \ + => fail!("from_str_bytes_common: radix {:?} to low, \ must lie in the range [2, 36]", radix), _ if (radix as int) > 36 - => fail2!("from_str_bytes_common: radix {:?} to high, \ + => fail!("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 cdff32a46dc..732dbe64d01 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -244,7 +244,7 @@ impl Option { pub fn get_ref<'a>(&'a self) -> &'a T { match *self { Some(ref x) => x, - None => fail2!("called `Option::get_ref()` on a `None` value"), + None => fail!("called `Option::get_ref()` on a `None` value"), } } @@ -264,7 +264,7 @@ impl Option { pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T { match *self { Some(ref mut x) => x, - None => fail2!("called `Option::get_mut_ref()` on a `None` value"), + None => fail!("called `Option::get_mut_ref()` on a `None` value"), } } @@ -286,7 +286,7 @@ impl Option { pub fn unwrap(self) -> T { match self { Some(x) => x, - None => fail2!("called `Option::unwrap()` on a `None` value"), + None => fail!("called `Option::unwrap()` on a `None` value"), } } @@ -299,7 +299,7 @@ impl Option { #[inline] pub fn take_unwrap(&mut self) -> T { if self.is_none() { - fail2!("called `Option::take_unwrap()` on a `None` value") + fail!("called `Option::take_unwrap()` on a `None` value") } self.take().unwrap() } @@ -314,7 +314,7 @@ impl Option { pub fn expect(self, reason: &str) -> T { match self { Some(val) => val, - None => fail2!("{}", reason.to_owned()), + None => fail!("{}", reason.to_owned()), } } @@ -630,7 +630,7 @@ mod tests { #[test] #[should_fail] - fn test_unwrap_fail2() { + fn test_unwrap_fail() { let x: Option<~str> = None; x.unwrap(); } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 41acd050a50..ba2b42c9b9c 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -89,7 +89,7 @@ pub fn getcwd() -> Path { do buf.as_mut_buf |buf, len| { unsafe { if libc::getcwd(buf, len as size_t).is_null() { - fail2!() + fail!() } Path::new(CString::new(buf as *c_char, false)) @@ -106,7 +106,7 @@ pub fn getcwd() -> Path { do buf.as_mut_buf |buf, len| { unsafe { if libc::GetCurrentDirectoryW(len as DWORD, buf) == 0 as DWORD { - fail2!(); + fail!(); } } } @@ -197,7 +197,7 @@ pub fn env() -> ~[(~str,~str)] { }; let ch = GetEnvironmentStringsA(); if (ch as uint == 0) { - fail2!("os::env() failure getting env string from OS: {}", + fail!("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); @@ -213,13 +213,13 @@ pub fn env() -> ~[(~str,~str)] { } let environ = rust_env_pairs(); if (environ as uint == 0) { - fail2!("os::env() failure getting env string from OS: {}", + fail!("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); - debug2!("get_env_pairs: {}", env_pair); + debug!("get_env_pairs: {}", env_pair); result.push(env_pair); }); result @@ -229,7 +229,7 @@ pub fn env() -> ~[(~str,~str)] { let mut pairs = ~[]; for p in input.iter() { let vs: ~[&str] = p.splitn_iter('=', 1).collect(); - debug2!("splitting: len: {}", vs.len()); + debug!("splitting: len: {}", vs.len()); assert_eq!(vs.len(), 2); pairs.push((vs[0].to_owned(), vs[1].to_owned())); } @@ -767,14 +767,14 @@ pub fn list_dir(p: &Path) -> ~[Path] { fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char; } let mut paths = ~[]; - debug2!("os::list_dir -- BEFORE OPENDIR"); + debug!("os::list_dir -- BEFORE OPENDIR"); let dir_ptr = do p.with_c_str |buf| { opendir(buf) }; if (dir_ptr as uint != 0) { - debug2!("os::list_dir -- opendir() SUCCESS"); + debug!("os::list_dir -- opendir() SUCCESS"); let mut entry_ptr = readdir(dir_ptr); while (entry_ptr as uint != 0) { let cstr = CString::new(rust_list_dir_val(entry_ptr), false); @@ -784,9 +784,9 @@ pub fn list_dir(p: &Path) -> ~[Path] { closedir(dir_ptr); } else { - debug2!("os::list_dir -- opendir() FAILURE"); + debug!("os::list_dir -- opendir() FAILURE"); } - debug2!("os::list_dir -- AFTER -- \\#: {}", paths.len()); + debug!("os::list_dir -- AFTER -- \\#: {}", paths.len()); paths } #[cfg(windows)] @@ -820,7 +820,7 @@ pub fn list_dir(p: &Path) -> ~[Path] { while more_files != 0 { let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr); if fp_buf as uint == 0 { - fail2!("os::list_dir() failure: got null ptr from wfd"); + fail!("os::list_dir() failure: got null ptr from wfd"); } else { let fp_vec = vec::from_buf( @@ -1143,7 +1143,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 { - fail2!("strerror_r failure"); + fail!("strerror_r failure"); } str::raw::from_c_str(buf as *c_char) @@ -1207,7 +1207,7 @@ pub fn last_os_error() -> ~str { len as DWORD, ptr::null()); if res == 0 { - fail2!("[{}] FormatMessage failure", errno()); + fail!("[{}] FormatMessage failure", errno()); } } @@ -1263,7 +1263,7 @@ fn real_args() -> ~[~str] { match rt::args::clone() { Some(args) => args, - None => fail2!("process arguments not initialized") + None => fail!("process arguments not initialized") } } @@ -1508,10 +1508,10 @@ impl Drop for MemoryMap { match libc::munmap(self.data as *c_void, self.len) { 0 => (), -1 => match errno() as c_int { - libc::EINVAL => error2!("invalid addr or len"), - e => error2!("unknown errno={}", e) + libc::EINVAL => error!("invalid addr or len"), + e => error!("unknown errno={}", e) }, - r => error2!("Unexpected result {}", r) + r => error!("Unexpected result {}", r) } } } @@ -1639,15 +1639,15 @@ impl Drop for MemoryMap { if libc::VirtualFree(self.data as *mut c_void, self.len, libc::MEM_RELEASE) == FALSE { - error2!("VirtualFree failed: {}", errno()); + error!("VirtualFree failed: {}", errno()); } }, MapFile(mapping) => { if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE { - error2!("UnmapViewOfFile failed: {}", errno()); + error!("UnmapViewOfFile failed: {}", errno()); } if libc::CloseHandle(mapping as HANDLE) == FALSE { - error2!("CloseHandle failed: {}", errno()); + error!("CloseHandle failed: {}", errno()); } } } @@ -1778,7 +1778,7 @@ mod tests { #[test] pub fn last_os_error() { - debug2!("{}", os::last_os_error()); + debug!("{}", os::last_os_error()); } #[test] @@ -1833,7 +1833,7 @@ mod tests { } let n = make_rand_name(); setenv(n, s); - debug2!("{}", s.clone()); + debug!("{}", s.clone()); assert_eq!(getenv(n), option::Some(s)); } @@ -1842,7 +1842,7 @@ mod tests { let path = os::self_exe_path(); assert!(path.is_some()); let path = path.unwrap(); - debug2!("{:?}", path.clone()); + debug!("{:?}", path.clone()); // Hard to test this function assert!(path.is_absolute()); @@ -1855,7 +1855,7 @@ mod tests { assert!(e.len() > 0u); for p in e.iter() { let (n, v) = (*p).clone(); - debug2!("{:?}", n.clone()); + debug!("{:?}", 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 @@ -1881,10 +1881,10 @@ mod tests { assert!((!Path::new("test-path").is_absolute())); let cwd = getcwd(); - debug2!("Current working directory: {}", cwd.display()); + debug!("Current working directory: {}", cwd.display()); - debug2!("{:?}", make_absolute(&Path::new("test-path"))); - debug2!("{:?}", make_absolute(&Path::new("/usr/bin"))); + debug!("{:?}", make_absolute(&Path::new("test-path"))); + debug!("{:?}", make_absolute(&Path::new("/usr/bin"))); } #[test] @@ -1949,7 +1949,7 @@ mod tests { assert!(dirs.len() > 0u); for dir in dirs.iter() { - debug2!("{:?}", (*dir).clone()); + debug!("{:?}", (*dir).clone()); } } @@ -1978,16 +1978,16 @@ mod tests { let mut dirpath = os::tmpdir(); dirpath.push(format!("rust-test-{}/test-\uac00\u4e00\u30fc\u4f60\u597d", rand::random::())); // 가一ー你好 - debug2!("path_is_dir dirpath: {}", dirpath.display()); + debug!("path_is_dir dirpath: {}", dirpath.display()); let mkdir_result = os::mkdir_recursive(&dirpath, (S_IRUSR | S_IWUSR | S_IXUSR) as i32); - debug2!("path_is_dir mkdir_result: {}", mkdir_result); + debug!("path_is_dir mkdir_result: {}", mkdir_result); assert!((os::path_is_dir(&dirpath))); let mut filepath = dirpath; filepath.push("unicode-file-\uac00\u4e00\u30fc\u4f60\u597d.rs"); - debug2!("path_is_dir filepath: {}", filepath.display()); + debug!("path_is_dir filepath: {}", filepath.display()); open(&filepath, OpenOrCreate, Read); // ignore return; touch only assert!((!os::path_is_dir(&filepath))); @@ -2048,7 +2048,7 @@ mod tests { let in_mode = input.get_mode(); let rs = os::copy_file(&input, &out); if (!os::path_exists(&input)) { - fail2!("{} doesn't exist", input.display()); + fail!("{} doesn't exist", input.display()); } assert!((rs)); // FIXME (#9639): This needs to handle non-utf8 paths @@ -2076,7 +2076,7 @@ mod tests { os::MapWritable ]) { Ok(chunk) => chunk, - Err(msg) => fail2!(msg.to_str()) + Err(msg) => fail!(msg.to_str()) }; assert!(chunk.len >= 16); @@ -2133,7 +2133,7 @@ mod tests { MapOffset(size / 2) ]) { Ok(chunk) => chunk, - Err(msg) => fail2!(msg.to_str()) + Err(msg) => fail!(msg.to_str()) }; assert!(chunk.len > 0); diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 4962b63c8cf..f71f67a30db 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -54,12 +54,12 @@ actually operates on the path; it is only intended for display. ```rust let mut path = Path::new("/tmp/path"); -debug2!("path: {}", path.display()); +debug!("path: {}", path.display()); path.set_filename("foo"); path.push("bar"); -debug2!("new path: {}", path.display()); +debug!("new path: {}", path.display()); let b = std::os::path_exists(&path); -debug2!("path exists: {}", b); +debug!("path exists: {}", b); ``` */ diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index c27665d7698..8803d39b0c6 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)) { - debug2!("array_each_with_len: before iterate"); + debug!("array_each_with_len: before iterate"); if (arr as uint == 0) { - fail2!("ptr::array_each_with_len failure: arr input is null pointer"); + fail!("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); } - debug2!("array_each_with_len: after iterate"); + debug!("array_each_with_len: after iterate"); } /** @@ -259,10 +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) { - fail2!("ptr::array_each_with_len failure: arr input is null pointer"); + fail!("ptr::array_each_with_len failure: arr input is null pointer"); } let len = buf_len(arr); - debug2!("array_each inferred len: {}", len); + debug!("array_each inferred len: {}", len); array_each_with_len(arr, len, cb); } @@ -669,7 +669,7 @@ pub mod ptr_tests { let expected = do expected_arr[ctr].with_ref |buf| { str::raw::from_c_str(buf) }; - debug2!( + debug!( "test_ptr_array_each_with_len e: {}, a: {}", expected, actual); assert_eq!(actual, expected); @@ -706,7 +706,7 @@ pub mod ptr_tests { let expected = do expected_arr[ctr].with_ref |buf| { str::raw::from_c_str(buf) }; - debug2!( + debug!( "test_ptr_array_each e: {}, a: {}", expected, actual); assert_eq!(actual, expected); diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 954db42c89b..f5c60417bac 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -175,7 +175,7 @@ pub trait Rng { *b = (rand >> 8) as u8; *c = (rand >> 16) as u8; } - _ => fail2!("Rng.fill_bytes: the impossible occurred: remaining != 1, 2 or 3") + _ => fail!("Rng.fill_bytes: the impossible occurred: remaining != 1, 2 or 3") } } @@ -797,7 +797,7 @@ mod test { let mut r = rng(); let a = r.gen::(); let b = r.gen::(); - debug2!("{:?}", (a, b)); + debug!("{:?}", (a, b)); } #[test] @@ -810,9 +810,9 @@ mod test { #[test] fn test_gen_ascii_str() { let mut r = rng(); - debug2!("{}", r.gen_ascii_str(10u)); - debug2!("{}", r.gen_ascii_str(10u)); - debug2!("{}", r.gen_ascii_str(10u)); + debug!("{}", r.gen_ascii_str(10u)); + debug!("{}", r.gen_ascii_str(10u)); + debug!("{}", 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/rand/reader.rs b/src/libstd/rand/reader.rs index 961a5b2cd28..f1e67da815e 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -68,9 +68,9 @@ impl Rng for ReaderRng { if v.len() == 0 { return } match self.reader.read(v) { Some(n) if n == v.len() => return, - Some(n) => fail2!("ReaderRng.fill_bytes could not fill buffer: \ + Some(n) => fail!("ReaderRng.fill_bytes could not fill buffer: \ read {} out of {} bytes.", n, v.len()), - None => fail2!("ReaderRng.fill_bytes reached eof.") + None => fail!("ReaderRng.fill_bytes reached eof.") } } } diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index a788064293f..4feb1ca1910 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -182,7 +182,7 @@ impl<'self> ReprVisitor<'self> { } else if mtbl == 1 { // skip, this is ast::m_imm } else { - fail2!("invalid mutability value"); + fail!("invalid mutability value"); } } @@ -294,7 +294,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 { fail2!(); } + _align: uint) -> bool { fail!(); } fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool { self.writer.write(['@' as u8]); @@ -337,7 +337,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { } // Type no longer exists, vestigial function. - fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail2!(); } + fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail!(); } fn visit_unboxed_vec(&mut self, mtbl: uint, inner: *TyDesc) -> bool { do self.get::> |this, b| { @@ -552,7 +552,7 @@ impl<'self> TyVisitor for ReprVisitor<'self> { _align: uint) -> bool { match self.var_stk.pop() { - SearchingFor(*) => fail2!("enum value matched no variant"), + SearchingFor(*) => fail!("enum value matched no variant"), _ => true } } diff --git a/src/libstd/result.rs b/src/libstd/result.rs index 92315b5d47a..957ba4a0438 100644 --- a/src/libstd/result.rs +++ b/src/libstd/result.rs @@ -47,7 +47,7 @@ impl Result { pub fn get_ref<'a>(&'a self) -> &'a T { match *self { Ok(ref t) => t, - Err(ref e) => fail2!("called `Result::get_ref()` on `Err` value: {}", + Err(ref e) => fail!("called `Result::get_ref()` on `Err` value: {}", e.to_str()), } } @@ -108,7 +108,7 @@ impl Result { pub fn unwrap(self) -> T { match self { Ok(t) => t, - Err(e) => fail2!("called `Result::unwrap()` on `Err` value: {}", + Err(e) => fail!("called `Result::unwrap()` on `Err` value: {}", e.to_str()), } } @@ -126,7 +126,7 @@ impl Result { pub fn expect(self, reason: &str) -> T { match self { Ok(t) => t, - Err(_) => fail2!("{}", reason.to_owned()), + Err(_) => fail!("{}", reason.to_owned()), } } @@ -136,7 +136,7 @@ impl Result { pub fn expect_err(self, reason: &str) -> E { match self { Err(e) => e, - Ok(_) => fail2!("{}", reason.to_owned()), + Ok(_) => fail!("{}", reason.to_owned()), } } @@ -571,7 +571,7 @@ mod tests { Err(2)); // test that it does not take more elements than it needs - let functions = [|| Ok(()), || Err(1), || fail2!()]; + let functions = [|| Ok(()), || Err(1), || fail!()]; assert_eq!(collect(functions.iter().map(|f| (*f)())), Err(1)); @@ -591,7 +591,7 @@ mod tests { Err(2)); // test that it does not take more elements than it needs - let functions = [|| Ok(()), || Err(1), || fail2!()]; + let functions = [|| Ok(()), || Err(1), || fail!()]; assert_eq!(fold_(functions.iter() .map(|f| (*f)())), diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 315de4b9af3..24143ba040b 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -163,14 +163,14 @@ mod imp { } pub fn take() -> Option<~[~str]> { - fail2!() + fail!() } pub fn put(_args: ~[~str]) { - fail2!() + fail!() } pub fn clone() -> Option<~[~str]> { - fail2!() + fail!() } } diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 3e3431b32c9..4eae8bdc9a8 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 => { - fail2!("receiving on closed channel"); + fail!("receiving on closed channel"); } } } @@ -495,7 +495,7 @@ impl GenericPort for Port { match self.try_recv() { Some(val) => val, None => { - fail2!("receiving on closed channel"); + fail!("receiving on closed channel"); } } } @@ -650,7 +650,7 @@ impl GenericPort for SharedPort { match self.try_recv() { Some(val) => val, None => { - fail2!("receiving on a closed channel"); + fail!("receiving on a closed channel"); } } } diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index 96a0069e851..d33e1af90f8 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -93,7 +93,7 @@ fn do_iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: &fn(&ModEntry), do_iter_crate_map(*child, |x| f(x), visited); } }, - _ => fail2!("invalid crate map version") + _ => fail!("invalid crate map version") } } } diff --git a/src/libstd/rt/io/comm_adapters.rs b/src/libstd/rt/io/comm_adapters.rs index 495d1f97cd2..06424fee8bc 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

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

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

{ - fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } struct ChanWriter; impl> ChanWriter { - pub fn new(_chan: C) -> ChanWriter { fail2!() } + pub fn new(_chan: C) -> ChanWriter { fail!() } } impl> Writer for ChanWriter { - fn write(&mut self, _buf: &[u8]) { fail2!() } + fn write(&mut self, _buf: &[u8]) { fail!() } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } struct ReaderPort; impl ReaderPort { - pub fn new(_reader: R) -> ReaderPort { fail2!() } + pub fn new(_reader: R) -> ReaderPort { fail!() } } impl GenericPort<~[u8]> for ReaderPort { - fn recv(&self) -> ~[u8] { fail2!() } + fn recv(&self) -> ~[u8] { fail!() } - fn try_recv(&self) -> Option<~[u8]> { fail2!() } + fn try_recv(&self) -> Option<~[u8]> { fail!() } } struct WriterChan; impl WriterChan { - pub fn new(_writer: W) -> WriterChan { fail2!() } + pub fn new(_writer: W) -> WriterChan { fail!() } } impl GenericChan<~[u8]> for WriterChan { - fn send(&self, _x: ~[u8]) { fail2!() } + fn send(&self, _x: ~[u8]) { fail!() } } diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/rt/io/extensions.rs index 69f0423bf5d..99634b532b0 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) => { - debug2!("read 0 bytes. trying again"); + debug!("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 39c3c5692f8..a5d593d2454 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 => fail2!("whoops! I'm sure this raised, anyways.."); +/// None => fail!("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 => fail2!("whoops! I'm sure this raised, anyways.."); +/// None => fail!("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 { fail2!("nope"); } +/// else { fail!("nope"); } /// } /// /// # Errors @@ -596,7 +596,7 @@ impl FileInfo for Path { } /// else { cb(entry); } /// } /// } -/// else { fail2!("nope"); } +/// else { fail!("nope"); } /// } /// ``` pub trait DirectoryInfo : FileSystemInfo { @@ -713,7 +713,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 => fail2!("shouldn't happen"), + -1|0 => fail!("shouldn't happen"), n => str::from_utf8(read_buf.slice_to(n)) }; assert!(read_str == message.to_owned()); @@ -881,7 +881,7 @@ mod test { } let stat_res = match stat(filename) { Some(s) => s, - None => fail2!("shouldn't happen") + None => fail!("shouldn't happen") }; assert!(stat_res.is_file); unlink(filename); @@ -895,7 +895,7 @@ mod test { mkdir(filename); let stat_res = match stat(filename) { Some(s) => s, - None => fail2!("shouldn't happen") + None => fail!("shouldn't happen") }; assert!(stat_res.is_dir); rmdir(filename); @@ -964,7 +964,7 @@ mod test { r.read(mem); let read_str = str::from_utf8(mem); let expected = match n { - None|Some("") => fail2!("really shouldn't happen.."), + None|Some("") => fail!("really shouldn't happen.."), Some(n) => prefix+n }; assert!(expected == read_str); @@ -972,7 +972,7 @@ mod test { f.unlink(); } }, - None => fail2!("shouldn't happen") + None => fail!("shouldn't happen") } dir.rmdir(); } diff --git a/src/libstd/rt/io/flate.rs b/src/libstd/rt/io/flate.rs index 72029d07263..7c72ce6ba89 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]) { fail2!() } + fn write(&mut self, _buf: &[u8]) { fail!() } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } impl Decorator for DeflateWriter { @@ -68,9 +68,9 @@ impl InflateReader { } impl Reader for InflateReader { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } impl Decorator for InflateReader { diff --git a/src/libstd/rt/io/mem.rs b/src/libstd/rt/io/mem.rs index 1f396a4476e..5f6b4398c22 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) { fail2!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } } 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) { fail2!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } } 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]) { fail2!() } + fn write(&mut self, _buf: &[u8]) { fail!() } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } impl<'self> Seek for BufWriter<'self> { - fn tell(&self) -> u64 { fail2!() } + fn tell(&self) -> u64 { fail!() } - fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } } @@ -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) { fail2!() } + fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() } } ///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 d505c97ba0f..c0971b5d3cd 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -611,7 +611,7 @@ pub fn standard_error(kind: IoErrorKind) -> IoError { detail: None } } - _ => fail2!() + _ => fail!() } } diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs index dc8d34d1b11..d6820981181 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/rt/io/native/file.rs @@ -241,7 +241,7 @@ mod tests { assert_eq!(buf[2], 's' as u8); assert_eq!(buf[3], 't' as u8); } - r => fail2!("invalid read: {:?}", r) + r => fail!("invalid read: {:?}", r) } let mut raised = false; @@ -276,7 +276,7 @@ mod tests { assert_eq!(buf[2], 's' as u8); assert_eq!(buf[3], 't' as u8); } - r => fail2!("invalid read: {:?}", r) + r => fail!("invalid read: {:?}", r) } } } diff --git a/src/libstd/rt/io/native/process.rs b/src/libstd/rt/io/native/process.rs index 57367beacd8..91fff6d9263 100644 --- a/src/libstd/rt/io/native/process.rs +++ b/src/libstd/rt/io/native/process.rs @@ -124,7 +124,7 @@ impl Process { pub fn input<'a>(&'a mut self) -> &'a mut io::Writer { match self.input { Some(ref mut fd) => fd as &mut io::Writer, - None => fail2!("This process has no stdin") + None => fail!("This process has no stdin") } } @@ -138,7 +138,7 @@ impl Process { pub fn output<'a>(&'a mut self) -> &'a mut io::Reader { match self.input { Some(ref mut fd) => fd as &mut io::Reader, - None => fail2!("This process has no stdout") + None => fail!("This process has no stdout") } } @@ -152,7 +152,7 @@ impl Process { pub fn error<'a>(&'a mut self) -> &'a mut io::Reader { match self.error { Some(ref mut fd) => fd as &mut io::Reader, - None => fail2!("This process has no stderr") + None => fail!("This process has no stderr") } } @@ -283,29 +283,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 { - fail2!("failure in get_osfhandle: {}", os::last_os_error()); + fail!("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 { - fail2!("failure in DuplicateHandle: {}", os::last_os_error()); + fail!("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 { - fail2!("failure in get_osfhandle: {}", os::last_os_error()); + fail!("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 { - fail2!("failure in DuplicateHandle: {}", os::last_os_error()); + fail!("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 { - fail2!("failure in get_osfhandle: {}", os::last_os_error()); + fail!("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 { - fail2!("failure in DuplicateHandle: {}", os::last_os_error()); + fail!("failure in DuplicateHandle: {}", os::last_os_error()); } let cmd = make_command_line(prog, args); @@ -330,7 +330,7 @@ fn spawn_process_os(prog: &str, args: &[~str], CloseHandle(si.hStdError); for msg in create_err.iter() { - fail2!("failure in CreateProcess: {}", *msg); + fail!("failure in CreateProcess: {}", *msg); } // We close the thread handle because we don't care about keeping the @@ -471,7 +471,7 @@ fn spawn_process_os(prog: &str, args: &[~str], let pid = fork(); if pid < 0 { - fail2!("failure in fork: {}", os::last_os_error()); + fail!("failure in fork: {}", os::last_os_error()); } else if pid > 0 { return SpawnProcessResult {pid: pid, handle: ptr::null()}; } @@ -479,13 +479,13 @@ fn spawn_process_os(prog: &str, args: &[~str], rustrt::rust_unset_sigprocmask(); if dup2(in_fd, 0) == -1 { - fail2!("failure in dup2(in_fd, 0): {}", os::last_os_error()); + fail!("failure in dup2(in_fd, 0): {}", os::last_os_error()); } if dup2(out_fd, 1) == -1 { - fail2!("failure in dup2(out_fd, 1): {}", os::last_os_error()); + fail!("failure in dup2(out_fd, 1): {}", os::last_os_error()); } if dup2(err_fd, 2) == -1 { - fail2!("failure in dup3(err_fd, 2): {}", os::last_os_error()); + fail!("failure in dup3(err_fd, 2): {}", os::last_os_error()); } // close all other fds for fd in range(3, getdtablesize()).invert() { @@ -494,7 +494,7 @@ fn spawn_process_os(prog: &str, args: &[~str], do with_dirp(dir) |dirp| { if !dirp.is_null() && chdir(dirp) == -1 { - fail2!("failure in chdir: {}", os::last_os_error()); + fail!("failure in chdir: {}", os::last_os_error()); } } @@ -505,7 +505,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 - fail2!("failure in execvp: {}", os::last_os_error()); + fail!("failure in execvp: {}", os::last_os_error()); } } } @@ -651,14 +651,14 @@ fn waitpid(pid: pid_t) -> int { let proc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, pid as DWORD); if proc.is_null() { - fail2!("failure in OpenProcess: {}", os::last_os_error()); + fail!("failure in OpenProcess: {}", os::last_os_error()); } loop { let mut status = 0; if GetExitCodeProcess(proc, &mut status) == FALSE { CloseHandle(proc); - fail2!("failure in GetExitCodeProcess: {}", os::last_os_error()); + fail!("failure in GetExitCodeProcess: {}", os::last_os_error()); } if status != STILL_ACTIVE { CloseHandle(proc); @@ -666,7 +666,7 @@ fn waitpid(pid: pid_t) -> int { } if WaitForSingleObject(proc, INFINITE) == WAIT_FAILED { CloseHandle(proc); - fail2!("failure in WaitForSingleObject: {}", os::last_os_error()); + fail!("failure in WaitForSingleObject: {}", os::last_os_error()); } } } @@ -704,7 +704,7 @@ fn waitpid(pid: pid_t) -> int { let mut status = 0 as c_int; if unsafe { waitpid(pid, &mut status, 0) } == -1 { - fail2!("failure in waitpid: {}", os::last_os_error()); + fail!("failure in waitpid: {}", os::last_os_error()); } return if WIFEXITED(status) { diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs index 3b894b9d331..f29e17cfc2f 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/rt/io/net/tcp.rs @@ -84,7 +84,7 @@ impl Reader for TcpStream { } } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } impl Writer for TcpStream { @@ -324,7 +324,7 @@ mod test { if cfg!(windows) { assert_eq!(e.kind, NotConnected); } else { - fail2!(); + fail!(); } }).inside { let nread = stream.read(buf); @@ -359,7 +359,7 @@ mod test { if cfg!(windows) { assert_eq!(e.kind, NotConnected); } else { - fail2!(); + fail!(); } }).inside { let nread = stream.read(buf); diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/rt/io/net/udp.rs index 2f9babf5789..27faae0838b 100644 --- a/src/libstd/rt/io/net/udp.rs +++ b/src/libstd/rt/io/net/udp.rs @@ -94,7 +94,7 @@ impl Reader for UdpStream { } } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } impl Writer for UdpStream { @@ -104,7 +104,7 @@ impl Writer for UdpStream { } } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } #[cfg(test)] @@ -153,10 +153,10 @@ mod test { assert_eq!(buf[0], 99); assert_eq!(src, client_ip); } - None => fail2!() + None => fail!() } } - None => fail2!() + None => fail!() } } @@ -166,7 +166,7 @@ mod test { port.take().recv(); client.sendto([99], server_ip) } - None => fail2!() + None => fail!() } } } @@ -192,10 +192,10 @@ mod test { assert_eq!(buf[0], 99); assert_eq!(src, client_ip); } - None => fail2!() + None => fail!() } } - None => fail2!() + None => fail!() } } @@ -205,7 +205,7 @@ mod test { port.take().recv(); client.sendto([99], server_ip) } - None => fail2!() + None => fail!() } } } @@ -232,10 +232,10 @@ mod test { assert_eq!(nread, 1); assert_eq!(buf[0], 99); } - None => fail2!() + None => fail!() } } - None => fail2!() + None => fail!() } } @@ -247,7 +247,7 @@ mod test { port.take().recv(); stream.write([99]); } - None => fail2!() + None => fail!() } } } @@ -274,10 +274,10 @@ mod test { assert_eq!(nread, 1); assert_eq!(buf[0], 99); } - None => fail2!() + None => fail!() } } - None => fail2!() + None => fail!() } } @@ -289,7 +289,7 @@ mod test { port.take().recv(); stream.write([99]); } - None => fail2!() + None => fail!() } } } diff --git a/src/libstd/rt/io/net/unix.rs b/src/libstd/rt/io/net/unix.rs index 07de33935ee..1771a963ba7 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 { - fail2!() + fail!() } } impl Reader for UnixStream { - fn read(&mut self, _buf: &mut [u8]) -> Option { fail2!() } + fn read(&mut self, _buf: &mut [u8]) -> Option { fail!() } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } impl Writer for UnixStream { - fn write(&mut self, _v: &[u8]) { fail2!() } + fn write(&mut self, _v: &[u8]) { fail!() } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } pub struct UnixListener; impl UnixListener { pub fn bind(_path: &P) -> Option { - fail2!() + fail!() } } impl Listener for UnixListener { - fn listen(self) -> Option { fail2!() } + fn listen(self) -> Option { fail!() } } pub struct UnixAcceptor; impl Acceptor for UnixAcceptor { - fn accept(&mut self) -> Option { fail2!() } + fn accept(&mut self) -> Option { fail!() } } diff --git a/src/libstd/rt/io/pipe.rs b/src/libstd/rt/io/pipe.rs index 251795ab238..d2cd531ed26 100644 --- a/src/libstd/rt/io/pipe.rs +++ b/src/libstd/rt/io/pipe.rs @@ -64,7 +64,7 @@ impl Reader for PipeStream { } } - fn eof(&mut self) -> bool { fail2!() } + fn eof(&mut self) -> bool { fail!() } } impl Writer for PipeStream { @@ -77,5 +77,5 @@ impl Writer for PipeStream { } } - fn flush(&mut self) { fail2!() } + fn flush(&mut self) { fail!() } } diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs index 6043ae318fe..8029e3f6431 100644 --- a/src/libstd/rt/kill.rs +++ b/src/libstd/rt/kill.rs @@ -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 { fail2!("{}", KILLED_MSG) }, + KILL_KILLED => if !already_failing { fail!("{}", 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 { fail2!("{}", KILLED_MSG) }, + KILL_KILLED => if !already_failing { fail!("{}", 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() { - fail2!("{}", KILLED_MSG); + fail!("{}", 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; - fail2!("Cannot enter a rekillable() block without a surrounding unkillable()"); + fail!("Cannot enter a rekillable() block without a surrounding unkillable()"); } self.unkillable -= 1; if self.unkillable == 0 { diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 93ac308df3a..336d2518e43 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -1292,12 +1292,12 @@ mod test { while (true) { match p.recv() { (1, end_chan) => { - debug2!("{}\n", id); + debug!("{}\n", id); end_chan.send(()); return; } (token, end_chan) => { - debug2!("thread: {} got token: {}", id, token); + debug!("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 28c38ac9b53..a6f9e11e40e 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -626,7 +626,7 @@ mod test { let result = spawntask_try(||()); rtdebug!("trying first assert"); assert!(result.is_ok()); - let result = spawntask_try(|| fail2!()); + let result = spawntask_try(|| fail!()); rtdebug!("trying second assert"); assert!(result.is_err()); } @@ -644,7 +644,7 @@ mod test { #[test] fn logging() { do run_in_newsched_task() { - info2!("here i am. logging in a newsched task"); + info!("here i am. logging in a newsched task"); } } @@ -686,7 +686,7 @@ mod test { fn linked_failure() { do run_in_newsched_task() { let res = do spawntask_try { - spawntask_random(|| fail2!()); + spawntask_random(|| fail!()); }; assert!(res.is_err()); } diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index 9f4e6558ac5..4f7ebb4a721 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -115,7 +115,7 @@ mod darwin_fd_limit { to_mut_unsafe_ptr(&mut size), mut_null(), 0) != 0 { let err = last_os_error(); - error2!("raise_fd_limit: error calling sysctl: {}", err); + error!("raise_fd_limit: error calling sysctl: {}", err); return; } @@ -123,7 +123,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(); - error2!("raise_fd_limit: error calling getrlimit: {}", err); + error!("raise_fd_limit: error calling getrlimit: {}", err); return; } @@ -133,7 +133,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(); - error2!("raise_fd_limit: error calling setrlimit: {}", err); + error!("raise_fd_limit: error calling setrlimit: {}", err); return; } } diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs index cb5054626d4..3a6d858df79 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::new(path_str)); assert!(result.is_ok()); - } else { fail2!("nread was 0.. wudn't expectin' that."); } + } else { fail!("nread was 0.. wudn't expectin' that."); } loop_.close(); } } diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index 2c27db982aa..a2608bf6b24 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), - _ => fail2!(), + _ => fail!(), } } } diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 0d32efbba88..a4060586318 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -229,7 +229,7 @@ impl Process { ((1, o), (2, e)) => (e, o), ((2, e), (1, o)) => (e, o), ((x, _), (y, _)) => { - fail2!("unexpected file numbers: {}, {}", x, y); + fail!("unexpected file numbers: {}, {}", x, y); } }; diff --git a/src/libstd/select.rs b/src/libstd/select.rs index 8ce23f4b53b..62a09984794 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() { - fail2!("can't select on an empty list"); + fail!("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 => fail2!("impossible case in select2: {:?}", x) + x => fail!("impossible case in select2: {:?}", x) } } @@ -335,7 +335,7 @@ mod test { let _ = dead_cs; } do task::spawn { - fail2!(); // should kill sibling awake + fail!(); // 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 9d2f60fc27c..883934124a6 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -1229,7 +1229,7 @@ pub mod raw { match ctr { 0 => assert_eq!(x, &~"zero"), 1 => assert_eq!(x, &~"one"), - _ => fail2!("shouldn't happen!") + _ => fail!("shouldn't happen!") } ctr += 1; } @@ -2001,8 +2001,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, _) => fail2!("slice_chars: `begin` is beyond end of string"), - (_, None) => fail2!("slice_chars: `end` is beyond end of string"), + (None, _) => fail!("slice_chars: `begin` is beyond end of string"), + (_, None) => fail!("slice_chars: `end` is beyond end of string"), (Some(a), Some(b)) => unsafe { raw::slice_bytes(*self, a, b) } } } @@ -3246,7 +3246,7 @@ mod tests { // original problem code path anymore.) let s = ~""; let _bytes = s.as_bytes(); - fail2!(); + fail!(); } #[test] @@ -3304,8 +3304,8 @@ mod tests { while i < n1 { let a: u8 = s1[i]; let b: u8 = s2[i]; - debug2!("{}", a); - debug2!("{}", b); + debug!("{}", a); + debug!("{}", b); assert_eq!(a, b); i += 1u; } diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 51b1ab603ed..970a62b676f 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -192,7 +192,7 @@ pub fn task() -> TaskBuilder { impl TaskBuilder { fn consume(&mut self) -> TaskBuilder { if self.consumed { - fail2!("Cannot copy a task_builder"); // Fake move mode on self + fail!("Cannot copy a task_builder"); // Fake move mode on self } self.consumed = true; let gen_body = self.gen_body.take(); @@ -280,7 +280,7 @@ impl TaskBuilder { // sending out messages. if self.opts.notify_chan.is_some() { - fail2!("Can't set multiple future_results for one task!"); + fail!("Can't set multiple future_results for one task!"); } // Construct the future and give it to the caller. @@ -540,7 +540,7 @@ pub fn with_task_name(blk: &fn(Option<&str>) -> U) -> U { } } } else { - fail2!("no task name exists in non-green task context") + fail!("no task name exists in non-green task context") } } @@ -648,7 +648,7 @@ fn test_kill_unkillable_task() { do run_in_newsched_task { do task::try { do task::spawn { - fail2!(); + fail!(); } do task::unkillable { } }; @@ -667,7 +667,7 @@ fn test_kill_rekillable_task() { do task::unkillable { do task::rekillable { do task::spawn { - fail2!(); + fail!(); } } } @@ -697,7 +697,7 @@ fn test_rekillable_nested_failure() { do unkillable { do rekillable { let (port,chan) = comm::stream(); - do task::spawn { chan.send(()); fail2!(); } + do task::spawn { chan.send(()); fail!(); } port.recv(); // wait for child to exist port.recv(); // block forever, expect to get killed. } @@ -741,7 +741,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. } - fail2!(); // Shouldn't kill either (grand)parent or (grand)child. + fail!(); // Shouldn't kill either (grand)parent or (grand)child. } po.recv(); } @@ -751,7 +751,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 { fail2!(); } + do spawn_unlinked { fail!(); } } } #[ignore(reason = "linked failure")] @@ -759,7 +759,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 { fail2!(); } + do spawn_supervised { fail!(); } // Give child a chance to fail-but-not-kill-us. do 16.times { task::deschedule(); } } @@ -771,7 +771,7 @@ fn test_spawn_unlinked_sup_fail_down() { do run_in_newsched_task { let result: Result<(),()> = do try { do spawn_supervised { block_forever(); } - fail2!(); // Shouldn't leave a child hanging around. + fail!(); // Shouldn't leave a child hanging around. }; assert!(result.is_err()); } @@ -791,7 +791,7 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails b0.opts.supervised = true; do b0.spawn { - fail2!(); + fail!(); } block_forever(); // We should get punted awake }; @@ -810,7 +810,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(); } - fail2!(); // *both* mechanisms would be wrong if this didn't kill the child + fail!(); // *both* mechanisms would be wrong if this didn't kill the child }; assert!(result.is_err()); } @@ -822,7 +822,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 { fail2!(); } + do spawn { fail!(); } block_forever(); // We should get punted awake }; assert!(result.is_err()); @@ -836,7 +836,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(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -851,7 +851,7 @@ fn test_spawn_linked_unsup_default_opts() { // parent fails; child fails let mut builder = task(); builder.linked(); do builder.spawn { block_forever(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -871,7 +871,7 @@ fn test_spawn_failure_propagate_grandchild() { do spawn_supervised { block_forever(); } } do 16.times { task::deschedule(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -888,7 +888,7 @@ fn test_spawn_failure_propagate_secondborn() { do spawn { block_forever(); } // linked } do 16.times { task::deschedule(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -905,7 +905,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { do spawn_supervised { block_forever(); } } do 16.times { task::deschedule(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -922,7 +922,7 @@ fn test_spawn_linked_sup_propagate_sibling() { do spawn { block_forever(); } // linked } do 16.times { task::deschedule(); } - fail2!(); + fail!(); }; assert!(result.is_err()); } @@ -1030,7 +1030,7 @@ fn test_future_result() { let result = builder.future_result(); builder.unlinked(); do builder.spawn { - fail2!(); + fail!(); } assert_eq!(result.recv(), Failure); } @@ -1048,17 +1048,17 @@ fn test_try_success() { ~"Success!" } { result::Ok(~"Success!") => (), - _ => fail2!() + _ => fail!() } } #[test] fn test_try_fail() { match do try { - fail2!() + fail!() } { result::Err(()) => (), - result::Ok(()) => fail2!() + result::Ok(()) => fail!() } } @@ -1248,7 +1248,7 @@ fn test_unkillable() { deschedule(); // We want to fail after the unkillable task // blocks on recv - fail2!(); + fail!(); } unsafe { @@ -1283,7 +1283,7 @@ fn test_unkillable_nested() { deschedule(); // We want to fail after the unkillable task // blocks on recv - fail2!(); + fail!(); } unsafe { @@ -1348,7 +1348,7 @@ fn test_spawn_watched() { t.watched(); do t.spawn { task::deschedule(); - fail2!(); + fail!(); } } }; @@ -1384,7 +1384,7 @@ fn test_indestructible() { do t.spawn { p3.recv(); task::deschedule(); - fail2!(); + fail!(); } c3.send(()); p2.recv(); diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 611d2f1fdb6..7cf0f04c7e9 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -631,7 +631,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { let (thread_port, thread_chan) = oneshot(); let thread_port_cell = Cell::new(thread_port); let join_task = do Task::build_child(None) { - debug2!("running join task"); + debug!("running join task"); let thread_port = thread_port_cell.take(); let thread: Thread = thread_port.recv(); thread.join(); @@ -648,11 +648,11 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { let join_task = join_task_cell.take(); let bootstrap_task = ~do Task::new_root(&mut new_sched.stack_pool, None) || { - debug2!("boostrapping a 1:1 scheduler"); + debug!("boostrapping a 1:1 scheduler"); }; new_sched.bootstrap(bootstrap_task); - debug2!("enqueing join_task"); + debug!("enqueing join_task"); // Now tell the original scheduler to join with this thread // by scheduling a thread-joining task on the original scheduler orig_sched_handle.send_task_from_friend(join_task); @@ -684,7 +684,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { } task.name = opts.name.take(); - debug2!("spawn calling run_task"); + debug!("spawn calling run_task"); Scheduler::run_task(task); } @@ -707,7 +707,7 @@ fn test_spawn_raw_unsupervise() { .. default_task_opts() }; do spawn_raw(opts) { - fail2!(); + fail!(); } } @@ -736,7 +736,7 @@ fn test_spawn_raw_notify_failure() { .. default_task_opts() }; do spawn_raw(opts) { - fail2!(); + fail!(); } assert_eq!(notify_po.recv(), Failure); } diff --git a/src/libstd/trie.rs b/src/libstd/trie.rs index b42d3c904d7..c561fb6cc8a 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), - _ => fail2!() + _ => fail!() } } External(*) => (None, false), @@ -531,7 +531,7 @@ mod test_map { assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { - None => fail2!(), Some(x) => *x = new + None => fail!(), 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 58ff51fe102..d3d768bc0c6 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) => fail2!("{}", str) + Err(str) => fail!("{}", str) } } } @@ -94,13 +94,13 @@ 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) => fail2!("Could not load self as module: {}", error), + Err(error) => fail!("Could not load self as module: {}", error), Ok(libm) => libm }; let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe { match libm.symbol("cos") { - Err(error) => fail2!("Could not load function cos: {}", error), + Err(error) => fail!("Could not load function cos: {}", error), Ok(cosine) => cosine } }; @@ -109,7 +109,7 @@ mod test { let expected_result = 1.0; let result = cosine(argument); if result != expected_result { - fail2!("cos({:?}) != {:?} but equaled {:?} instead", argument, + fail!("cos({:?}) != {:?} but equaled {:?} instead", argument, expected_result, result) } } @@ -124,7 +124,7 @@ mod test { let path = GenericPath::new("/dev/null"); match DynamicLibrary::open(Some(&path)) { Err(_) => {} - Ok(_) => fail2!("Successfully opened the empty library.") + Ok(_) => fail!("Successfully opened the empty library.") } } } diff --git a/src/libstd/unstable/finally.rs b/src/libstd/unstable/finally.rs index 9fe3435c21b..c1365a44bc9 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; - fail2!(); + fail!(); }).finally { assert!(failing()); assert_eq!(i, 10); diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index cf6bf839ccc..4c6ad469d8c 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); - fail2!("Another task is already unwrapping this Arc!"); + fail!("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 { - fail2!("Poisoned Exclusive::new - another task failed inside!"); + fail!("Poisoned Exclusive::new - another task failed inside!"); } (*rec).failed = true; let result = f(&mut (*rec).data); @@ -617,7 +617,7 @@ mod tests { let x2 = x.clone(); do task::spawn { do 10.times { task::deschedule(); } // try to let the unwrapper go - fail2!(); // punt it awake from its deadlock + fail!(); // 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 d298507aa8c..b10d0ded5b4 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1063,7 +1063,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { #[inline] fn head(&self) -> &'self T { - if self.len() == 0 { fail2!("head: empty vector") } + if self.len() == 0 { fail!("head: empty vector") } &self[0] } @@ -1090,7 +1090,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] { #[inline] fn last(&self) -> &'self T { - if self.len() == 0 { fail2!("last: empty vector") } + if self.len() == 0 { fail!("last: empty vector") } &self[self.len() - 1] } @@ -1409,7 +1409,7 @@ impl OwnedVector for ~[T] { let alloc = n * mem::nonzero_size_of::(); let size = alloc + mem::size_of::>(); if alloc / mem::nonzero_size_of::() != n || size < alloc { - fail2!("vector size is too large: {}", n); + fail!("vector size is too large: {}", n); } *ptr = realloc_raw(*ptr as *mut c_void, size) as *mut Vec<()>; @@ -1428,7 +1428,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 => fail2!("vec::reserve_additional: `uint` overflow"), + None => fail!("vec::reserve_additional: `uint` overflow"), Some(new_cap) => self.reserve_at_least(new_cap) } } @@ -1622,7 +1622,7 @@ impl OwnedVector for ~[T] { fn swap_remove(&mut self, index: uint) -> T { let ln = self.len(); if index >= ln { - fail2!("vec::swap_remove - index {} >= length {}", index, ln); + fail!("vec::swap_remove - index {} >= length {}", index, ln); } if index < ln - 1 { self.swap(index, ln - 1); @@ -2997,7 +2997,7 @@ mod tests { 3 => assert_eq!(v, [2, 3, 1]), 4 => assert_eq!(v, [2, 1, 3]), 5 => assert_eq!(v, [1, 2, 3]), - _ => fail2!(), + _ => fail!(), } } } @@ -3244,7 +3244,7 @@ mod tests { #[should_fail] fn test_from_fn_fail() { do from_fn(100) |v| { - if v == 50 { fail2!() } + if v == 50 { fail!() } (~0, @0) }; } @@ -3263,7 +3263,7 @@ mod tests { fn clone(&self) -> S { let s = unsafe { cast::transmute_mut(self) }; s.f += 1; - if s.f == 10 { fail2!() } + if s.f == 10 { fail!() } S { f: s.f, boxes: s.boxes.clone() } } } @@ -3280,7 +3280,7 @@ mod tests { push((~0, @0)); push((~0, @0)); push((~0, @0)); - fail2!(); + fail!(); }; } @@ -3290,7 +3290,7 @@ mod tests { let mut v = ~[]; do v.grow_fn(100) |i| { if i == 50 { - fail2!() + fail!() } (~0, @0) } @@ -3303,7 +3303,7 @@ mod tests { let mut i = 0; do v.map |_elt| { if i == 2 { - fail2!() + fail!() } i += 1; ~[(~0, @0)] @@ -3317,7 +3317,7 @@ mod tests { let mut i = 0; do flat_map(v) |_elt| { if i == 2 { - fail2!() + fail!() } i += 1; ~[(~0, @0)] @@ -3331,7 +3331,7 @@ mod tests { let mut i = 0; for _ in v.permutations_iter() { if i == 2 { - fail2!() + fail!() } i += 1; } @@ -3342,7 +3342,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| { - fail2!() + fail!() } } @@ -3351,7 +3351,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| { - fail2!() + fail!() } } @@ -3816,7 +3816,7 @@ mod bench { sum += *x; } // sum == 11806, to stop dead code elimination. - if sum == 0 {fail2!()} + if sum == 0 {fail!()} } } -- cgit 1.4.1-3-g733a5