Drop the '2' suffix from logging macros

Who doesn't like a massive renaming?
This commit is contained in:
Alex Crichton 2013-10-21 13:08:31 -07:00
parent 15a6bdebab
commit daf5f5a4d1
726 changed files with 3060 additions and 3060 deletions

View file

@ -255,7 +255,7 @@ impl<T:Send> MutexArc<T> {
let inner = x.unwrap();
let MutexArcInner { failed: failed, data: data, _ } = inner;
if failed {
fail2!("Can't unwrap poisoned MutexArc - another task failed inside!");
fail!("Can't unwrap poisoned MutexArc - another task failed inside!");
}
data
}
@ -300,9 +300,9 @@ impl<T:Freeze + Send> MutexArc<T> {
fn check_poison(is_mutex: bool, failed: bool) {
if failed {
if is_mutex {
fail2!("Poisoned MutexArc - another task failed inside!");
fail!("Poisoned MutexArc - another task failed inside!");
} else {
fail2!("Poisoned rw_arc - another task failed inside!");
fail!("Poisoned rw_arc - another task failed inside!");
}
}
}
@ -505,7 +505,7 @@ impl<T:Freeze + Send> RWArc<T> {
let inner = x.unwrap();
let RWArcInner { failed: failed, data: data, _ } = inner;
if failed {
fail2!("Can't unwrap poisoned RWArc - another task failed inside!")
fail!("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);
info2!("{:?}", arc_v);
info!("{:?}", arc_v);
}
#[test]

View file

@ -127,7 +127,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
let start = round_up_to(after_tydesc, align);
//debug2!("freeing object: idx = {}, size = {}, align = {}, done = {}",
//debug!("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;
//debug2!("idx = {}, size = {}, align = {}, fill = {}",
//debug!("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, mem::pref_align_of::<*TyDesc>());
//debug2!("idx = {}, size = {}, align = {}, fill = {}",
//debug!("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.
fail2!();
fail!();
};
}

View file

@ -141,7 +141,7 @@ impl<'self> ToBase64 for &'self [u8] {
v.push('=' as u8);
}
}
_ => fail2!("Algebra is broken, please alert the math police")
_ => fail!("Algebra is broken, please alert the math police")
}
unsafe {

View file

@ -232,7 +232,7 @@ pub struct Bitv {
}
fn die() -> ! {
fail2!("Tried to do operation on bit vectors with different sizes");
fail!("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| {
fail2!("found 1 at {:?}", i)
fail!("found 1 at {:?}", i)
};
}
@ -1366,7 +1366,7 @@ mod tests {
let mut b = Bitv::new(140, true);
b.clear();
do b.ones |i| {
fail2!("found 1 at {:?}", i)
fail!("found 1 at {:?}", i)
};
}

View file

@ -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
fail2!()
fail!()
}
port.recv()
}
@ -189,7 +189,7 @@ mod test {
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
fail2!()
fail!()
}
chan.try_send(());
}
@ -200,7 +200,7 @@ mod test {
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
fail2!()
fail!()
}
chan.send(());
}

View file

@ -109,23 +109,23 @@ impl ToBits for u64 {
}
}
/// Adds the specified number of bytes to the bit count. fail2!() if this would cause numeric
/// Adds the specified number of bytes to the bit count. fail!() if this would cause numeric
/// overflow.
pub fn add_bytes_to_bits<T: Int + CheckedAdd + ToBits>(bits: T, bytes: T) -> T {
let (new_high_bits, new_low_bits) = bytes.to_bits();
if new_high_bits > Zero::zero() {
fail2!("Numeric overflow occured.")
fail!("Numeric overflow occured.")
}
match bits.checked_add(&new_low_bits) {
Some(x) => return x,
None => fail2!("Numeric overflow occured.")
None => fail!("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. fail2!() if this would cause numeric overflow.
/// the high order value. fail!() if this would cause numeric overflow.
pub fn add_bytes_to_bits_tuple
<T: Int + Unsigned + CheckedAdd + ToBits>
(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 => fail2!("Numeric overflow occured.")
None => fail!("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 => fail2!("Numeric overflow occured.")
None => fail!("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 => fail2!("Numeric overflow occured.")
None => fail!("Numeric overflow occured.")
}
}
}

View file

@ -635,11 +635,11 @@ pub fn check_links<T>(list: &DList<T>) {
loop {
match (last_ptr, node_ptr.prev.resolve_immut()) {
(None , None ) => {}
(None , _ ) => fail2!("prev link for list_head"),
(None , _ ) => fail!("prev link for list_head"),
(Some(p), Some(pptr)) => {
assert_eq!(p as *Node<T>, pptr as *Node<T>);
}
_ => fail2!("prev link is none, not good"),
_ => fail!("prev link is none, not good"),
}
match node_ptr.next {
Some(ref next) => {

View file

@ -138,7 +138,7 @@ pub mod reader {
(data[start + 3u] as uint),
next: start + 4u};
}
fail2!("vint too big");
fail!("vint too big");
}
#[cfg(target_arch = "x86")]
@ -216,8 +216,8 @@ pub mod reader {
match maybe_get_doc(d, tg) {
Some(d) => d,
None => {
error2!("failed to find block with tag {}", tg);
fail2!();
error!("failed to find block with tag {}", tg);
fail!();
}
}
}
@ -305,20 +305,20 @@ pub mod reader {
self.pos = r_doc.end;
let str = r_doc.as_str_slice();
if lbl != str {
fail2!("Expected label {} but found {}", lbl, str);
fail!("Expected label {} but found {}", lbl, str);
}
}
}
}
fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> Doc {
debug2!(". next_doc(exp_tag={:?})", exp_tag);
debug!(". next_doc(exp_tag={:?})", exp_tag);
if self.pos >= self.parent.end {
fail2!("no more documents in current node!");
fail!("no more documents in current node!");
}
let TaggedDoc { tag: r_tag, doc: r_doc } =
doc_at(self.parent.data, self.pos);
debug2!("self.parent={}-{} self.pos={} r_tag={} r_doc={}-{}",
debug!("self.parent={}-{} self.pos={} r_tag={} r_doc={}-{}",
self.parent.start,
self.parent.end,
self.pos,
@ -326,11 +326,11 @@ pub mod reader {
r_doc.start,
r_doc.end);
if r_tag != (exp_tag as uint) {
fail2!("expected EBML doc with tag {:?} but found tag {:?}",
fail!("expected EBML doc with tag {:?} but found tag {:?}",
exp_tag, r_tag);
}
if r_doc.end > self.parent.end {
fail2!("invalid EBML, child extends to {:#x}, parent to {:#x}",
fail!("invalid EBML, child extends to {:#x}, parent to {:#x}",
r_doc.end, self.parent.end);
}
self.pos = r_doc.end;
@ -352,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));
debug2!("_next_uint exp_tag={:?} result={}", exp_tag, r);
debug!("_next_uint exp_tag={:?} result={}", exp_tag, r);
r as uint
}
}
@ -384,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) {
fail2!("uint {} too large for this architecture", v);
fail!("uint {} too large for this architecture", v);
}
v as uint
}
@ -404,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) {
debug2!("FIXME \\#6122: Removing this makes this function miscompile");
fail2!("int {} out of range for this architecture", v);
debug!("FIXME \\#6122: Removing this makes this function miscompile");
fail!("int {} out of range for this architecture", v);
}
v as int
}
@ -434,7 +434,7 @@ pub mod reader {
name: &str,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_enum({})", name);
debug!("read_enum({})", name);
self._check_label(name);
let doc = self.next_doc(EsEnum);
@ -454,9 +454,9 @@ pub mod reader {
_: &[&str],
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_enum_variant()");
debug!("read_enum_variant()");
let idx = self._next_uint(EsEnumVid);
debug2!(" idx={}", idx);
debug!(" idx={}", idx);
let doc = self.next_doc(EsEnumBody);
@ -474,7 +474,7 @@ pub mod reader {
fn read_enum_variant_arg<T>(&mut self,
idx: uint,
f: &fn(&mut Decoder) -> T) -> T {
debug2!("read_enum_variant_arg(idx={})", idx);
debug!("read_enum_variant_arg(idx={})", idx);
f(self)
}
@ -482,9 +482,9 @@ pub mod reader {
_: &[&str],
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_enum_struct_variant()");
debug!("read_enum_struct_variant()");
let idx = self._next_uint(EsEnumVid);
debug2!(" idx={}", idx);
debug!(" idx={}", idx);
let doc = self.next_doc(EsEnumBody);
@ -504,7 +504,7 @@ pub mod reader {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_enum_struct_variant_arg(name={}, idx={})", name, idx);
debug!("read_enum_struct_variant_arg(name={}, idx={})", name, idx);
f(self)
}
@ -513,7 +513,7 @@ pub mod reader {
_: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_struct(name={})", name);
debug!("read_struct(name={})", name);
f(self)
}
@ -522,19 +522,19 @@ pub mod reader {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_struct_field(name={}, idx={})", name, idx);
debug!("read_struct_field(name={}, idx={})", name, idx);
self._check_label(name);
f(self)
}
fn read_tuple<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_tuple()");
debug!("read_tuple()");
self.read_seq(f)
}
fn read_tuple_arg<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_tuple_arg(idx={})", idx);
debug!("read_tuple_arg(idx={})", idx);
self.read_seq_elt(idx, f)
}
@ -542,7 +542,7 @@ pub mod reader {
name: &str,
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_tuple_struct(name={})", name);
debug!("read_tuple_struct(name={})", name);
self.read_tuple(f)
}
@ -550,43 +550,43 @@ pub mod reader {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_tuple_struct_arg(idx={})", idx);
debug!("read_tuple_struct_arg(idx={})", idx);
self.read_tuple_arg(idx, f)
}
fn read_option<T>(&mut self, f: &fn(&mut Decoder, bool) -> T) -> T {
debug2!("read_option()");
debug!("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),
_ => fail2!(),
_ => fail!(),
}
}
}
}
fn read_seq<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_seq()");
debug!("read_seq()");
do self.push_doc(EsVec) |d| {
let len = d._next_uint(EsVecLen);
debug2!(" len={}", len);
debug!(" len={}", len);
f(d, len)
}
}
fn read_seq_elt<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_seq_elt(idx={})", idx);
debug!("read_seq_elt(idx={})", idx);
self.push_doc(EsVecElt, f)
}
fn read_map<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_map()");
debug!("read_map()");
do self.push_doc(EsMap) |d| {
let len = d._next_uint(EsMapLen);
debug2!(" len={}", len);
debug!(" len={}", len);
f(d, len)
}
}
@ -595,7 +595,7 @@ pub mod reader {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_map_elt_key(idx={})", idx);
debug!("read_map_elt_key(idx={})", idx);
self.push_doc(EsMapKey, f)
}
@ -603,7 +603,7 @@ pub mod reader {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_map_elt_val(idx={})", idx);
debug!("read_map_elt_val(idx={})", idx);
self.push_doc(EsMapVal, f)
}
}
@ -639,7 +639,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]),
_ => fail2!("vint to write too big: {}", n)
_ => fail!("vint to write too big: {}", n)
};
}
@ -648,7 +648,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; }
fail2!("vint to write too big: {}", n);
fail!("vint to write too big: {}", n);
}
pub fn Encoder(w: @io::Writer) -> Encoder {
@ -662,7 +662,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) {
debug2!("Start tag {}", tag_id);
debug!("Start tag {}", tag_id);
// Write the enum ID:
write_vuint(self.writer, tag_id);
@ -681,7 +681,7 @@ pub mod writer {
write_sized_vuint(self.writer, size, 4u);
self.writer.seek(cur_pos as int, io::SeekSet);
debug2!("End tag (size = {})", size);
debug!("End tag (size = {})", size);
}
pub fn wr_tag(&mut self, tag_id: uint, blk: &fn()) {
@ -745,12 +745,12 @@ pub mod writer {
}
pub fn wr_bytes(&mut self, b: &[u8]) {
debug2!("Write {} bytes", b.len());
debug!("Write {} bytes", b.len());
self.writer.write(b);
}
pub fn wr_str(&mut self, s: &str) {
debug2!("Write str: {}", s);
debug!("Write str: {}", s);
self.writer.write(s.as_bytes());
}
}
@ -969,7 +969,7 @@ mod tests {
#[test]
fn test_option_int() {
fn test_v(v: Option<int>) {
debug2!("v == {:?}", v);
debug!("v == {:?}", v);
let bytes = do io::with_bytes_writer |wr| {
let mut ebml_w = writer::Encoder(wr);
v.encode(&mut ebml_w)
@ -977,7 +977,7 @@ mod tests {
let ebml_doc = reader::Doc(@bytes);
let mut deser = reader::Decoder(ebml_doc);
let v1 = serialize::Decodable::decode(&mut deser);
debug2!("v1 == {:?}", v1);
debug!("v1 == {:?}", v1);
assert_eq!(v, v1);
}

View file

@ -506,7 +506,7 @@ mod test {
let contents =
vec::from_fn(3, |j| format!("{} {}", i, j));
make_file(filename.get_ref(), contents);
debug2!("contents={:?}", contents);
debug!("contents={:?}", contents);
all_lines.push_all(contents);
}
@ -555,7 +555,7 @@ mod test {
let expected_path = match line {
"1" | "2" => filenames[0].clone(),
"3" | "4" => filenames[2].clone(),
_ => fail2!("unexpected line")
_ => fail!("unexpected line")
};
assert_eq!(state.current_path.clone(), expected_path);
count += 1;

View file

@ -121,11 +121,11 @@ mod tests {
do 2000.times {
input.push_all(r.choose(words));
}
debug2!("de/inflate of {} bytes of random word-sequences",
debug!("de/inflate of {} bytes of random word-sequences",
input.len());
let cmp = deflate_bytes(input);
let out = inflate_bytes(cmp);
debug2!("{} bytes deflated to {} ({:.1f}% size)",
debug!("{} bytes deflated to {} ({:.1f}% size)",
input.len(), cmp.len(),
100.0 * ((cmp.len() as f64) / (input.len() as f64)));
assert_eq!(input, out);

View file

@ -57,7 +57,7 @@ impl<A> Future<A> {
let state = replace(&mut this.state, Evaluating);
match state {
Forced(v) => v,
_ => fail2!( "Logic error." ),
_ => fail!( "Logic error." ),
}
}
@ -69,10 +69,10 @@ impl<A> Future<A> {
*/
match self.state {
Forced(ref v) => return v,
Evaluating => fail2!("Recursive forcing of future!"),
Evaluating => fail!("Recursive forcing of future!"),
Pending(_) => {
match replace(&mut self.state, Evaluating) {
Forced(_) | Evaluating => fail2!("Logic error."),
Forced(_) | Evaluating => fail!("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(|| fail2!());
let mut f = Future::spawn(|| fail!());
let _x: ~str = f.get();
}

View file

@ -60,7 +60,7 @@
//! ];
//! let matches = match getopts(args.tail(), opts) {
//! Ok(m) => { m }
//! Err(f) => { fail2!(f.to_err_msg()) }
//! Err(f) => { fail!(f.to_err_msg()) }
//! };
//! if matches.opt_present("h") || matches.opt_present("help") {
//! print_usage(program, opts);
@ -190,7 +190,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 => fail2!("No option '{}' defined", nm)
None => fail!("No option '{}' defined", nm)
}
}
@ -556,7 +556,7 @@ pub mod groups {
} = (*self).clone();
match (short_name.len(), long_name.len()) {
(0,0) => fail2!("this long-format option was given no name"),
(0,0) => fail!("this long-format option was given no name"),
(0,_) => Opt {
name: Long((long_name)),
hasarg: hasarg,
@ -582,7 +582,7 @@ pub mod groups {
}
]
},
(_,_) => fail2!("something is wrong with the long-form opt")
(_,_) => fail!("something is wrong with the long-form opt")
}
}
}
@ -701,7 +701,7 @@ pub mod groups {
row.push_str(short_name);
row.push_char(' ');
}
_ => fail2!("the short name should only be 1 ascii char long"),
_ => fail!("the short name should only be 1 ascii char long"),
}
// long option
@ -815,7 +815,7 @@ pub mod groups {
(B, Cr, UnderLim) => { B }
(B, Cr, OverLim) if (i - last_start + 1) > lim
=> fail2!("word starting with {} longer than limit!",
=> fail!("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 }
@ -888,7 +888,7 @@ mod tests {
assert!(m.opt_present("test"));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
_ => { fail2!("test_reqopt_long failed"); }
_ => { fail!("test_reqopt_long failed"); }
}
}
@ -899,7 +899,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -910,7 +910,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -921,7 +921,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -935,7 +935,7 @@ mod tests {
assert!(m.opt_present("t"));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -946,7 +946,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -957,7 +957,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -968,7 +968,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -984,7 +984,7 @@ mod tests {
assert!(m.opt_present("test"));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -995,7 +995,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
_ => fail2!()
_ => fail!()
}
}
@ -1006,7 +1006,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -1017,7 +1017,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -1031,7 +1031,7 @@ mod tests {
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -1042,7 +1042,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
_ => fail2!()
_ => fail!()
}
}
@ -1053,7 +1053,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -1064,7 +1064,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -1077,7 +1077,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(m.opt_present("test")),
_ => fail2!()
_ => fail!()
}
}
@ -1088,7 +1088,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
_ => fail2!()
_ => fail!()
}
}
@ -1099,10 +1099,10 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => {
error2!("{:?}", f.clone().to_err_msg());
error!("{:?}", f.clone().to_err_msg());
check_fail_type(f, UnexpectedArgument_);
}
_ => fail2!()
_ => fail!()
}
}
@ -1113,7 +1113,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -1124,7 +1124,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(m.opt_present("t")),
_ => fail2!()
_ => fail!()
}
}
@ -1135,7 +1135,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
_ => fail2!()
_ => fail!()
}
}
@ -1150,7 +1150,7 @@ mod tests {
assert!(m.free[0] == ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -1161,7 +1161,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
_ => fail2!()
_ => fail!()
}
}
@ -1175,7 +1175,7 @@ mod tests {
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 1);
}
_ => fail2!()
_ => fail!()
}
}
@ -1188,7 +1188,7 @@ mod tests {
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 2);
}
_ => fail2!()
_ => fail!()
}
}
@ -1201,7 +1201,7 @@ mod tests {
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 2);
}
_ => fail2!()
_ => fail!()
}
}
@ -1214,7 +1214,7 @@ mod tests {
Ok(ref m) => {
assert_eq!(m.opt_count("verbose"), 1);
}
_ => fail2!()
_ => fail!()
}
}
@ -1227,7 +1227,7 @@ mod tests {
Ok(ref m) => {
assert_eq!(m.opt_count("verbose"), 2);
}
_ => fail2!()
_ => fail!()
}
}
@ -1242,7 +1242,7 @@ mod tests {
assert!((m.opt_present("test")));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -1253,7 +1253,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
_ => fail2!()
_ => fail!()
}
}
@ -1264,7 +1264,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -1281,7 +1281,7 @@ mod tests {
assert!(pair[0] == ~"20");
assert!(pair[1] == ~"30");
}
_ => fail2!()
_ => fail!()
}
}
@ -1295,7 +1295,7 @@ mod tests {
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
_ => fail2!()
_ => fail!()
}
}
@ -1306,7 +1306,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
_ => fail2!()
_ => fail!()
}
}
@ -1317,7 +1317,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
_ => fail2!()
_ => fail!()
}
}
@ -1334,7 +1334,7 @@ mod tests {
assert!(pair[0] == ~"20");
assert!(pair[1] == ~"30");
}
_ => fail2!()
_ => fail!()
}
}
@ -1345,7 +1345,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, UnrecognizedOption_),
_ => fail2!()
_ => fail!()
}
}
@ -1356,7 +1356,7 @@ mod tests {
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, UnrecognizedOption_),
_ => fail2!()
_ => fail!()
}
}
@ -1388,7 +1388,7 @@ mod tests {
assert!(pair[1] == ~"-60 70");
assert!((!m.opt_present("notpresent")));
}
_ => fail2!()
_ => fail!()
}
}
@ -1399,7 +1399,7 @@ mod tests {
let args_single = ~[~"-e", ~"foo"];
let matches_single = &match getopts(args_single, opts) {
result::Ok(m) => m,
result::Err(_) => fail2!()
result::Err(_) => fail!()
};
assert!(matches_single.opts_present([~"e"]));
assert!(matches_single.opts_present([~"encrypt", ~"e"]));
@ -1415,7 +1415,7 @@ mod tests {
let args_both = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
let matches_both = &match getopts(args_both, opts) {
result::Ok(m) => m,
result::Err(_) => fail2!()
result::Err(_) => fail!()
};
assert!(matches_both.opts_present([~"e"]));
assert!(matches_both.opts_present([~"encrypt"]));
@ -1437,7 +1437,7 @@ mod tests {
let opts = ~[optmulti("L"), optmulti("M")];
let matches = &match getopts(args, opts) {
result::Ok(m) => m,
result::Err(_) => fail2!()
result::Err(_) => fail!()
};
assert!(matches.opts_present([~"L"]));
assert_eq!(matches.opts_str([~"L"]).unwrap(), ~"foo");
@ -1580,8 +1580,8 @@ Options:
let generated_usage = groups::usage("Usage: fruits", optgroups);
debug2!("expected: <<{}>>", expected);
debug2!("generated: <<{}>>", generated_usage);
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", generated_usage);
assert_eq!(generated_usage, expected);
}
@ -1608,8 +1608,8 @@ Options:
let usage = groups::usage("Usage: fruits", optgroups);
debug2!("expected: <<{}>>", expected);
debug2!("generated: <<{}>>", usage);
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", usage);
assert!(usage == expected)
}
@ -1635,8 +1635,8 @@ Options:
let usage = groups::usage("Usage: fruits", optgroups);
debug2!("expected: <<{}>>", expected);
debug2!("generated: <<{}>>", usage);
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", usage);
assert!(usage == expected)
}
}

View file

@ -880,10 +880,10 @@ pub fn Decoder(json: Json) -> Decoder {
impl serialize::Decoder for Decoder {
fn read_nil(&mut self) -> () {
debug2!("read_nil");
debug!("read_nil");
match self.stack.pop() {
Null => (),
value => fail2!("not a null: {:?}", value)
value => fail!("not a null: {:?}", value)
}
}
@ -900,18 +900,18 @@ impl serialize::Decoder for Decoder {
fn read_int(&mut self) -> int { self.read_f64() as int }
fn read_bool(&mut self) -> bool {
debug2!("read_bool");
debug!("read_bool");
match self.stack.pop() {
Boolean(b) => b,
value => fail2!("not a boolean: {:?}", value)
value => fail!("not a boolean: {:?}", value)
}
}
fn read_f64(&mut self) -> f64 {
debug2!("read_f64");
debug!("read_f64");
match self.stack.pop() {
Number(f) => f,
value => fail2!("not a number: {:?}", value)
value => fail!("not a number: {:?}", value)
}
}
fn read_f32(&mut self) -> f32 { self.read_f64() as f32 }
@ -921,20 +921,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 { fail2!("string must have one character") }
if v.len() != 1 { fail!("string must have one character") }
v[0]
}
fn read_str(&mut self) -> ~str {
debug2!("read_str");
debug!("read_str");
match self.stack.pop() {
String(s) => s,
json => fail2!("not a string: {:?}", json)
json => fail!("not a string: {:?}", json)
}
}
fn read_enum<T>(&mut self, name: &str, f: &fn(&mut Decoder) -> T) -> T {
debug2!("read_enum({})", name);
debug!("read_enum({})", name);
f(self)
}
@ -942,13 +942,13 @@ impl serialize::Decoder for Decoder {
names: &[&str],
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_enum_variant(names={:?})", names);
debug!("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(),
_ => fail2!("invalidly encoded json"),
_ => fail!("invalidly encoded json"),
};
match o.find(&~"fields").expect("invalidly encoded json") {
&List(ref l) => {
@ -956,15 +956,15 @@ impl serialize::Decoder for Decoder {
self.stack.push(field.clone());
}
},
_ => fail2!("invalidly encoded json")
_ => fail!("invalidly encoded json")
}
n
}
ref json => fail2!("invalid variant: {:?}", *json),
ref json => fail!("invalid variant: {:?}", *json),
};
let idx = match names.iter().position(|n| str::eq_slice(*n, name)) {
Some(idx) => idx,
None => fail2!("Unknown variant name: {}", name),
None => fail!("Unknown variant name: {}", name),
};
f(self, idx)
}
@ -973,7 +973,7 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_enum_variant_arg(idx={})", idx);
debug!("read_enum_variant_arg(idx={})", idx);
f(self)
}
@ -981,7 +981,7 @@ impl serialize::Decoder for Decoder {
names: &[&str],
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_enum_struct_variant(names={:?})", names);
debug!("read_enum_struct_variant(names={:?})", names);
self.read_enum_variant(names, f)
}
@ -991,7 +991,7 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_enum_struct_variant_field(name={}, idx={})", name, idx);
debug!("read_enum_struct_variant_field(name={}, idx={})", name, idx);
self.read_enum_variant_arg(idx, f)
}
@ -1000,7 +1000,7 @@ impl serialize::Decoder for Decoder {
len: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_struct(name={}, len={})", name, len);
debug!("read_struct(name={}, len={})", name, len);
let value = f(self);
self.stack.pop();
value
@ -1011,12 +1011,12 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_struct_field(name={}, idx={})", name, idx);
debug!("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 => fail2!("no such field: {}", name),
None => fail!("no such field: {}", name),
Some(json) => {
self.stack.push(json);
f(self)
@ -1025,12 +1025,12 @@ impl serialize::Decoder for Decoder {
self.stack.push(Object(obj));
value
}
value => fail2!("not an object: {:?}", value)
value => fail!("not an object: {:?}", value)
}
}
fn read_tuple<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_tuple()");
debug!("read_tuple()");
self.read_seq(f)
}
@ -1038,7 +1038,7 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_tuple_arg(idx={})", idx);
debug!("read_tuple_arg(idx={})", idx);
self.read_seq_elt(idx, f)
}
@ -1046,7 +1046,7 @@ impl serialize::Decoder for Decoder {
name: &str,
f: &fn(&mut Decoder, uint) -> T)
-> T {
debug2!("read_tuple_struct(name={})", name);
debug!("read_tuple_struct(name={})", name);
self.read_tuple(f)
}
@ -1054,7 +1054,7 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_tuple_struct_arg(idx={})", idx);
debug!("read_tuple_struct_arg(idx={})", idx);
self.read_tuple_arg(idx, f)
}
@ -1066,7 +1066,7 @@ impl serialize::Decoder for Decoder {
}
fn read_seq<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_seq()");
debug!("read_seq()");
let len = match self.stack.pop() {
List(list) => {
let len = list.len();
@ -1075,18 +1075,18 @@ impl serialize::Decoder for Decoder {
}
len
}
_ => fail2!("not a list"),
_ => fail!("not a list"),
};
f(self, len)
}
fn read_seq_elt<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T {
debug2!("read_seq_elt(idx={})", idx);
debug!("read_seq_elt(idx={})", idx);
f(self)
}
fn read_map<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
debug2!("read_map()");
debug!("read_map()");
let len = match self.stack.pop() {
Object(obj) => {
let len = obj.len();
@ -1096,7 +1096,7 @@ impl serialize::Decoder for Decoder {
}
len
}
json => fail2!("not an object: {:?}", json),
json => fail!("not an object: {:?}", json),
};
f(self, len)
}
@ -1105,13 +1105,13 @@ impl serialize::Decoder for Decoder {
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_map_elt_key(idx={})", idx);
debug!("read_map_elt_key(idx={})", idx);
f(self)
}
fn read_map_elt_val<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
-> T {
debug2!("read_map_elt_val(idx={})", idx);
debug!("read_map_elt_val(idx={})", idx);
f(self)
}
}

View file

@ -98,7 +98,7 @@ pub fn len<T>(ls: @List<T>) -> uint {
pub fn tail<T>(ls: @List<T>) -> @List<T> {
match *ls {
Cons(_, tl) => return tl,
Nil => fail2!("list empty")
Nil => fail!("list empty")
}
}
@ -107,7 +107,7 @@ pub fn head<T:Clone>(ls: @List<T>) -> T {
match *ls {
Cons(ref hd, _) => (*hd).clone(),
// makes me sad
_ => fail2!("head invoked on empty list")
_ => fail!("head invoked on empty list")
}
}

View file

@ -353,7 +353,7 @@ impl Rem<BigUint, BigUint> for BigUint {
impl Neg<BigUint> for BigUint {
#[inline]
fn neg(&self) -> BigUint { fail2!() }
fn neg(&self) -> BigUint { fail!() }
}
impl Integer for BigUint {
@ -375,7 +375,7 @@ impl Integer for BigUint {
}
fn div_mod_floor(&self, other: &BigUint) -> (BigUint, BigUint) {
if other.is_zero() { fail2!() }
if other.is_zero() { fail!() }
if self.is_zero() { return (Zero::zero(), Zero::zero()); }
if *other == One::one() { return ((*self).clone(), Zero::zero()); }
@ -824,7 +824,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) {
14 => (38416, 4),
15 => (50625, 4),
16 => (65536, 4),
_ => fail2!()
_ => fail!()
}
}
@ -848,7 +848,7 @@ fn get_radix_base(radix: uint) -> (uint, uint) {
14 => (1475789056, 8),
15 => (2562890625, 8),
16 => (4294967296, 8),
_ => fail2!()
_ => fail!()
}
}
@ -1102,7 +1102,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) => fail2!(),
(_, Zero) => fail!(),
(Plus, Plus) | (Zero, Plus) => ( d, r),
(Plus, Minus) | (Zero, Minus) => (-d, r),
(Minus, Plus) => (-d, -r),
@ -1128,7 +1128,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) => fail2!(),
(_, Zero) => fail!(),
(Plus, Plus) | (Zero, Plus) => (d, m),
(Plus, Minus) | (Zero, Minus) => if m.is_zero() {
(-d, Zero::zero())
@ -1942,7 +1942,7 @@ mod biguint_tests {
~"2" +
str::from_chars(vec::from_elem(bits / 2 - 1, '0')) + "1"),
(10, match bits {
32 => ~"8589934593", 16 => ~"131073", _ => fail2!()
32 => ~"8589934593", 16 => ~"131073", _ => fail!()
}),
(16,
~"2" +
@ -1959,7 +1959,7 @@ mod biguint_tests {
(10, match bits {
32 => ~"55340232229718589441",
16 => ~"12885032961",
_ => fail2!()
_ => fail!()
}),
(16, ~"3" +
str::from_chars(vec::from_elem(bits / 4 - 1, '0')) + "2" +
@ -2014,7 +2014,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 => fail2!()
Some(x) => x, None => fail!()
};
assert_eq!(n, ans);
}

View file

@ -50,7 +50,7 @@ impl<T: Clone + Integer + Ord>
#[inline]
pub fn new(numer: T, denom: T) -> Ratio<T> {
if denom == Zero::zero() {
fail2!("denominator == 0");
fail!("denominator == 0");
}
let mut ret = Ratio::new_raw(numer, denom);
ret.reduce();

View file

@ -127,7 +127,7 @@ impl<T> RingBuf<T> {
pub fn get<'a>(&'a self, i: uint) -> &'a T {
let idx = self.raw_index(i);
match self.elts[idx] {
None => fail2!(),
None => fail!(),
Some(ref v) => v
}
}
@ -138,7 +138,7 @@ impl<T> RingBuf<T> {
pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T {
let idx = self.raw_index(i);
match self.elts[idx] {
None => fail2!(),
None => fail!(),
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);
debug2!("{:?}", d.front());
debug!("{:?}", d.front());
assert_eq!(*d.front().unwrap(), 42);
debug2!("{:?}", d.back());
debug!("{:?}", d.back());
assert_eq!(*d.back().unwrap(), 137);
let mut i = d.pop_front();
debug2!("{:?}", i);
debug!("{:?}", i);
assert_eq!(i, Some(42));
i = d.pop_back();
debug2!("{:?}", i);
debug!("{:?}", i);
assert_eq!(i, Some(137));
i = d.pop_back();
debug2!("{:?}", i);
debug!("{:?}", i);
assert_eq!(i, Some(137));
i = d.pop_back();
debug2!("{:?}", i);
debug!("{:?}", 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);
debug2!("{:?}", d.get(0));
debug2!("{:?}", d.get(1));
debug2!("{:?}", d.get(2));
debug2!("{:?}", d.get(3));
debug!("{:?}", d.get(0));
debug!("{:?}", d.get(1));
debug!("{:?}", d.get(2));
debug!("{:?}", d.get(3));
assert_eq!(*d.get(0), 1);
assert_eq!(*d.get(1), 2);
assert_eq!(*d.get(2), 3);

View file

@ -159,7 +159,7 @@ fn take_nonempty_prefix(rdr: @io::Reader,
if buf.is_empty() {
bad_parse::cond.raise(())
}
debug2!("extracted nonempty prefix: {}", buf);
debug!("extracted nonempty prefix: {}", buf);
(buf, ch)
}
@ -235,7 +235,7 @@ pub fn parse(s: &str) -> Option<Version> {
}
let s = s.trim();
let mut bad = false;
do bad_parse::cond.trap(|_| { debug2!("bad"); bad = true }).inside {
do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).inside {
do io::with_str_reader(s) |rdr| {
let v = parse_reader(rdr);
if bad || v.to_str() != s.to_owned() {

View file

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

View file

@ -564,7 +564,7 @@ impl<T:Clone + Ord> MergeState<T> {
shift_vec(array, dest, c2, len2);
swap(&mut array[dest+len2], &mut tmp[c1]);
} else if len1 == 0 {
fail2!("Comparison violates its contract!");
fail!("Comparison violates its contract!");
} else {
assert_eq!(len2, 0);
assert!(len1 > 1);
@ -683,7 +683,7 @@ impl<T:Clone + Ord> MergeState<T> {
shift_vec(array, dest+1, c1+1, len1);
swap(&mut array[dest], &mut tmp[c2]);
} else if len2 == 0 {
fail2!("Comparison violates its contract!");
fail!("Comparison violates its contract!");
} else {
assert_eq!(len1, 0);
assert!(len2 != 0);
@ -790,7 +790,7 @@ mod test_qsort {
quick_sort::<int>(v1, leual);
let mut i = 0u;
while i < len {
// debug2!(v2[i]);
// debug!(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()) {
debug2!("{} {}", a, b);
debug!("{} {}", a, b);
assert_eq!(a, b);
}
}
@ -851,7 +851,7 @@ mod tests {
let v3 = merge_sort::<int>(v1, f);
let mut i = 0u;
while i < len {
debug2!("{:?}", v3[i]);
debug!("{:?}", 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::<f64>() > 0.995 {
fail2!("It's happening!!!");
fail!("It's happening!!!");
}
(*self).val < other.val
}
@ -936,7 +936,7 @@ mod test_tim_sort {
tim_sort::<int>(v1);
let mut i = 0u;
while i < len {
// debug2!(v2[i]);
// debug!(v2[i]);
assert_eq!(v2[i], v1[i]);
i += 1u;
}
@ -977,7 +977,7 @@ mod test_tim_sort {
};
tim_sort(arr);
fail2!("Guarantee the fail");
fail!("Guarantee the fail");
}
#[deriving(Clone)]
@ -1045,7 +1045,7 @@ mod big_tests {
fn isSorted<T:Ord>(arr: &[T]) {
for i in range(0u, arr.len() - 1) {
if arr[i] > arr[i+1] {
fail2!("Array not sorted");
fail!("Array not sorted");
}
}
}
@ -1116,7 +1116,7 @@ mod big_tests {
fn isSorted<T:Ord>(arr: &[@T]) {
for i in range(0u, arr.len() - 1) {
if arr[i] > arr[i+1] {
fail2!("Array not sorted");
fail!("Array not sorted");
}
}
}

View file

@ -309,9 +309,9 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
blk: &fn() -> U) -> U {
match out_of_bounds {
Some(0) =>
fail2!("{} with illegal ID {} - this lock has no condvars!", act, id),
fail!("{} with illegal ID {} - this lock has no condvars!", act, id),
Some(length) =>
fail2!("{} with illegal ID {} - ID must be less than {}", act, id, length),
fail!("{} with illegal ID {} - ID must be less than {}", act, id, length),
None => blk()
}
}
@ -636,7 +636,7 @@ impl RWLock {
pub fn downgrade<'a>(&self, token: RWLockWriteMode<'a>)
-> RWLockReadMode<'a> {
if !borrow::ref_eq(self, token.lock) {
fail2!("Can't downgrade() with a different rwlock's write_mode!");
fail!("Can't downgrade() with a different rwlock's write_mode!");
}
unsafe {
do task::unkillable {
@ -920,7 +920,7 @@ mod tests {
let result: result::Result<(),()> = do task::try {
do m2.lock {
fail2!();
fail!();
}
};
assert!(result.is_err());
@ -940,7 +940,7 @@ mod tests {
do task::spawn || { // linked
let _ = p.recv(); // wait for sibling to get in the mutex
task::deschedule();
fail2!();
fail!();
}
do m2.lock_cond |cond| {
c.send(()); // tell sibling go ahead
@ -978,9 +978,9 @@ mod tests {
do (|| {
cond.wait(); // block forever
}).finally {
error2!("task unwinding and sending");
error!("task unwinding and sending");
c.send(());
error2!("task unwinding and done sending");
error!("task unwinding and done sending");
}
}
}
@ -990,7 +990,7 @@ mod tests {
}
do m2.lock { }
c.send(sibling_convos); // let parent wait on all children
fail2!();
fail!();
};
assert!(result.is_err());
// child task must have finished by the time try returns
@ -1030,7 +1030,7 @@ mod tests {
let _ = p.recv();
do m.lock_cond |cond| {
if !cond.signal_on(0) {
fail2!(); // success; punt sibling awake.
fail!(); // success; punt sibling awake.
}
}
};
@ -1274,7 +1274,7 @@ mod tests {
let result: result::Result<(),()> = do task::try || {
do lock_rwlock_in_mode(&x2, mode1) {
fail2!();
fail!();
}
};
assert!(result.is_err());
@ -1321,7 +1321,7 @@ mod tests {
let mut xopt = Some(xwrite);
do y.write_downgrade |_ywrite| {
y.downgrade(xopt.take_unwrap());
error2!("oops, y.downgrade(x) should have failed!");
error!("oops, y.downgrade(x) should have failed!");
}
}
}

View file

@ -147,7 +147,7 @@ impl Terminal {
self.out.write(s.unwrap());
return true
} else {
warn2!("{}", s.unwrap_err());
warn!("{}", s.unwrap_err());
}
}
false
@ -167,7 +167,7 @@ impl Terminal {
self.out.write(s.unwrap());
return true
} else {
warn2!("{}", s.unwrap_err());
warn!("{}", s.unwrap_err());
}
}
false
@ -188,7 +188,7 @@ impl Terminal {
self.out.write(s.unwrap());
return true
} else {
warn2!("{}", s.unwrap_err());
warn!("{}", 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 {
warn2!("{}", s.unwrap_err());
warn!("{}", s.unwrap_err());
} else {
// if we support attributes but not color, it would be nice to still warn2!()
// if we support attributes but not color, it would be nice to still warn!()
// but it's not worth testing all known attributes just for this.
debug2!("{}", s.unwrap_err());
debug!("{}", s.unwrap_err());
}
}

View file

@ -462,7 +462,7 @@ impl FormatOp {
'x' => FormatHex,
'X' => FormatHEX,
's' => FormatString,
_ => fail2!("bad FormatOp char")
_ => fail!("bad FormatOp char")
}
}
fn to_char(self) -> char {

View file

@ -190,26 +190,26 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
assert!(names_bytes > 0);
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);
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);
if (bools_bytes as uint) > boolnames.len() {
error2!("expected bools_bytes to be less than {} but found {}", boolnames.len(),
error!("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() {
error2!("expected numbers_count to be less than {} but found {}", numnames.len(),
error!("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() {
error2!("expected string_offsets_count to be less than {} but found {}", stringnames.len(),
error!("expected string_offsets_count to be less than {} but found {}", stringnames.len(),
string_offsets_count);
return Err(~"incompatible file: more string offsets than expected");
}
@ -219,26 +219,26 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
file.read_byte(); // consume NUL
debug2!("term names: {:?}", term_names);
debug!("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 {
error2!("EOF reading bools after {} entries", i);
error!("EOF reading bools after {} entries", i);
return Err(~"error: expected more bools but hit EOF");
} else if b == 1 {
debug2!("{} set", bnames[i]);
debug!("{} set", bnames[i]);
bools_map.insert(bnames[i].to_owned(), true);
}
}
}
debug2!("bools: {:?}", bools_map);
debug!("bools: {:?}", bools_map);
if (bools_bytes + names_bytes) % 2 == 1 {
debug2!("adjusting for padding between bools and numbers");
debug!("adjusting for padding between bools and numbers");
file.read_byte(); // compensate for padding
}
@ -247,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 {
debug2!("{}\\#{}", nnames[i], n);
debug!("{}\\#{}", nnames[i], n);
numbers_map.insert(nnames[i].to_owned(), n);
}
}
}
debug2!("numbers: {:?}", numbers_map);
debug!("numbers: {:?}", numbers_map);
let mut string_map = HashMap::new();
@ -263,12 +263,12 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
string_offsets.push(file.read_le_u16());
}
debug2!("offsets: {:?}", string_offsets);
debug!("offsets: {:?}", string_offsets);
let string_table = file.read_bytes(string_table_bytes as uint);
if string_table.len() != string_table_bytes as uint {
error2!("EOF reading string table after {} bytes, wanted {}", string_table.len(),
error!("EOF reading string table after {} bytes, wanted {}", string_table.len(),
string_table_bytes);
return Err(~"error: hit EOF before end of string table");
}

View file

@ -155,10 +155,10 @@ 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)) => fail!("{}", msg),
None => return
};
if !run_tests_console(&opts, tests) { fail2!("Some tests failed"); }
if !run_tests_console(&opts, tests) { fail!("Some tests failed"); }
}
// A variant optimized for invocation with a static test vector.
@ -178,7 +178,7 @@ pub fn test_main_static(args: &[~str], tests: &[TestDescAndFn]) {
TestDescAndFn { testfn: StaticBenchFn(f), desc: t.desc.clone() },
_ => {
fail2!("non-static tests passed to test::test_main_static");
fail!("non-static tests passed to test::test_main_static");
}
}
};
@ -240,7 +240,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 fail2!)
the code causes a failure (an assertion failure or fail!)
#[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
@ -358,7 +358,7 @@ impl ConsoleTestState {
io::Truncate]) {
result::Ok(w) => Some(w),
result::Err(ref s) => {
fail2!("can't open output file: {}", *s)
fail!("can't open output file: {}", *s)
}
},
None => None
@ -607,7 +607,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) {
debug2!("callback(event={:?})", event);
debug!("callback(event={:?})", event);
match (*event).clone() {
TeFiltered(ref filtered_tests) => st.write_run_start(filtered_tests.len()),
TeWait(ref test, padding) => st.write_test_start(test, padding),
@ -649,7 +649,7 @@ pub fn run_tests_console(opts: &TestOpts,
match tests.iter().max_by(|t|len_if_padded(*t)) {
Some(t) => {
let n = t.desc.name.to_str();
debug2!("Setting max_name_len from: {}", n);
debug!("Setting max_name_len from: {}", n);
st.max_name_len = n.len();
},
None => {}
@ -736,7 +736,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();
debug2!("using {} test tasks", concurrency);
debug!("using {} test tasks", concurrency);
let mut remaining = filtered_tests;
remaining.reverse();
@ -783,7 +783,7 @@ fn get_concurrency() -> uint {
let opt_n: Option<uint> = FromStr::from_str(s);
match opt_n {
Some(n) if n > 0 => n,
_ => fail2!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s)
_ => fail!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s)
}
}
None => {
@ -1047,7 +1047,7 @@ impl MetricMap {
};
if ok {
debug2!("rewriting file '{:?}' with updated metrics", p);
debug!("rewriting file '{:?}' with updated metrics", p);
self.save(p);
}
return (diff, ok)
@ -1086,7 +1086,7 @@ impl BenchHarness {
pub fn bench_n(&mut self, n: u64, f: &fn(&mut BenchHarness)) {
self.iterations = n;
debug2!("running benchmark for {} iterations",
debug!("running benchmark for {} iterations",
n as uint);
f(self);
}
@ -1127,7 +1127,7 @@ impl BenchHarness {
stats::winsorize(samples, 5.0);
let summ5 = stats::Summary::new(samples);
debug2!("{} samples, median {}, MAD={}, MADP={}",
debug!("{} samples, median {}, MAD={}, MADP={}",
samples.len(),
summ.median as f64,
summ.median_abs_dev as f64,
@ -1198,7 +1198,7 @@ mod tests {
#[test]
pub fn do_not_run_ignored_tests() {
fn f() { fail2!(); }
fn f() { fail!(); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
@ -1234,7 +1234,7 @@ mod tests {
#[test]
fn test_should_fail() {
fn f() { fail2!(); }
fn f() { fail!(); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
@ -1273,7 +1273,7 @@ mod tests {
let args = ~[~"progname", ~"filter"];
let opts = match parse_opts(args) {
Some(Ok(o)) => o,
_ => fail2!("Malformed arg in first_free_arg_should_be_a_filter")
_ => fail!("Malformed arg in first_free_arg_should_be_a_filter")
};
assert!("filter" == opts.filter.clone().unwrap());
}
@ -1283,7 +1283,7 @@ mod tests {
let args = ~[~"progname", ~"filter", ~"--ignored"];
let opts = match parse_opts(args) {
Some(Ok(o)) => o,
_ => fail2!("Malformed arg in parse_ignored_flag")
_ => fail!("Malformed arg in parse_ignored_flag")
};
assert!((opts.run_ignored));
}

View file

@ -955,13 +955,13 @@ mod tests {
static SOME_FUTURE_DATE: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
let tv1 = get_time();
debug2!("tv1={:?} sec + {:?} nsec", tv1.sec as uint, tv1.nsec as uint);
debug!("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();
debug2!("tv2={:?} sec + {:?} nsec", tv2.sec as uint, tv2.nsec as uint);
debug!("tv2={:?} sec + {:?} nsec", tv2.sec as uint, tv2.nsec as uint);
assert!(tv2.sec >= tv1.sec);
assert!(tv2.sec < SOME_FUTURE_DATE);
@ -975,16 +975,16 @@ mod tests {
let s0 = precise_time_s();
let ns1 = precise_time_ns();
debug2!("s0={} sec", f64::to_str_digits(s0, 9u));
debug!("s0={} sec", f64::to_str_digits(s0, 9u));
assert!(s0 > 0.);
let ns0 = (s0 * 1000000000.) as u64;
debug2!("ns0={:?} ns", ns0);
debug!("ns0={:?} ns", ns0);
debug2!("ns1={:?} ns", ns0);
debug!("ns1={:?} ns", ns0);
assert!(ns1 >= ns0);
let ns2 = precise_time_ns();
debug2!("ns2={:?} ns", ns0);
debug!("ns2={:?} ns", ns0);
assert!(ns2 >= ns1);
}
@ -1016,7 +1016,7 @@ mod tests {
let time = Timespec::new(1234567890, 54321);
let local = at(time);
error2!("time_at: {:?}", local);
error!("time_at: {:?}", local);
assert!(local.tm_sec == 30_i32);
assert!(local.tm_min == 31_i32);
@ -1091,7 +1091,7 @@ mod tests {
== Err(~"Invalid time"));
match strptime("Fri Feb 13 15:31:30.01234 2009", format) {
Err(e) => fail2!(e),
Err(e) => fail!(e),
Ok(ref tm) => {
assert!(tm.tm_sec == 30_i32);
assert!(tm.tm_min == 31_i32);
@ -1111,7 +1111,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) => fail2!(e)
Err(e) => fail!(e)
}
}
@ -1237,7 +1237,7 @@ mod tests {
let utc = at_utc(time);
let local = at(time);
error2!("test_ctime: {:?} {:?}", utc.ctime(), local.ctime());
error!("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");

View file

@ -831,7 +831,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
}
}
return match node.take() {
Some(~TreeNode{value, _}) => Some(value), None => fail2!()
Some(~TreeNode{value, _}) => Some(value), None => fail!()
};
}
@ -900,7 +900,7 @@ mod test_treemap {
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));
}

View file

@ -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) => fail2!("Couldn't load workcache database {}: {}",
Err(e) => fail!("Couldn't load workcache database {}: {}",
self.db_filename.display(), e.to_str()),
Ok(r) =>
match json::from_reader(r) {
Err(e) => fail2!("Couldn't parse workcache database (from file {}): {}",
Err(e) => fail!("Couldn't parse workcache database (from file {}): {}",
self.db_filename.display(), e.to_str()),
Ok(r) => {
let mut decoder = json::Decoder(r);
@ -219,7 +219,7 @@ impl Logger {
}
pub fn info(&self, i: &str) {
info2!("workcache: {}", i);
info!("workcache: {}", i);
}
}
@ -264,7 +264,7 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
// FIXME(#5121)
fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
debug2!("json decoding: {}", s);
debug!("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) {
debug2!("Discovering input {} {} {}", dependency_kind, dependency_name, dependency_val);
debug!("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) {
debug2!("Discovering output {} {} {}", dependency_kind, dependency_name, dependency_val);
debug!("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) {
debug2!("Declaring input {} {} {}", kind, name, val);
debug!("Declaring input {} {} {}", kind, name, val);
self.declared_inputs.insert_work_key(WorkKey::new(kind, name),
val.to_owned());
}
@ -377,9 +377,9 @@ impl<'self> Prep<'self> {
name: &str, val: &str) -> bool {
let k = kind.to_owned();
let f = self.ctxt.freshness.get().find(&k);
debug2!("freshness for: {}/{}/{}/{}", cat, kind, name, val)
debug!("freshness for: {}/{}/{}/{}", cat, kind, name, val)
let fresh = match f {
None => fail2!("missing freshness-function for '{}'", kind),
None => fail!("missing freshness-function for '{}'", kind),
Some(f) => (*f)(name, val)
};
do self.ctxt.logger.write |lg| {
@ -418,7 +418,7 @@ impl<'self> Prep<'self> {
&'self self, blk: ~fn(&mut Exec) -> T) -> Work<'self, T> {
let mut bo = Some(blk);
debug2!("exec_work: looking up {} and {:?}", self.fn_name,
debug!("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) => {
debug2!("Cache hit!");
debug2!("Trying to decode: {:?} / {:?} / {}",
debug!("Cache hit!");
debug!("Trying to decode: {:?} / {:?} / {}",
disc_in, disc_out, *res);
Work::from_value(json_decode(*res))
}
_ => {
debug2!("Cache miss!");
debug!("Cache miss!");
let (port, chan) = oneshot();
let blk = bo.take_unwrap();
let chan = Cell::new(chan);