Skip to content

Commit

Permalink
Drop the '2' suffix from logging macros
Browse files Browse the repository at this point in the history
Who doesn't like a massive renaming?
  • Loading branch information
alexcrichton committed Oct 22, 2013
1 parent 15a6bde commit daf5f5a
Show file tree
Hide file tree
Showing 726 changed files with 3,075 additions and 3,075 deletions.
14 changes: 7 additions & 7 deletions src/compiletest/compiletest.rs
Expand Up @@ -85,20 +85,20 @@ pub fn parse_config(args: ~[~str]) -> config {
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
println(getopts::groups::usage(message, groups));
println("");
fail2!()
fail!()
}

let matches =
&match getopts::groups::getopts(args_, groups) {
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") {
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
println(getopts::groups::usage(message, groups));
println("");
fail2!()
fail!()
}

fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
Expand Down Expand Up @@ -203,7 +203,7 @@ pub fn str_mode(s: ~str) -> mode {
~"pretty" => mode_pretty,
~"debug-info" => mode_debug_info,
~"codegen" => mode_codegen,
_ => fail2!("invalid mode")
_ => fail!("invalid mode")
}
}

Expand All @@ -226,7 +226,7 @@ pub fn run_tests(config: &config) {
// For context, see #8904
rt::test::prepare_for_lots_of_tests();
let res = test::run_tests_console(&opts, tests);
if !res { fail2!("Some tests failed"); }
if !res { fail!("Some tests failed"); }
}

pub fn test_opts(config: &config) -> test::TestOpts {
Expand All @@ -244,13 +244,13 @@ pub fn test_opts(config: &config) -> test::TestOpts {
}

pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
debug2!("making tests from {}",
debug!("making tests from {}",
config.src_base.display());
let mut tests = ~[];
let dirs = os::list_dir_path(&config.src_base);
for file in dirs.iter() {
let file = file.clone();
debug2!("inspecting file {}", file.display());
debug!("inspecting file {}", file.display());
if is_test(config, &file) {
let t = do make_test(config, &file) {
match config.mode {
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/errors.rs
Expand Up @@ -61,7 +61,7 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
let msg = line.slice(idx, len).to_owned();

debug2!("line={} kind={} msg={}", line_num - adjust_line, kind, msg);
debug!("line={} kind={} msg={}", line_num - adjust_line, kind, msg);

return ~[ExpectedError{line: line_num - adjust_line, kind: kind,
msg: msg}];
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/header.rs
Expand Up @@ -154,7 +154,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
let end = strs.pop();
(strs.pop(), end)
}
n => fail2!("Expected 1 or 2 strings, not {}", n)
n => fail!("Expected 1 or 2 strings, not {}", n)
}
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ fn parse_name_value_directive(line: &str,
Some(colon) => {
let value = line.slice(colon + keycolon.len(),
line.len()).to_owned();
debug2!("{}: {}", directive, value);
debug!("{}: {}", directive, value);
Some(value)
}
None => None
Expand Down
20 changes: 10 additions & 10 deletions src/compiletest/runtest.rs
Expand Up @@ -63,9 +63,9 @@ pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {
io::stdout().write_str("\n\n");
}
let testfile = Path::new(testfile);
debug2!("running {}", testfile.display());
debug!("running {}", testfile.display());
let props = load_props(&testfile);
debug2!("loaded props");
debug!("loaded props");
match config.mode {
mode_compile_fail => run_cfail_test(&config, &props, &testfile),
mode_run_fail => run_rfail_test(&config, &props, &testfile),
Expand Down Expand Up @@ -241,7 +241,7 @@ actual:\n\
\n",
expected, actual);
io::stdout().write_str(msg);
fail2!();
fail!();
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
let script_str = [~"set charset UTF-8",
cmds,
~"quit\n"].connect("\n");
debug2!("script_str = {}", script_str);
debug!("script_str = {}", script_str);
dump_output_file(config, testfile, script_str, "debugger.script");

// run debugger script with gdb
Expand Down Expand Up @@ -348,10 +348,10 @@ fn check_error_patterns(props: &TestProps,
let mut done = false;
for line in ProcRes.stderr.line_iter() {
if line.contains(*next_err_pat) {
debug2!("found error pattern {}", *next_err_pat);
debug!("found error pattern {}", *next_err_pat);
next_err_idx += 1u;
if next_err_idx == props.error_patterns.len() {
debug2!("found all error patterns");
debug!("found all error patterns");
done = true;
break;
}
Expand Down Expand Up @@ -423,7 +423,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
let mut was_expected = false;
for (i, ee) in expected_errors.iter().enumerate() {
if !found_flags[i] {
debug2!("prefix={} ee.kind={} ee.msg={} line={}",
debug!("prefix={} ee.kind={} ee.msg={} line={}",
prefixes[i], ee.kind, ee.msg, line);
if (prefix_matches(line, prefixes[i]) &&
line.contains(ee.kind) &&
Expand Down Expand Up @@ -626,7 +626,7 @@ fn compose_and_run_compiler(
fn ensure_dir(path: &Path) {
if os::path_is_dir(path) { return; }
if !os::make_dir(path, 0x1c0i32) {
fail2!("can't make dir {}", path.display());
fail!("can't make dir {}", path.display());
}
}

Expand Down Expand Up @@ -784,7 +784,7 @@ fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) {
fn error(err: ~str) { io::stdout().write_line(format!("\nerror: {}", err)); }

fn fatal(err: ~str) -> ! { error(err); fail2!(); }
fn fatal(err: ~str) -> ! { error(err); fail!(); }

fn fatal_ProcRes(err: ~str, ProcRes: &ProcRes) -> ! {
let msg =
Expand All @@ -802,7 +802,7 @@ stderr:\n\
\n",
err, ProcRes.cmdline, ProcRes.stdout, ProcRes.stderr);
io::stdout().write_str(msg);
fail2!();
fail!();
}

fn _arm_exec_compiled_test(config: &config, props: &TestProps,
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/util.rs
Expand Up @@ -29,7 +29,7 @@ pub fn get_os(triple: &str) -> &'static str {
return os
}
}
fail2!("Cannot determine OS from triple");
fail!("Cannot determine OS from triple");
}

pub fn make_new_path(path: &str) -> ~str {
Expand Down Expand Up @@ -63,6 +63,6 @@ pub fn path_div() -> ~str { ~":" }
pub fn path_div() -> ~str { ~";" }
pub fn logv(config: &config, s: ~str) {
debug2!("{}", s);
debug!("{}", s);
if config.verbose { io::println(s); }
}
10 changes: 5 additions & 5 deletions src/libextra/arc.rs
Expand Up @@ -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
}
Expand Down Expand Up @@ -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!");
}
}
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/arena.rs
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -305,6 +305,6 @@ fn test_arena_destructors_fail() {
// Now, fail while allocating
do arena.alloc::<@int> {
// Now fail.
fail2!();
fail!();
};
}
2 changes: 1 addition & 1 deletion src/libextra/base64.rs
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/bitv.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
};
}

Expand All @@ -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)
};
}

Expand Down
6 changes: 3 additions & 3 deletions src/libextra/comm.rs
Expand Up @@ -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()
}
Expand All @@ -189,7 +189,7 @@ mod test {
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
fail2!()
fail!()
}
chan.try_send(());
}
Expand All @@ -200,7 +200,7 @@ mod test {
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
fail2!()
fail!()
}
chan.send(());
}
Expand Down
14 changes: 7 additions & 7 deletions src/libextra/crypto/cryptoutil.rs
Expand Up @@ -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) {
Expand All @@ -144,15 +144,15 @@ 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.")
}
}
},
None => {
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
Expand All @@ -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.")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/dlist.rs
Expand Up @@ -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) => {
Expand Down

0 comments on commit daf5f5a

Please sign in to comment.