auto merge of #10006 : alexcrichton/rust/another-massive-rename, r=brson

Drop the `2` suffix on all of them, updating all code in the process of doing so. This is a completely automated change, and it's dependent on the snapshots going through.
This commit is contained in:
bors 2013-10-22 09:24:48 -07:00
commit fd2c0128a7
729 changed files with 3076 additions and 3084 deletions

View file

@ -700,15 +700,15 @@ mod math {
type complex = (f64, f64);
fn sin(f: f64) -> f64 {
...
# fail2!();
# fail!();
}
fn cos(f: f64) -> f64 {
...
# fail2!();
# fail!();
}
fn tan(f: f64) -> f64 {
...
# fail2!();
# fail!();
}
}
~~~~
@ -1059,8 +1059,8 @@ output slot type would normally be. For example:
~~~~
fn my_err(s: &str) -> ! {
info2!("{}", s);
fail2!();
info!("{}", s);
fail!();
}
~~~~
@ -1078,7 +1078,7 @@ were declared without the `!` annotation, the following code would not
typecheck:
~~~~
# fn my_err(s: &str) -> ! { fail2!() }
# fn my_err(s: &str) -> ! { fail!() }
fn f(i: int) -> int {
if i == 42 {
@ -2826,9 +2826,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
let x: List<int> = Cons(10, @Cons(11, @Nil));
match x {
Cons(_, @Nil) => fail2!("singleton list"),
Cons(_, @Nil) => fail!("singleton list"),
Cons(*) => return,
Nil => fail2!("empty list")
Nil => fail!("empty list")
}
~~~~
@ -2864,7 +2864,7 @@ match x {
return;
}
_ => {
fail2!();
fail!();
}
}
~~~~
@ -2918,7 +2918,7 @@ guard may refer to the variables bound within the pattern they follow.
let message = match maybe_digit {
Some(x) if x < 10 => process_digit(x),
Some(x) => process_other(x),
None => fail2!()
None => fail!()
};
~~~~
@ -3669,10 +3669,10 @@ that demonstrates all four of them:
~~~~
fn main() {
error2!("This is an error log")
warn2!("This is a warn log")
info2!("this is an info log")
debug2!("This is a debug log")
error!("This is an error log")
warn!("This is a warn log")
info!("this is an info log")
debug!("This is a debug log")
}
~~~~

View file

@ -226,7 +226,7 @@ match x {
// complicated stuff goes here
return result + val;
},
_ => fail2!("Didn't get good_2")
_ => fail!("Didn't get good_2")
}
}
_ => return 0 // default value
@ -268,7 +268,7 @@ macro_rules! biased_match (
biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
binds g1, val )
biased_match!((g1.body) ~ (good_2(result) )
else { fail2!("Didn't get good_2") };
else { fail!("Didn't get good_2") };
binds result )
// complicated stuff goes here
return result + val;
@ -369,7 +369,7 @@ macro_rules! biased_match (
# fn f(x: t1) -> uint {
biased_match!(
(x) ~ (good_1(g1, val)) else { return 0 };
(g1.body) ~ (good_2(result) ) else { fail2!("Didn't get good_2") };
(g1.body) ~ (good_2(result) ) else { fail!("Didn't get good_2") };
binds val, result )
// complicated stuff goes here
return result + val;

View file

@ -763,7 +763,7 @@ unit, `()`, as the empty tuple if you like).
~~~~
let mytup: (int, int, f64) = (10, 20, 30.0);
match mytup {
(a, b, c) => info2!("{}", a + b + (c as int))
(a, b, c) => info!("{}", a + b + (c as int))
}
~~~~
@ -779,7 +779,7 @@ For example:
struct MyTup(int, int, f64);
let mytup: MyTup = MyTup(10, 20, 30.0);
match mytup {
MyTup(a, b, c) => info2!("{}", a + b + (c as int))
MyTup(a, b, c) => info!("{}", a + b + (c as int))
}
~~~~
@ -1576,7 +1576,7 @@ arguments.
use std::task::spawn;
do spawn() || {
debug2!("I'm a task, whatever");
debug!("I'm a task, whatever");
}
~~~~
@ -1588,7 +1588,7 @@ may be omitted from `do` expressions.
use std::task::spawn;
do spawn {
debug2!("Kablam!");
debug!("Kablam!");
}
~~~~

View file

@ -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 {
@ -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")
}
}
@ -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 {
@ -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 {

View file

@ -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}];

View file

@ -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)
}
}
}
@ -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

View file

@ -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),
@ -241,7 +241,7 @@ actual:\n\
\n",
expected, actual);
io::stdout().write_str(msg);
fail2!();
fail!();
}
}
@ -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
@ -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;
}
@ -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) &&
@ -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());
}
}
@ -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 =
@ -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,

View file

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

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);

View file

@ -129,13 +129,13 @@ pub mod jit {
let cstore = sess.cstore;
let r = cstore::get_used_crate_files(cstore);
for cratepath in r.iter() {
debug2!("linking: {}", cratepath.display());
debug!("linking: {}", cratepath.display());
do cratepath.with_c_str |buf_t| {
if !llvm::LLVMRustLoadCrate(manager, buf_t) {
llvm_err(sess, ~"Could not link");
}
debug2!("linked: {}", cratepath.display());
debug!("linked: {}", cratepath.display());
}
}
@ -915,20 +915,20 @@ pub fn link_binary(sess: Session,
let output = if *sess.building_library {
let long_libname = output_dll_filename(sess.targ_cfg.os, lm);
debug2!("link_meta.name: {}", lm.name);
debug2!("long_libname: {}", long_libname);
debug2!("out_filename: {}", out_filename.display());
debug!("link_meta.name: {}", lm.name);
debug!("long_libname: {}", long_libname);
debug!("out_filename: {}", out_filename.display());
let out_dirname = out_filename.dir_path();
debug2!("dirname(out_filename): {}", out_dirname.display());
debug!("dirname(out_filename): {}", out_dirname.display());
out_filename.with_filename(long_libname)
} else {
out_filename.clone()
};
debug2!("output: {}", output.display());
debug!("output: {}", output.display());
let cc_args = link_args(sess, obj_filename, out_filename, lm);
debug2!("{} link args: {}", cc_prog, cc_args.connect(" "));
debug!("{} link args: {}", cc_prog, cc_args.connect(" "));
if (sess.opts.debugging_opts & session::print_link_args) != 0 {
io::println(format!("{} link args: {}", cc_prog, cc_args.connect(" ")));
}

View file

@ -29,7 +29,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
return ~[];
}
debug2!("preparing the RPATH!");
debug!("preparing the RPATH!");
let sysroot = sess.filesearch.sysroot();
let output = out_filename;
@ -60,13 +60,13 @@ fn get_rpaths(os: session::Os,
output: &Path,
libs: &[Path],
target_triple: &str) -> ~[~str] {
debug2!("sysroot: {}", sysroot.display());
debug2!("output: {}", output.display());
debug2!("libs:");
debug!("sysroot: {}", sysroot.display());
debug!("output: {}", output.display());
debug!("libs:");
for libpath in libs.iter() {
debug2!(" {}", libpath.display());
debug!(" {}", libpath.display());
}
debug2!("target_triple: {}", target_triple);
debug!("target_triple: {}", target_triple);
// Use relative paths to the libraries. Binaries can be moved
// as long as they maintain the relative relationship to the
@ -81,9 +81,9 @@ fn get_rpaths(os: session::Os,
let fallback_rpaths = ~[get_install_prefix_rpath(target_triple)];
fn log_rpaths(desc: &str, rpaths: &[~str]) {
debug2!("{} rpaths:", desc);
debug!("{} rpaths:", desc);
for rpath in rpaths.iter() {
debug2!(" {}", *rpath);
debug!(" {}", *rpath);
}
}
@ -188,7 +188,7 @@ mod test {
let res = get_install_prefix_rpath("triple");
let mut d = Path::new(env!("CFG_PREFIX"));
d.push("lib/rustc/triple/lib");
debug2!("test_prefix_path: {} vs. {}",
debug!("test_prefix_path: {} vs. {}",
res,
d.display());
assert!(res.as_bytes().ends_with(d.as_vec()));
@ -248,7 +248,7 @@ mod test {
fn test_get_absolute_rpath() {
let res = get_absolute_rpath(&Path::new("lib/libstd.so"));
let lib = os::make_absolute(&Path::new("lib"));
debug2!("test_get_absolute_rpath: {} vs. {}",
debug!("test_get_absolute_rpath: {} vs. {}",
res.to_str(), lib.display());
// FIXME (#9639): This needs to handle non-utf8 paths

View file

@ -394,7 +394,7 @@ pub fn phase_6_link_output(sess: Session,
pub fn stop_after_phase_3(sess: Session) -> bool {
if sess.opts.no_trans {
debug2!("invoked with --no-trans, returning early from compile_input");
debug!("invoked with --no-trans, returning early from compile_input");
return true;
}
return false;
@ -402,7 +402,7 @@ pub fn stop_after_phase_3(sess: Session) -> bool {
pub fn stop_after_phase_1(sess: Session) -> bool {
if sess.opts.parse_only {
debug2!("invoked with --parse-only, returning early from compile_input");
debug!("invoked with --parse-only, returning early from compile_input");
return true;
}
return false;
@ -410,17 +410,17 @@ pub fn stop_after_phase_1(sess: Session) -> bool {
pub fn stop_after_phase_5(sess: Session) -> bool {
if sess.opts.output_type != link::output_type_exe {
debug2!("not building executable, returning early from compile_input");
debug!("not building executable, returning early from compile_input");
return true;
}
if sess.opts.is_static && *sess.building_library {
debug2!("building static library, returning early from compile_input");
debug!("building static library, returning early from compile_input");
return true;
}
if sess.opts.jit {
debug2!("running JIT, returning early from compile_input");
debug!("running JIT, returning early from compile_input");
return true;
}
return false;
@ -1045,7 +1045,7 @@ pub fn build_output_filenames(input: &input,
pub fn early_error(emitter: @diagnostic::Emitter, msg: &str) -> ! {
emitter.emit(None, msg, diagnostic::fatal);
fail2!();
fail!();
}
pub fn list_metadata(sess: Session, path: &Path, out: @io::Writer) {
@ -1070,7 +1070,7 @@ mod test {
let matches =
&match getopts([~"--test"], optgroups()) {
Ok(m) => m,
Err(f) => fail2!("test_switch_implies_cfg_test: {}", f.to_err_msg())
Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
};
let sessopts = build_session_options(
@"rustc",
@ -1091,7 +1091,7 @@ mod test {
&match getopts([~"--test", ~"--cfg=test"], optgroups()) {
Ok(m) => m,
Err(f) => {
fail2!("test_switch_implies_cfg_test_unless_cfg_test: {}",
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}",
f.to_err_msg());
}
};

View file

@ -78,7 +78,7 @@ impl fold::ast_fold for TestHarnessGenerator {
fn fold_item(&self, i: @ast::item) -> Option<@ast::item> {
self.cx.path.push(i.ident);
debug2!("current path: {}",
debug!("current path: {}",
ast_util::path_name_i(self.cx.path.clone()));
if is_test_fn(self.cx, i) || is_bench_fn(i) {
@ -91,7 +91,7 @@ impl fold::ast_fold for TestHarnessGenerator {
tests");
}
_ => {
debug2!("this is a test function");
debug!("this is a test function");
let test = Test {
span: i.span,
path: self.cx.path.clone(),
@ -100,7 +100,7 @@ impl fold::ast_fold for TestHarnessGenerator {
should_fail: should_fail(i)
};
self.cx.testfns.push(test);
// debug2!("have {} test/bench functions",
// debug!("have {} test/bench functions",
// cx.testfns.len());
}
}
@ -327,7 +327,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
span: dummy_sp(),
};
debug2!("Synthetic test module:\n{}\n",
debug!("Synthetic test module:\n{}\n",
pprust::item_to_str(@item.clone(), cx.sess.intr()));
return @item;
@ -381,7 +381,7 @@ fn is_extra(crate: &ast::Crate) -> bool {
}
fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
debug2!("building test vector from {} tests", cx.testfns.len());
debug!("building test vector from {} tests", cx.testfns.len());
let mut descs = ~[];
for test in cx.testfns.iter() {
descs.push(mk_test_desc_and_fn_rec(cx, test));
@ -404,7 +404,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
let span = test.span;
let path = test.path.clone();
debug2!("encoding {}", ast_util::path_name_i(path));
debug!("encoding {}", ast_util::path_name_i(path));
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path).to_managed(), ast::CookedStr));

View file

@ -74,11 +74,11 @@ struct cache_entry {
}
fn dump_crates(crate_cache: &[cache_entry]) {
debug2!("resolved crates:");
debug!("resolved crates:");
for entry in crate_cache.iter() {
debug2!("cnum: {:?}", entry.cnum);
debug2!("span: {:?}", entry.span);
debug2!("hash: {:?}", entry.hash);
debug!("cnum: {:?}", entry.cnum);
debug!("span: {:?}", entry.span);
debug!("hash: {:?}", entry.hash);
}
}
@ -155,7 +155,7 @@ fn visit_view_item(e: @mut Env, i: &ast::view_item) {
}
}
};
debug2!("resolving extern mod stmt. ident: {:?}, meta: {:?}",
debug!("resolving extern mod stmt. ident: {:?}, meta: {:?}",
ident, meta_items);
let cnum = resolve_crate(e,
ident,
@ -321,7 +321,7 @@ fn resolve_crate(e: @mut Env,
// Go through the crate metadata and load any crates that it references
fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
debug2!("resolving deps of external crate");
debug!("resolving deps of external crate");
// The map from crate numbers in the crate we're resolving to local crate
// numbers
let mut cnum_map = HashMap::new();
@ -330,18 +330,18 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
let extrn_cnum = dep.cnum;
let cname_str = token::ident_to_str(&dep.name);
let cmetas = metas_with(dep.vers, @"vers", ~[]);
debug2!("resolving dep crate {} ver: {} hash: {}",
debug!("resolving dep crate {} ver: {} hash: {}",
cname_str, dep.vers, dep.hash);
match existing_match(e,
metas_with_ident(cname_str, cmetas.clone()),
dep.hash) {
Some(local_cnum) => {
debug2!("already have it");
debug!("already have it");
// We've already seen this crate
cnum_map.insert(extrn_cnum, local_cnum);
}
None => {
debug2!("need to load it");
debug!("need to load it");
// This is a new one so we've got to load it
// FIXME (#2404): Need better error reporting than just a bogus
// span.

View file

@ -210,17 +210,17 @@ pub fn get_field_type(tcx: ty::ctxt, class_id: ast::DefId,
let cstore = tcx.cstore;
let cdata = cstore::get_crate_data(cstore, class_id.crate);
let all_items = reader::get_doc(reader::Doc(cdata.data), tag_items);
debug2!("Looking up {:?}", class_id);
debug!("Looking up {:?}", class_id);
let class_doc = expect(tcx.diag,
decoder::maybe_find_item(class_id.node, all_items),
|| format!("get_field_type: class ID {:?} not found",
class_id) );
debug2!("looking up {:?} : {:?}", def, class_doc);
debug!("looking up {:?} : {:?}", def, class_doc);
let the_field = expect(tcx.diag,
decoder::maybe_find_item(def.node, class_doc),
|| format!("get_field_type: in class {:?}, field ID {:?} not found",
class_id, def) );
debug2!("got field data {:?}", the_field);
debug!("got field data {:?}", the_field);
let ty = decoder::item_type(def, the_field, tcx, cdata);
ty::ty_param_bounds_and_ty {
generics: ty::Generics {type_param_defs: @~[],

View file

@ -152,7 +152,7 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[@str] {
let cdata = cstore::get_crate_data(cstore, cnum);
let hash = decoder::get_crate_hash(cdata.data);
let vers = decoder::get_crate_vers(cdata.data);
debug2!("Add hash[{}]: {} {}", cdata.name, vers, hash);
debug!("Add hash[{}]: {} {}", cdata.name, vers, hash);
result.push(crate_hash {
name: cdata.name,
vers: vers,
@ -164,9 +164,9 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[@str] {
(a.name, a.vers, a.hash) <= (b.name, b.vers, b.hash)
};
debug2!("sorted:");
debug!("sorted:");
for x in sorted.iter() {
debug2!(" hash[{}]: {}", x.name, x.hash);
debug!(" hash[{}]: {}", x.name, x.hash);
}
sorted.map(|ch| ch.hash)

View file

@ -89,7 +89,7 @@ pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> {
fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc {
match maybe_find_item(item_id, items) {
None => fail2!("lookup_item: id not found: {}", item_id),
None => fail!("lookup_item: id not found: {}", item_id),
Some(d) => d
}
}
@ -148,7 +148,7 @@ fn item_family(item: ebml::Doc) -> Family {
'g' => PublicField,
'j' => PrivateField,
'N' => InheritedField,
c => fail2!("unexpected family char: {}", c)
c => fail!("unexpected family char: {}", c)
}
}
@ -160,7 +160,7 @@ fn item_visibility(item: ebml::Doc) -> ast::visibility {
'y' => ast::public,
'n' => ast::private,
'i' => ast::inherited,
_ => fail2!("unknown visibility character")
_ => fail!("unknown visibility character")
}
}
}
@ -494,8 +494,8 @@ pub enum DefLike {
pub fn def_like_to_def(def_like: DefLike) -> ast::Def {
match def_like {
DlDef(def) => return def,
DlImpl(*) => fail2!("found impl in def_like_to_def"),
DlField => fail2!("found field in def_like_to_def")
DlImpl(*) => fail!("found impl in def_like_to_def"),
DlField => fail!("found field in def_like_to_def")
}
}
@ -550,13 +550,13 @@ impl<'self> EachItemContext<'self> {
let def_like = item_to_def_like(doc, def_id, self.cdata.cnum);
match def_like {
DlDef(def) => {
debug2!("(iterating over each item of a module) processing \
debug!("(iterating over each item of a module) processing \
`{}` (def {:?})",
*self.path_builder,
def);
}
_ => {
debug2!("(iterating over each item of a module) processing \
debug!("(iterating over each item of a module) processing \
`{}` ({}:{})",
*self.path_builder,
def_id.crate,
@ -631,7 +631,7 @@ impl<'self> EachItemContext<'self> {
reader::get_doc(root, tag_items)
};
debug2!("(iterating over each item of a module) looking up item \
debug!("(iterating over each item of a module) looking up item \
{}:{} in `{}`, crate {}",
child_def_id.crate,
child_def_id.node,
@ -644,7 +644,7 @@ impl<'self> EachItemContext<'self> {
Some(child_item_doc) => {
// Push the name.
let child_name = item_name(self.intr, child_item_doc);
debug2!("(iterating over each item of a module) pushing \
debug!("(iterating over each item of a module) pushing \
name `{}` onto `{}`",
token::ident_to_str(&child_name),
*self.path_builder);
@ -682,7 +682,7 @@ impl<'self> EachItemContext<'self> {
let name = name_doc.as_str_slice();
// Push the name.
debug2!("(iterating over each item of a module) pushing \
debug!("(iterating over each item of a module) pushing \
reexported name `{}` onto `{}` (crate {}, orig {}, \
in crate {})",
name,
@ -900,7 +900,7 @@ pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt,
id: ast::NodeId,
decode_inlined_item: decode_inlined_item)
-> csearch::found_ast {
debug2!("Looking up item: {}", id);
debug!("Looking up item: {}", id);
let item_doc = lookup_item(id, cdata.data);
let path = {
let item_path = item_path(item_doc);
@ -965,7 +965,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
match ch as char {
'i' => ast::MutImmutable,
'm' => ast::MutMutable,
_ => fail2!("unknown mutability character: `{}`", ch as char),
_ => fail!("unknown mutability character: `{}`", ch as char),
}
}
@ -983,7 +983,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
return ast::sty_region(None, get_mutability(string[1]));
}
_ => {
fail2!("unknown self type code: `{}`", explicit_self_kind as char);
fail!("unknown self type code: `{}`", explicit_self_kind as char);
}
}
}
@ -1164,7 +1164,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
match item_family(impl_method_doc) {
StaticMethod => purity = ast::impure_fn,
UnsafeStaticMethod => purity = ast::unsafe_fn,
_ => fail2!()
_ => fail!()
}
static_impl_methods.push(StaticMethodInfo {
@ -1200,7 +1200,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility {
PublicField => ast::public,
PrivateField => ast::private,
InheritedField => ast::inherited,
_ => fail2!()
_ => fail!()
}
}
@ -1266,7 +1266,7 @@ fn describe_def(items: ebml::Doc, id: ast::DefId) -> ~str {
if id.crate != ast::LOCAL_CRATE { return ~"external"; }
let it = match maybe_find_item(id.node, items) {
Some(it) => it,
None => fail2!("describe_def: item not found {:?}", id)
None => fail!("describe_def: item not found {:?}", id)
};
return item_family_to_str(item_family(it));
}
@ -1453,7 +1453,7 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId {
match cdata.cnum_map.find(&did.crate) {
option::Some(&n) => ast::DefId { crate: n, node: did.node },
option::None => fail2!("didn't find a crate in the cnum_map")
option::None => fail!("didn't find a crate in the cnum_map")
}
}

View file

@ -282,7 +282,7 @@ fn encode_symbol(ecx: &EncodeContext,
ebml_w.start_tag(tag_items_data_item_symbol);
match ecx.item_symbols.find(&id) {
Some(x) => {
debug2!("encode_symbol(id={:?}, str={})", id, *x);
debug!("encode_symbol(id={:?}, str={})", id, *x);
ebml_w.writer.write(x.as_bytes());
}
None => {
@ -337,7 +337,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
path: &[ast_map::path_elt],
index: @mut ~[entry<i64>],
generics: &ast::Generics) {
debug2!("encode_enum_variant_info(id={:?})", id);
debug!("encode_enum_variant_info(id={:?})", id);
let mut disr_val = 0;
let mut i = 0;
@ -423,7 +423,7 @@ fn encode_reexported_static_method(ecx: &EncodeContext,
exp: &middle::resolve::Export2,
method_def_id: DefId,
method_ident: Ident) {
debug2!("(encode reexported static method) {}::{}",
debug!("(encode reexported static method) {}::{}",
exp.name, ecx.tcx.sess.str_of(method_ident));
ebml_w.start_tag(tag_items_data_item_reexport);
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
@ -496,13 +496,13 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
if mod_path != *path || exp.name != original_name {
if !encode_reexported_static_base_methods(ecx, ebml_w, exp) {
if encode_reexported_static_trait_methods(ecx, ebml_w, exp) {
debug2!("(encode reexported static methods) {} \
debug!("(encode reexported static methods) {} \
[trait]",
original_name);
}
}
else {
debug2!("(encode reexported static methods) {} [base]",
debug!("(encode reexported static methods) {} [base]",
original_name);
}
}
@ -550,12 +550,12 @@ fn encode_reexports(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
id: NodeId,
path: &[ast_map::path_elt]) {
debug2!("(encoding info for module) encoding reexports for {}", id);
debug!("(encoding info for module) encoding reexports for {}", id);
match ecx.reexports2.find(&id) {
Some(ref exports) => {
debug2!("(encoding info for module) found reexports for {}", id);
debug!("(encoding info for module) found reexports for {}", id);
for exp in exports.iter() {
debug2!("(encoding info for module) reexport '{}' ({}/{}) for \
debug!("(encoding info for module) reexport '{}' ({}/{}) for \
{}",
exp.name,
exp.def_id.crate,
@ -573,7 +573,7 @@ fn encode_reexports(ecx: &EncodeContext,
}
}
None => {
debug2!("(encoding info for module) found no reexports for {}",
debug!("(encoding info for module) found no reexports for {}",
id);
}
}
@ -590,7 +590,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
encode_def_id(ebml_w, local_def(id));
encode_family(ebml_w, 'm');
encode_name(ecx, ebml_w, name);
debug2!("(encoding info for module) encoding info for module ID {}", id);
debug!("(encoding info for module) encoding info for module ID {}", id);
// Encode info about all the module children.
for item in md.items.iter() {
@ -608,7 +608,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
match item.node {
item_impl(*) => {
let (ident, did) = (item.ident, item.id);
debug2!("(encoding info for module) ... encoding impl {} \
debug!("(encoding info for module) ... encoding impl {} \
({:?}/{:?})",
ecx.tcx.sess.str_of(ident),
did,
@ -627,7 +627,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
// Encode the reexports of this module, if this module is public.
if vis == public {
debug2!("(encoding info for module) encoding reexports for {}", id);
debug!("(encoding info for module) encoding reexports for {}", id);
encode_reexports(ecx, ebml_w, id, path);
}
@ -729,7 +729,7 @@ fn encode_info_for_struct(ecx: &EncodeContext,
index.push(entry {val: id as i64, pos: ebml_w.writer.tell()});
global_index.push(entry {val: id as i64, pos: ebml_w.writer.tell()});
ebml_w.start_tag(tag_items_data_item);
debug2!("encode_info_for_struct: doing {} {}",
debug!("encode_info_for_struct: doing {} {}",
tcx.sess.str_of(nm), id);
encode_struct_field_family(ebml_w, vis);
encode_name(ecx, ebml_w, nm);
@ -795,7 +795,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
parent_id: NodeId,
ast_method_opt: Option<@method>) {
debug2!("encode_info_for_method: {:?} {}", m.def_id,
debug!("encode_info_for_method: {:?} {}", m.def_id,
ecx.tcx.sess.str_of(m.ident));
ebml_w.start_tag(tag_items_data_item);
@ -835,7 +835,7 @@ fn purity_static_method_family(p: purity) -> char {
match p {
unsafe_fn => 'U',
impure_fn => 'F',
_ => fail2!("extern fn can't be static")
_ => fail!("extern fn can't be static")
}
}
@ -894,7 +894,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
}
let add_to_index: &fn() = || add_to_index_(item, ebml_w, index);
debug2!("encoding info for item at {}",
debug!("encoding info for item at {}",
ecx.tcx.sess.codemap.span_to_str(item.span));
let def_id = local_def(item.id);
@ -1224,7 +1224,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
// Encode inherent implementations for this trait.
encode_inherent_implementations(ecx, ebml_w, def_id);
}
item_mac(*) => fail2!("item macros unimplemented")
item_mac(*) => fail!("item macros unimplemented")
}
}
@ -1278,7 +1278,7 @@ fn my_visit_item(i:@item, items: ast_map::map, ebml_w:&writer::Encoder,
let ecx : &EncodeContext = unsafe { cast::transmute(ecx_ptr) };
encode_info_for_item(ecx, &mut ebml_w, i, index, *pt, i.vis);
}
_ => fail2!("bad item")
_ => fail!("bad item")
}
}
@ -1286,7 +1286,7 @@ fn my_visit_foreign_item(ni:@foreign_item, items: ast_map::map, ebml_w:&writer::
ecx_ptr:*int, index: @mut ~[entry<i64>]) {
match items.get_copy(&ni.id) {
ast_map::node_foreign_item(_, abi, _, pt) => {
debug2!("writing foreign item {}::{}",
debug!("writing foreign item {}::{}",
ast_map::path_to_str(
*pt,
token::get_ident_interner()),
@ -1303,7 +1303,7 @@ fn my_visit_foreign_item(ni:@foreign_item, items: ast_map::map, ebml_w:&writer::
abi);
}
// case for separate item and foreign-item tables
_ => fail2!("bad foreign item")
_ => fail!("bad foreign item")
}
}

View file

@ -53,7 +53,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
let mut visited_dirs = HashSet::new();
let mut found = false;
debug2!("filesearch: searching additional lib search paths [{:?}]",
debug!("filesearch: searching additional lib search paths [{:?}]",
self.addl_lib_search_paths.len());
for path in self.addl_lib_search_paths.iter() {
match f(path) {
@ -63,7 +63,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
visited_dirs.insert(path.as_vec().to_owned());
}
debug2!("filesearch: searching target lib path");
debug!("filesearch: searching target lib path");
let tlib_path = make_target_lib_path(self.sysroot,
self.target_triple);
if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
@ -78,7 +78,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
let rustpath = rust_path();
for path in rustpath.iter() {
let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
debug2!("is {} in visited_dirs? {:?}", tlib_path.display(),
debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
visited_dirs.contains_equiv(&tlib_path.as_vec().to_owned()));
if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
@ -106,7 +106,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
}
let sysroot = get_sysroot(maybe_sysroot);
debug2!("using sysroot = {}", sysroot.display());
debug!("using sysroot = {}", sysroot.display());
@FileSearchImpl {
sysroot: sysroot,
addl_lib_search_paths: addl_lib_search_paths,
@ -116,19 +116,19 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
pub fn search(filesearch: @FileSearch, pick: pick) {
do filesearch.for_each_lib_search_path() |lib_search_path| {
debug2!("searching {}", lib_search_path.display());
debug!("searching {}", lib_search_path.display());
let r = os::list_dir_path(lib_search_path);
let mut rslt = FileDoesntMatch;
for path in r.iter() {
debug2!("testing {}", path.display());
debug!("testing {}", path.display());
let maybe_picked = pick(path);
match maybe_picked {
FileMatches => {
debug2!("picked {}", path.display());
debug!("picked {}", path.display());
rslt = FileMatches;
}
FileDoesntMatch => {
debug2!("rejected {}", path.display());
debug!("rejected {}", path.display());
}
}
}
@ -161,7 +161,7 @@ fn make_rustpkg_target_lib_path(dir: &Path,
pub fn get_or_default_sysroot() -> Path {
match os::self_exe_path() {
option::Some(p) => { let mut p = p; p.pop(); p }
option::None => fail2!("can't determine value for sysroot")
option::None => fail!("can't determine value for sysroot")
}
}

View file

@ -99,21 +99,21 @@ fn find_library_crate_aux(
None => FileDoesntMatch,
Some(path_str) =>
if path_str.starts_with(prefix) && path_str.ends_with(suffix) {
debug2!("{} is a candidate", path.display());
debug!("{} is a candidate", path.display());
match get_metadata_section(cx.os, path) {
Some(cvec) =>
if !crate_matches(cvec, cx.metas, cx.hash) {
debug2!("skipping {}, metadata doesn't match",
debug!("skipping {}, metadata doesn't match",
path.display());
FileDoesntMatch
} else {
debug2!("found {} with matching metadata", path.display());
debug!("found {} with matching metadata", path.display());
// FIXME (#9639): This needs to handle non-utf8 paths
matches.push((path.as_str().unwrap().to_owned(), cvec));
FileMatches
},
_ => {
debug2!("could not load metadata for {}", path.display());
debug!("could not load metadata for {}", path.display());
FileDoesntMatch
}
}
@ -151,7 +151,7 @@ pub fn crate_name_from_metas(metas: &[@ast::MetaItem]) -> @str {
_ => {}
}
}
fail2!("expected to find the crate name")
fail!("expected to find the crate name")
}
pub fn package_id_from_metas(metas: &[@ast::MetaItem]) -> Option<@str> {
@ -190,7 +190,7 @@ pub fn metadata_matches(extern_metas: &[@ast::MetaItem],
// extern_metas: metas we read from the crate
// local_metas: metas we're looking for
debug2!("matching {} metadata requirements against {} items",
debug!("matching {} metadata requirements against {} items",
local_metas.len(), extern_metas.len());
do local_metas.iter().all |needed| {
@ -213,14 +213,14 @@ fn get_metadata_section(os: Os,
while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
let name_buf = llvm::LLVMGetSectionName(si.llsi);
let name = str::raw::from_c_str(name_buf);
debug2!("get_metadata_section: name {}", name);
debug!("get_metadata_section: name {}", name);
if read_meta_section_name(os) == name {
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
let mut found = None;
let cvbuf: *u8 = cast::transmute(cbuf);
let vlen = encoder::metadata_encoding_version.len();
debug2!("checking {} bytes of metadata-version stamp",
debug!("checking {} bytes of metadata-version stamp",
vlen);
let minsz = num::min(vlen, csz);
let mut version_ok = false;
@ -231,7 +231,7 @@ fn get_metadata_section(os: Os,
if !version_ok { return None; }
let cvbuf1 = ptr::offset(cvbuf, vlen as int);
debug2!("inflating {} bytes of compressed metadata",
debug!("inflating {} bytes of compressed metadata",
csz - vlen);
do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
let inflated = flate::inflate_bytes(bytes);

View file

@ -80,10 +80,10 @@ fn scan<R>(st: &mut PState, is_last: &fn(char) -> bool,
op: &fn(&[u8]) -> R) -> R
{
let start_pos = st.pos;
debug2!("scan: '{}' (start)", st.data[st.pos] as char);
debug!("scan: '{}' (start)", st.data[st.pos] as char);
while !is_last(st.data[st.pos] as char) {
st.pos += 1;
debug2!("scan: '{}'", st.data[st.pos] as char);
debug!("scan: '{}'", st.data[st.pos] as char);
}
let end_pos = st.pos;
st.pos += 1;
@ -221,7 +221,7 @@ fn parse_region_substs(st: &mut PState) -> ty::RegionSubsts {
assert_eq!(next(st), '.');
ty::NonerasedRegions(regions)
}
_ => fail2!("parse_bound_region: bad input")
_ => fail!("parse_bound_region: bad input")
}
}
@ -239,7 +239,7 @@ fn parse_bound_region(st: &mut PState) -> ty::bound_region {
assert_eq!(next(st), '|');
ty::br_cap_avoid(id, @parse_bound_region(st))
},
_ => fail2!("parse_bound_region: bad input")
_ => fail!("parse_bound_region: bad input")
}
}
@ -268,7 +268,7 @@ fn parse_region(st: &mut PState) -> ty::Region {
'e' => {
ty::re_static
}
_ => fail2!("parse_region: bad input")
_ => fail!("parse_region: bad input")
}
}
@ -276,7 +276,7 @@ fn parse_opt<T>(st: &mut PState, f: &fn(&mut PState) -> T) -> Option<T> {
match next(st) {
'n' => None,
's' => Some(f(st)),
_ => fail2!("parse_opt: bad input")
_ => fail!("parse_opt: bad input")
}
}
@ -316,7 +316,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
'D' => return ty::mk_mach_int(ast::ty_i64),
'f' => return ty::mk_mach_float(ast::ty_f32),
'F' => return ty::mk_mach_float(ast::ty_f64),
_ => fail2!("parse_ty: bad numeric type")
_ => fail!("parse_ty: bad numeric type")
}
}
'c' => return ty::mk_char(),
@ -339,7 +339,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
}
'p' => {
let did = parse_def(st, TypeParameter, conv);
debug2!("parsed ty_param: did={:?}", did);
debug!("parsed ty_param: did={:?}", did);
return ty::mk_param(st.tcx, parse_uint(st), did);
}
's' => {
@ -416,7 +416,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
assert_eq!(next(st), ']');
return ty::mk_struct(st.tcx, did, substs);
}
c => { error2!("unexpected char in type string: {}", c); fail2!();}
c => { error!("unexpected char in type string: {}", c); fail!();}
}
}
@ -466,7 +466,7 @@ fn parse_purity(c: char) -> purity {
'u' => unsafe_fn,
'i' => impure_fn,
'c' => extern_fn,
_ => fail2!("parse_purity: bad purity {}", c)
_ => fail!("parse_purity: bad purity {}", c)
}
}
@ -487,7 +487,7 @@ fn parse_onceness(c: char) -> ast::Onceness {
match c {
'o' => ast::Once,
'm' => ast::Many,
_ => fail2!("parse_onceness: bad onceness")
_ => fail!("parse_onceness: bad onceness")
}
}
@ -538,8 +538,8 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
let len = buf.len();
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
if colon_idx == len {
error2!("didn't find ':' when parsing def id");
fail2!();
error!("didn't find ':' when parsing def id");
fail!();
}
let crate_part = buf.slice(0u, colon_idx);
@ -547,12 +547,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
let crate_num = match uint::parse_bytes(crate_part, 10u) {
Some(cn) => cn as int,
None => fail2!("internal error: parse_def_id: crate number expected, but found {:?}",
None => fail!("internal error: parse_def_id: crate number expected, but found {:?}",
crate_part)
};
let def_num = match uint::parse_bytes(def_part, 10u) {
Some(dn) => dn as int,
None => fail2!("internal error: parse_def_id: id expected, but found {:?}",
None => fail!("internal error: parse_def_id: id expected, but found {:?}",
def_part)
};
ast::DefId { crate: crate_num, node: def_num }
@ -598,7 +598,7 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
return param_bounds;
}
_ => {
fail2!("parse_bounds: bad bounds")
fail!("parse_bounds: bad bounds")
}
}
}

View file

@ -335,18 +335,18 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: &ty::sty) {
}
ty::ty_opaque_box => w.write_char('B'),
ty::ty_struct(def, ref substs) => {
debug2!("~~~~ {}", "a[");
debug!("~~~~ {}", "a[");
w.write_str(&"a[");
let s = (cx.ds)(def);
debug2!("~~~~ {}", s);
debug!("~~~~ {}", s);
w.write_str(s);
debug2!("~~~~ {}", "|");
debug!("~~~~ {}", "|");
w.write_char('|');
enc_substs(w, cx, substs);
debug2!("~~~~ {}", "]");
debug!("~~~~ {}", "]");
w.write_char(']');
}
ty::ty_err => fail2!("Shouldn't encode error type")
ty::ty_err => fail!("Shouldn't encode error type")
}
}

View file

@ -84,7 +84,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
path: &[ast_map::path_elt],
ii: ast::inlined_item,
maps: Maps) {
debug2!("> Encoding inlined item: {}::{} ({})",
debug!("> Encoding inlined item: {}::{} ({})",
ast_map::path_to_str(path, token::get_ident_interner()),
ecx.tcx.sess.str_of(ii.ident()),
ebml_w.writer.tell());
@ -97,7 +97,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
encode_side_tables_for_ii(ecx, maps, ebml_w, &ii);
ebml_w.end_tag();
debug2!("< Encoded inlined fn: {}::{} ({})",
debug!("< Encoded inlined fn: {}::{} ({})",
ast_map::path_to_str(path, token::get_ident_interner()),
ecx.tcx.sess.str_of(ii.ident()),
ebml_w.writer.tell());
@ -117,7 +117,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
match par_doc.opt_child(c::tag_ast) {
None => None,
Some(ast_doc) => {
debug2!("> Decoding inlined fn: {}::?",
debug!("> Decoding inlined fn: {}::?",
ast_map::path_to_str(path, token::get_ident_interner()));
let mut ast_dsr = reader::Decoder(ast_doc);
let from_id_range = Decodable::decode(&mut ast_dsr);
@ -129,8 +129,8 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
};
let raw_ii = decode_ast(ast_doc);
let ii = renumber_ast(xcx, raw_ii);
debug2!("Fn named: {}", tcx.sess.str_of(ii.ident()));
debug2!("< Decoded inlined fn: {}::{}",
debug!("Fn named: {}", tcx.sess.str_of(ii.ident()));
debug!("< Decoded inlined fn: {}::{}",
ast_map::path_to_str(path, token::get_ident_interner()),
tcx.sess.str_of(ii.ident()));
ast_map::map_decoded_item(tcx.sess.diagnostic(),
@ -140,7 +140,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
decode_side_tables(xcx, ast_doc);
match ii {
ast::ii_item(i) => {
debug2!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
debug!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
syntax::print::pprust::item_to_str(i, tcx.sess.intr()));
}
_ => { }
@ -305,7 +305,7 @@ impl fold::ast_fold for NestedItemsDropper {
node: ast::DeclItem(_),
span: _
}, _) => None,
ast::StmtMac(*) => fail2!("unexpanded macro in astencode")
ast::StmtMac(*) => fail!("unexpanded macro in astencode")
}
}.collect();
let blk_sans_items = ast::Block {
@ -741,7 +741,7 @@ impl vtable_decoder_helpers for reader::Decoder {
)
}
// hard to avoid - user input
_ => fail2!("bad enum variant")
_ => fail!("bad enum variant")
}
}
}
@ -896,7 +896,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
id: ast::NodeId) {
let tcx = ecx.tcx;
debug2!("Encoding side tables for id {}", id);
debug!("Encoding side tables for id {}", id);
{
let r = tcx.def_map.find(&id);
@ -1091,7 +1091,7 @@ impl ebml_decoder_decoder_helpers for reader::Decoder {
xcx.dcx.tcx,
|s, a| this.convert_def_id(xcx, s, a));
debug2!("read_ty({}) = {}",
debug!("read_ty({}) = {}",
type_string(doc),
ty_to_str(xcx.dcx.tcx, ty));
@ -1176,7 +1176,7 @@ impl ebml_decoder_decoder_helpers for reader::Decoder {
NominalType | TypeWithId => xcx.tr_def_id(did),
TypeParameter => xcx.tr_intern_def_id(did)
};
debug2!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r);
debug!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r);
return r;
}
}
@ -1189,7 +1189,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
let id0 = entry_doc.get(c::tag_table_id as uint).as_int();
let id = xcx.tr_id(id0);
debug2!(">> Side table document with tag 0x{:x} \
debug!(">> Side table document with tag 0x{:x} \
found for id {} (orig {})",
tag, id, id0);
@ -1210,7 +1210,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
}
c::tag_table_node_type => {
let ty = val_dsr.read_ty(xcx);
debug2!("inserting ty for node {:?}: {}",
debug!("inserting ty for node {:?}: {}",
id, ty_to_str(dcx.tcx, ty));
dcx.tcx.node_types.insert(id as uint, ty);
}
@ -1263,7 +1263,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
}
}
debug2!(">< Side table doc loaded");
debug!(">< Side table doc loaded");
true
};
}
@ -1381,6 +1381,6 @@ fn test_simplification() {
== pprust::item_to_str(item_exp,
token::get_ident_interner()));
}
_ => fail2!()
_ => fail!()
}
}

View file

@ -65,7 +65,7 @@ pub fn check_loans(bccx: &BorrowckCtxt,
move_data: move_data::FlowedMoveData,
all_loans: &[Loan],
body: &ast::Block) {
debug2!("check_loans(body id={:?})", body.id);
debug!("check_loans(body id={:?})", body.id);
let mut clcx = CheckLoanCtxt {
bccx: bccx,
@ -197,10 +197,10 @@ impl<'self> CheckLoanCtxt<'self> {
//! issued when we enter `scope_id` (for example, we do not
//! permit two `&mut` borrows of the same variable).
debug2!("check_for_conflicting_loans(scope_id={:?})", scope_id);
debug!("check_for_conflicting_loans(scope_id={:?})", scope_id);
let new_loan_indices = self.loans_generated_by(scope_id);
debug2!("new_loan_indices = {:?}", new_loan_indices);
debug!("new_loan_indices = {:?}", new_loan_indices);
do self.each_issued_loan(scope_id) |issued_loan| {
for &new_loan_index in new_loan_indices.iter() {
@ -225,7 +225,7 @@ impl<'self> CheckLoanCtxt<'self> {
//! Checks whether `old_loan` and `new_loan` can safely be issued
//! simultaneously.
debug2!("report_error_if_loans_conflict(old_loan={}, new_loan={})",
debug!("report_error_if_loans_conflict(old_loan={}, new_loan={})",
old_loan.repr(self.tcx()),
new_loan.repr(self.tcx()));
@ -249,7 +249,7 @@ impl<'self> CheckLoanCtxt<'self> {
//! Checks whether the restrictions introduced by `loan1` would
//! prohibit `loan2`. Returns false if an error is reported.
debug2!("report_error_if_loan_conflicts_with_restriction(\
debug!("report_error_if_loan_conflicts_with_restriction(\
loan1={}, loan2={})",
loan1.repr(self.tcx()),
loan2.repr(self.tcx()));
@ -260,7 +260,7 @@ impl<'self> CheckLoanCtxt<'self> {
ImmutableMutability => RESTR_ALIAS | RESTR_FREEZE,
ConstMutability => RESTR_ALIAS,
};
debug2!("illegal_if={:?}", illegal_if);
debug!("illegal_if={:?}", illegal_if);
for restr in loan1.restrictions.iter() {
if !restr.set.intersects(illegal_if) { continue; }
@ -317,7 +317,7 @@ impl<'self> CheckLoanCtxt<'self> {
* is using a moved/uninitialized value
*/
debug2!("check_if_path_is_moved(id={:?}, use_kind={:?}, lp={})",
debug!("check_if_path_is_moved(id={:?}, use_kind={:?}, lp={})",
id, use_kind, lp.repr(self.bccx.tcx));
do self.move_data.each_move_of(id, lp) |move, moved_lp| {
self.bccx.report_use_of_moved_value(
@ -338,7 +338,7 @@ impl<'self> CheckLoanCtxt<'self> {
Some(&adj) => self.bccx.cat_expr_autoderefd(expr, adj)
};
debug2!("check_assignment(cmt={})", cmt.repr(self.tcx()));
debug!("check_assignment(cmt={})", cmt.repr(self.tcx()));
// Mutable values can be assigned, as long as they obey loans
// and aliasing restrictions:
@ -387,7 +387,7 @@ impl<'self> CheckLoanCtxt<'self> {
let mut cmt = cmt;
loop {
debug2!("mark_writes_through_upvars_as_used_mut(cmt={})",
debug!("mark_writes_through_upvars_as_used_mut(cmt={})",
cmt.repr(this.tcx()));
match cmt.cat {
mc::cat_local(id) |
@ -435,7 +435,7 @@ impl<'self> CheckLoanCtxt<'self> {
//! Safety checks related to writes to aliasable, mutable locations
let guarantor = cmt.guarantor();
debug2!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
debug!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
cmt.repr(this.tcx()), guarantor.repr(this.tcx()));
match guarantor.cat {
mc::cat_deref(b, _, mc::region_ptr(MutMutable, _)) => {
@ -451,7 +451,7 @@ impl<'self> CheckLoanCtxt<'self> {
id: guarantor.id,
derefs: deref_count
};
debug2!("Inserting write guard at {:?}", key);
debug!("Inserting write guard at {:?}", key);
this.bccx.write_guard_map.insert(key);
}
@ -690,7 +690,7 @@ impl<'self> CheckLoanCtxt<'self> {
pub fn analyze_move_out_from(&self,
expr_id: ast::NodeId,
move_path: @LoanPath) -> MoveError {
debug2!("analyze_move_out_from(expr_id={:?}, move_path={})",
debug!("analyze_move_out_from(expr_id={:?}, move_path={})",
expr_id, move_path.repr(self.tcx()));
// FIXME(#4384) inadequare if/when we permit `move a.b`
@ -794,7 +794,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
expr: @ast::Expr) {
visit::walk_expr(this, expr, ());
debug2!("check_loans_in_expr(expr={})",
debug!("check_loans_in_expr(expr={})",
expr.repr(this.tcx()));
this.check_for_conflicting_loans(expr.id);
@ -805,7 +805,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
ast::ExprPath(*) => {
if !this.move_data.is_assignee(expr.id) {
let cmt = this.bccx.cat_expr_unadjusted(expr);
debug2!("path cmt={}", cmt.repr(this.tcx()));
debug!("path cmt={}", cmt.repr(this.tcx()));
let r = opt_loan_path(cmt);
for &lp in r.iter() {
this.check_if_path_is_moved(expr.id, expr.span, MovedInUse, lp);

View file

@ -27,7 +27,7 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
cmt: mc::cmt,
loan_region: ty::Region,
loan_mutbl: LoanMutability) {
debug2!("guarantee_lifetime(cmt={}, loan_region={})",
debug!("guarantee_lifetime(cmt={}, loan_region={})",
cmt.repr(bccx.tcx), loan_region.repr(bccx.tcx));
let ctxt = GuaranteeLifetimeContext {bccx: bccx,
item_scope_id: item_scope_id,
@ -101,7 +101,7 @@ impl<'self> GuaranteeLifetimeContext<'self> {
// L-Deref-Managed-Mut-Compiler-Root
self.check_root(cmt, base, derefs, ptr_mutbl, discr_scope);
} else {
debug2!("omitting root, base={}, base_scope={:?}",
debug!("omitting root, base={}, base_scope={:?}",
base.repr(self.tcx()), base_scope);
}
}
@ -189,7 +189,7 @@ impl<'self> GuaranteeLifetimeContext<'self> {
derefs: uint,
ptr_mutbl: ast::Mutability,
discr_scope: Option<ast::NodeId>) {
debug2!("check_root(cmt_deref={}, cmt_base={}, derefs={:?}, ptr_mutbl={:?}, \
debug!("check_root(cmt_deref={}, cmt_base={}, derefs={:?}, ptr_mutbl={:?}, \
discr_scope={:?})",
cmt_deref.repr(self.tcx()),
cmt_base.repr(self.tcx()),
@ -247,7 +247,7 @@ impl<'self> GuaranteeLifetimeContext<'self> {
// FIXME(#3511) grow to the nearest cleanup scope---this can
// cause observable errors if freezing!
if !self.bccx.tcx.region_maps.is_cleanup_scope(root_scope) {
debug2!("{:?} is not a cleanup scope, adjusting", root_scope);
debug!("{:?} is not a cleanup scope, adjusting", root_scope);
let cleanup_scope =
self.bccx.tcx.region_maps.cleanup_scope(root_scope);
@ -277,7 +277,7 @@ impl<'self> GuaranteeLifetimeContext<'self> {
let root_info = RootInfo {scope: root_scope, freeze: opt_dyna};
self.bccx.root_map.insert(rm_key, root_info);
debug2!("root_key: {:?} root_info: {:?}", rm_key, root_info);
debug!("root_key: {:?} root_info: {:?}", rm_key, root_info);
}
fn check_scope(&self, max_scope: ty::Region) {

View file

@ -136,7 +136,7 @@ fn gather_loans_in_fn(this: &mut GatherLoanCtxt,
id: ast::NodeId) {
match fk {
&visit::fk_item_fn(*) | &visit::fk_method(*) => {
fail2!("cannot occur, due to visit_item override");
fail!("cannot occur, due to visit_item override");
}
// Visit closures as part of the containing item.
@ -196,7 +196,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
let bccx = this.bccx;
let tcx = bccx.tcx;
debug2!("gather_loans_in_expr(expr={:?}/{})",
debug!("gather_loans_in_expr(expr={:?}/{})",
ex.id, pprust::expr_to_str(ex, tcx.sess.intr()));
this.id_range.add(ex.id);
@ -347,20 +347,20 @@ impl<'self> GatherLoanCtxt<'self> {
pub fn guarantee_adjustments(&mut self,
expr: @ast::Expr,
adjustment: &ty::AutoAdjustment) {
debug2!("guarantee_adjustments(expr={}, adjustment={:?})",
debug!("guarantee_adjustments(expr={}, adjustment={:?})",
expr.repr(self.tcx()), adjustment);
let _i = indenter();
match *adjustment {
ty::AutoAddEnv(*) => {
debug2!("autoaddenv -- no autoref");
debug!("autoaddenv -- no autoref");
return;
}
ty::AutoDerefRef(
ty::AutoDerefRef {
autoref: None, _ }) => {
debug2!("no autoref");
debug!("no autoref");
return;
}
@ -372,7 +372,7 @@ impl<'self> GatherLoanCtxt<'self> {
tcx: self.tcx(),
method_map: self.bccx.method_map};
let cmt = mcx.cat_expr_autoderefd(expr, autoderefs);
debug2!("after autoderef, cmt={}", cmt.repr(self.tcx()));
debug!("after autoderef, cmt={}", cmt.repr(self.tcx()));
match *autoref {
ty::AutoPtr(r, m) => {
@ -429,7 +429,7 @@ impl<'self> GatherLoanCtxt<'self> {
cmt: mc::cmt,
req_mutbl: LoanMutability,
loan_region: ty::Region) {
debug2!("guarantee_valid(borrow_id={:?}, cmt={}, \
debug!("guarantee_valid(borrow_id={:?}, cmt={}, \
req_mutbl={:?}, loan_region={:?})",
borrow_id,
cmt.repr(self.tcx()),
@ -490,13 +490,13 @@ impl<'self> GatherLoanCtxt<'self> {
format!("Invalid borrow lifetime: {:?}", loan_region));
}
};
debug2!("loan_scope = {:?}", loan_scope);
debug!("loan_scope = {:?}", loan_scope);
let gen_scope = self.compute_gen_scope(borrow_id, loan_scope);
debug2!("gen_scope = {:?}", gen_scope);
debug!("gen_scope = {:?}", gen_scope);
let kill_scope = self.compute_kill_scope(loan_scope, loan_path);
debug2!("kill_scope = {:?}", kill_scope);
debug!("kill_scope = {:?}", kill_scope);
if req_mutbl == MutableMutability {
self.mark_loan_path_as_mutated(loan_path);
@ -516,7 +516,7 @@ impl<'self> GatherLoanCtxt<'self> {
}
};
debug2!("guarantee_valid(borrow_id={:?}), loan={}",
debug!("guarantee_valid(borrow_id={:?}), loan={}",
borrow_id, loan.repr(self.tcx()));
// let loan_path = loan.loan_path;

View file

@ -135,7 +135,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
&visit::fk_item_fn(*) |
&visit::fk_method(*) => {
debug2!("borrowck_fn(id={:?})", id);
debug!("borrowck_fn(id={:?})", id);
// Check the body of fn items.
let (id_range, all_loans, move_data) =

View file

@ -244,7 +244,7 @@ impl MoveData {
}
};
debug2!("move_path(lp={}, index={:?})",
debug!("move_path(lp={}, index={:?})",
lp.repr(tcx),
index);
@ -304,7 +304,7 @@ impl MoveData {
* location `id` with kind `kind`.
*/
debug2!("add_move(lp={}, id={:?}, kind={:?})",
debug!("add_move(lp={}, id={:?}, kind={:?})",
lp.repr(tcx),
id,
kind);
@ -334,7 +334,7 @@ impl MoveData {
* location `id` with the given `span`.
*/
debug2!("add_assignment(lp={}, assign_id={:?}, assignee_id={:?}",
debug!("add_assignment(lp={}, assign_id={:?}, assignee_id={:?}",
lp.repr(tcx), assign_id, assignee_id);
let path_index = self.move_path(tcx, lp);
@ -348,12 +348,12 @@ impl MoveData {
};
if self.is_var_path(path_index) {
debug2!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
lp.repr(tcx), self.var_assignments.len(), path_index);
self.var_assignments.push(assignment);
} else {
debug2!("add_assignment[path](lp={}, path_index={:?})",
debug!("add_assignment[path](lp={}, path_index={:?})",
lp.repr(tcx), path_index);
self.path_assignments.push(assignment);

View file

@ -239,7 +239,7 @@ impl CFGBuilder {
expr_exit
}
ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ast::ExprLoop(ref body, _) => {
//

View file

@ -153,7 +153,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
Some(&DefStruct(_)) => { }
Some(&def) => {
debug2!("(checking const) found bad def: {:?}", def);
debug!("(checking const) found bad def: {:?}", def);
sess.span_err(
e.span,
"paths in constants may only refer to \
@ -266,7 +266,7 @@ impl Visitor<()> for CheckItemRecursionVisitor {
ast_map::node_item(it, _) => {
self.visit_item(it, ());
}
_ => fail2!("const not bound to an item")
_ => fail!("const not bound to an item")
},
_ => ()
},

View file

@ -181,14 +181,14 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
ty::ty_enum(id, _) => {
let vid = match *ctor {
variant(id) => id,
_ => fail2!("check_exhaustive: non-variant ctor"),
_ => fail!("check_exhaustive: non-variant ctor"),
};
let variants = ty::enum_variants(cx.tcx, id);
match variants.iter().find(|v| v.id == vid) {
Some(v) => Some(cx.tcx.sess.str_of(v.name)),
None => {
fail2!("check_exhaustive: bad variant in ctor")
fail!("check_exhaustive: bad variant in ctor")
}
}
}
@ -409,7 +409,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
return Some(variant(v.id));
}
}
fail2!();
fail!();
} else { None }
}
ty::ty_nil => None,
@ -421,7 +421,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
None => (),
Some(val(const_bool(true))) => true_found = true,
Some(val(const_bool(false))) => false_found = true,
_ => fail2!("impossible case")
_ => fail!("impossible case")
}
}
if true_found && false_found { None }
@ -511,10 +511,10 @@ fn ctor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) => 1u,
ty::ty_enum(eid, _) => {
let id = match *ctor { variant(id) => id,
_ => fail2!("impossible case") };
_ => fail!("impossible case") };
match ty::enum_variants(cx.tcx, eid).iter().find(|v| v.id == id ) {
Some(v) => v.args.len(),
None => fail2!("impossible case")
None => fail!("impossible case")
}
}
ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(),
@ -585,7 +585,7 @@ fn specialize(cx: &MatchCheckCtxt,
}
}
single => true,
_ => fail2!("type error")
_ => fail!("type error")
};
if match_ {
Some(r.tail().to_owned())
@ -632,7 +632,7 @@ fn specialize(cx: &MatchCheckCtxt,
}
}
single => true,
_ => fail2!("type error")
_ => fail!("type error")
};
if match_ {
Some(r.tail().to_owned())
@ -739,7 +739,7 @@ fn specialize(cx: &MatchCheckCtxt,
}
}
single => true,
_ => fail2!("type error")
_ => fail!("type error")
};
if match_ { Some(r.tail().to_owned()) } else { None }
}
@ -748,7 +748,7 @@ fn specialize(cx: &MatchCheckCtxt,
val(ref v) => (*v, *v),
range(ref lo, ref hi) => (*lo, *hi),
single => return Some(r.tail().to_owned()),
_ => fail2!("type error")
_ => fail!("type error")
};
let v_lo = eval_const_expr(cx.tcx, lo);
let v_hi = eval_const_expr(cx.tcx, hi);

View file

@ -131,7 +131,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
bits_per_id: uint) -> DataFlowContext<O> {
let words_per_id = (bits_per_id + uint::bits - 1) / uint::bits;
debug2!("DataFlowContext::new(id_range={:?}, bits_per_id={:?}, words_per_id={:?})",
debug!("DataFlowContext::new(id_range={:?}, bits_per_id={:?}, words_per_id={:?})",
id_range, bits_per_id, words_per_id);
let gens = ~[];
@ -154,7 +154,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` generates `bit`
debug2!("add_gen(id={:?}, bit={:?})", id, bit);
debug!("add_gen(id={:?}, bit={:?})", id, bit);
let (start, end) = self.compute_id_range(id);
{
let gens = self.gens.mut_slice(start, end);
@ -165,7 +165,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` kills `bit`
debug2!("add_kill(id={:?}, bit={:?})", id, bit);
debug!("add_kill(id={:?}, bit={:?})", id, bit);
let (start, end) = self.compute_id_range(id);
{
let kills = self.kills.mut_slice(start, end);
@ -176,7 +176,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
fn apply_gen_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) {
//! Applies the gen and kill sets for `id` to `bits`
debug2!("apply_gen_kill(id={:?}, bits={}) [before]",
debug!("apply_gen_kill(id={:?}, bits={}) [before]",
id, mut_bits_to_str(bits));
let (start, end) = self.compute_id_range(id);
let gens = self.gens.slice(start, end);
@ -184,17 +184,17 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
let kills = self.kills.slice(start, end);
bitwise(bits, kills, |a, b| a & !b);
debug2!("apply_gen_kill(id={:?}, bits={}) [after]",
debug!("apply_gen_kill(id={:?}, bits={}) [after]",
id, mut_bits_to_str(bits));
}
fn apply_kill(&mut self, id: ast::NodeId, bits: &mut [uint]) {
debug2!("apply_kill(id={:?}, bits={}) [before]",
debug!("apply_kill(id={:?}, bits={}) [before]",
id, mut_bits_to_str(bits));
let (start, end) = self.compute_id_range(id);
let kills = self.kills.slice(start, end);
bitwise(bits, kills, |a, b| a & !b);
debug2!("apply_kill(id={:?}, bits={}) [after]",
debug!("apply_kill(id={:?}, bits={}) [after]",
id, mut_bits_to_str(bits));
}
@ -242,7 +242,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
let (start, end) = self.compute_id_range_frozen(id);
let on_entry = self.on_entry.slice(start, end);
debug2!("each_bit_on_entry_frozen(id={:?}, on_entry={})",
debug!("each_bit_on_entry_frozen(id={:?}, on_entry={})",
id, bits_to_str(on_entry));
self.each_bit(on_entry, f)
}
@ -255,7 +255,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
let (start, end) = self.compute_id_range(id);
let on_entry = self.on_entry.slice(start, end);
debug2!("each_bit_on_entry(id={:?}, on_entry={})",
debug!("each_bit_on_entry(id={:?}, on_entry={})",
id, bits_to_str(on_entry));
self.each_bit(on_entry, f)
}
@ -267,7 +267,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
let (start, end) = self.compute_id_range(id);
let gens = self.gens.slice(start, end);
debug2!("each_gen_bit(id={:?}, gens={})",
debug!("each_gen_bit(id={:?}, gens={})",
id, bits_to_str(gens));
self.each_bit(gens, f)
}
@ -281,7 +281,7 @@ impl<O:DataFlowOperator> DataFlowContext<O> {
}
let (start, end) = self.compute_id_range_frozen(id);
let gens = self.gens.slice(start, end);
debug2!("each_gen_bit(id={:?}, gens={})",
debug!("each_gen_bit(id={:?}, gens={})",
id, bits_to_str(gens));
self.each_bit(gens, f)
}
@ -346,8 +346,8 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
}
}
debug2!("Dataflow result:");
debug2!("{}", {
debug!("Dataflow result:");
debug!("{}", {
let this = @(*self).clone();
this.pretty_print_to(io::stderr(), blk);
""
@ -374,7 +374,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
blk: &ast::Block,
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
debug2!("DataFlowContext::walk_block(blk.id={:?}, in_out={})",
debug!("DataFlowContext::walk_block(blk.id={:?}, in_out={})",
blk.id, bits_to_str(reslice(in_out)));
self.merge_with_entry_set(blk.id, in_out);
@ -425,7 +425,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
expr: &ast::Expr,
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
debug2!("DataFlowContext::walk_expr(expr={}, in_out={})",
debug!("DataFlowContext::walk_expr(expr={}, in_out={})",
expr.repr(self.dfcx.tcx), bits_to_str(reslice(in_out)));
self.merge_with_entry_set(expr.id, in_out);
@ -569,7 +569,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
copy_bits(new_loop_scope.break_bits, in_out);
}
ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ast::ExprLoop(ref blk, _) => {
//
@ -756,7 +756,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
let tcx = self.tcx();
let region_maps = tcx.region_maps;
debug2!("pop_scopes(from_expr={}, to_scope={:?}, in_out={})",
debug!("pop_scopes(from_expr={}, to_scope={:?}, in_out={})",
from_expr.repr(tcx), to_scope.loop_id,
bits_to_str(reslice(in_out)));
@ -784,7 +784,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
self.pop_scopes(from_expr, to_scope, in_out);
self.dfcx.apply_kill(from_expr.id, in_out);
join_bits(&self.dfcx.oper, reslice(in_out), to_scope.break_bits);
debug2!("break_from_to(from_expr={}, to_scope={:?}) final break_bits={}",
debug!("break_from_to(from_expr={}, to_scope={:?}) final break_bits={}",
from_expr.repr(self.tcx()),
to_scope.loop_id,
bits_to_str(reslice(in_out)));
@ -833,11 +833,11 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
pat: @ast::Pat,
in_out: &mut [uint],
_loop_scopes: &mut ~[LoopScope]) {
debug2!("DataFlowContext::walk_pat(pat={}, in_out={})",
debug!("DataFlowContext::walk_pat(pat={}, in_out={})",
pat.repr(self.dfcx.tcx), bits_to_str(reslice(in_out)));
do ast_util::walk_pat(pat) |p| {
debug2!(" p.id={:?} in_out={}", p.id, bits_to_str(reslice(in_out)));
debug!(" p.id={:?} in_out={}", p.id, bits_to_str(reslice(in_out)));
self.merge_with_entry_set(p.id, in_out);
self.dfcx.apply_gen_kill(p.id, in_out);
true
@ -909,7 +909,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}
fn add_to_entry_set(&mut self, id: ast::NodeId, pred_bits: &[uint]) {
debug2!("add_to_entry_set(id={:?}, pred_bits={})",
debug!("add_to_entry_set(id={:?}, pred_bits={})",
id, bits_to_str(pred_bits));
let (start, end) = self.dfcx.compute_id_range(id);
let changed = { // FIXME(#5074) awkward construction
@ -917,7 +917,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
join_bits(&self.dfcx.oper, pred_bits, on_entry)
};
if changed {
debug2!("changed entry set for {:?} to {}",
debug!("changed entry set for {:?} to {}",
id, bits_to_str(self.dfcx.on_entry.slice(start, end)));
self.changed = true;
}
@ -926,7 +926,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
fn merge_with_entry_set(&mut self,
id: ast::NodeId,
pred_bits: &mut [uint]) {
debug2!("merge_with_entry_set(id={:?}, pred_bits={})",
debug!("merge_with_entry_set(id={:?}, pred_bits={})",
id, mut_bits_to_str(pred_bits));
let (start, end) = self.dfcx.compute_id_range(id);
let changed = { // FIXME(#5074) awkward construction
@ -936,7 +936,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
changed
};
if changed {
debug2!("changed entry set for {:?} to {}",
debug!("changed entry set for {:?} to {}",
id, bits_to_str(self.dfcx.on_entry.slice(start, end)));
self.changed = true;
}
@ -992,12 +992,12 @@ fn bitwise(out_vec: &mut [uint],
}
fn set_bit(words: &mut [uint], bit: uint) -> bool {
debug2!("set_bit: words={} bit={}",
debug!("set_bit: words={} bit={}",
mut_bits_to_str(words), bit_str(bit));
let word = bit / uint::bits;
let bit_in_word = bit % uint::bits;
let bit_mask = 1 << bit_in_word;
debug2!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word);
debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word);
let oldv = words[word];
let newv = oldv | bit_mask;
words[word] = newv;

View file

@ -55,7 +55,7 @@ impl EffectCheckVisitor {
}
UnsafeBlock(block_id) => {
// OK, but record this.
debug2!("effect: recording unsafe block as used: {:?}", block_id);
debug!("effect: recording unsafe block as used: {:?}", block_id);
let _ = self.tcx.used_unsafe.insert(block_id);
}
UnsafeFn => {}
@ -67,7 +67,7 @@ impl EffectCheckVisitor {
ast::ExprIndex(_, base, _) => ty::node_id_to_type(self.tcx, base.id),
_ => return
};
debug2!("effect: checking index with base type {}",
debug!("effect: checking index with base type {}",
ppaux::ty_to_str(self.tcx, base_type));
match ty::get(base_type).sty {
ty::ty_estr(*) => {
@ -121,7 +121,7 @@ impl Visitor<()> for EffectCheckVisitor {
match expr.node {
ast::ExprMethodCall(callee_id, _, _, _, _, _) => {
let base_type = ty::node_id_to_type(self.tcx, callee_id);
debug2!("effect: method call case, base type is {}",
debug!("effect: method call case, base type is {}",
ppaux::ty_to_str(self.tcx, base_type));
if type_is_unsafe_function(base_type) {
self.require_unsafe(expr.span,
@ -130,7 +130,7 @@ impl Visitor<()> for EffectCheckVisitor {
}
ast::ExprCall(base, _, _) => {
let base_type = ty::node_id_to_type(self.tcx, base.id);
debug2!("effect: call case, base type is {}",
debug!("effect: call case, base type is {}",
ppaux::ty_to_str(self.tcx, base_type));
if type_is_unsafe_function(base_type) {
self.require_unsafe(expr.span, "call to unsafe function")
@ -138,7 +138,7 @@ impl Visitor<()> for EffectCheckVisitor {
}
ast::ExprUnary(_, ast::UnDeref, base) => {
let base_type = ty::node_id_to_type(self.tcx, base.id);
debug2!("effect: unary case, base type is {}",
debug!("effect: unary case, base type is {}",
ppaux::ty_to_str(self.tcx, base_type));
match ty::get(base_type).sty {
ty::ty_ptr(_) => {

View file

@ -53,7 +53,7 @@ impl Visitor<int> for CollectFreevarsVisitor {
ast::ExprPath(*) | ast::ExprSelf => {
let mut i = 0;
match self.def_map.find(&expr.id) {
None => fail2!("path not found"),
None => fail!("path not found"),
Some(&df) => {
let mut def = df;
while i < depth {
@ -137,7 +137,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: &ast::Crate) ->
pub fn get_freevars(tcx: ty::ctxt, fid: ast::NodeId) -> freevar_info {
match tcx.freevars.find(&fid) {
None => fail2!("get_freevars: {} has no freevars", fid),
None => fail!("get_freevars: {} has no freevars", fid),
Some(&d) => return d
}
}

View file

@ -343,7 +343,7 @@ mod test {
do graph.each_incoming_edge(start_index) |edge_index, edge| {
assert_eq!(graph.edge_data(edge_index), &edge.data);
assert!(counter < expected_incoming.len());
debug2!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
counter, expected_incoming[counter], edge_index, edge);
match expected_incoming[counter] {
(ref e, ref n) => {
@ -361,7 +361,7 @@ mod test {
do graph.each_outgoing_edge(start_index) |edge_index, edge| {
assert_eq!(graph.edge_data(edge_index), &edge.data);
assert!(counter < expected_outgoing.len());
debug2!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
counter, expected_outgoing[counter], edge_index, edge);
match expected_outgoing[counter] {
(ref e, ref n) => {

View file

@ -124,7 +124,7 @@ fn check_impl_of_trait(cx: &mut Context, it: @item, trait_ref: &trait_ref, self_
// If this trait has builtin-kind supertraits, meet them.
let self_ty: ty::t = ty::node_id_to_type(cx.tcx, it.id);
debug2!("checking impl with self type {:?}", ty::get(self_ty).sty);
debug!("checking impl with self type {:?}", ty::get(self_ty).sty);
do check_builtin_bounds(cx, self_ty, trait_def.bounds) |missing| {
cx.tcx.sess.span_err(self_type.span,
format!("the type `{}', which does not fulfill `{}`, cannot implement this \
@ -265,7 +265,7 @@ fn check_fn(
}
pub fn check_expr(cx: &mut Context, e: @Expr) {
debug2!("kind::check_expr({})", expr_to_str(e, cx.tcx.sess.intr()));
debug!("kind::check_expr({})", expr_to_str(e, cx.tcx.sess.intr()));
// Handle any kind bounds on type parameters
let type_parameter_id = match e.get_callee_id() {
@ -292,7 +292,7 @@ pub fn check_expr(cx: &mut Context, e: @Expr) {
};
if ts.len() != type_param_defs.len() {
// Fail earlier to make debugging easier
fail2!("internal error: in kind::check_expr, length \
fail!("internal error: in kind::check_expr, length \
mismatch between actual and declared bounds: actual = \
{}, declared = {}",
ts.repr(cx.tcx),
@ -451,7 +451,7 @@ fn check_imm_free_var(cx: &Context, def: Def, sp: Span) {
}
fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
debug2!("type_contents({})={}",
debug!("type_contents({})={}",
ty_to_str(cx.tcx, ty),
ty::type_contents(cx.tcx, ty).to_str());
if ty::type_moves_by_default(cx.tcx, ty) {

View file

@ -359,7 +359,7 @@ impl Context {
return *k;
}
}
fail2!("unregistered lint {:?}", lint);
fail!("unregistered lint {:?}", lint);
}
fn span_lint(&self, lint: lint, span: Span, msg: &str) {
@ -380,7 +380,7 @@ impl Context {
format!("{} [-{} {}]", msg,
match level {
warn => 'W', deny => 'D', forbid => 'F',
allow => fail2!()
allow => fail!()
}, self.lint_to_str(lint).replace("_", "-"))
},
Node(src) => {
@ -391,7 +391,7 @@ impl Context {
match level {
warn => { self.tcx.sess.span_warn(span, msg); }
deny | forbid => { self.tcx.sess.span_err(span, msg); }
allow => fail2!(),
allow => fail!(),
}
for &span in note.iter() {
@ -526,7 +526,7 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
ast::BiGt => v >= min,
ast::BiGe => v > min,
ast::BiEq | ast::BiNe => v >= min && v <= max,
_ => fail2!()
_ => fail!()
}
}
@ -582,7 +582,7 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
ast::lit_int_unsuffixed(v) => v,
_ => return true
},
_ => fail2!()
_ => fail!()
};
is_valid(norm_binop, lit_val, min, max)
}
@ -595,7 +595,7 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
ast::lit_int_unsuffixed(v) => v as u64,
_ => return true
},
_ => fail2!()
_ => fail!()
};
is_valid(norm_binop, lit_val, min, max)
}

View file

@ -276,7 +276,7 @@ impl IrMaps {
self.lnks.push(lnk);
self.num_live_nodes += 1;
debug2!("{} is of kind {}", ln.to_str(),
debug!("{} is of kind {}", ln.to_str(),
live_node_kind_to_str(lnk, self.tcx));
ln
@ -288,7 +288,7 @@ impl IrMaps {
let ln = self.add_live_node(lnk);
self.live_node_map.insert(node_id, ln);
debug2!("{} is node {}", ln.to_str(), node_id);
debug!("{} is node {}", ln.to_str(), node_id);
}
pub fn add_variable(&mut self, vk: VarKind) -> Variable {
@ -303,7 +303,7 @@ impl IrMaps {
ImplicitRet => {}
}
debug2!("{} is {:?}", v.to_str(), vk);
debug!("{} is {:?}", v.to_str(), vk);
v
}
@ -367,7 +367,7 @@ fn visit_fn(v: &mut LivenessVisitor,
sp: Span,
id: NodeId,
this: @mut IrMaps) {
debug2!("visit_fn: id={}", id);
debug!("visit_fn: id={}", id);
let _i = ::util::common::indenter();
// swap in a new set of IR maps for this function body:
@ -376,13 +376,13 @@ fn visit_fn(v: &mut LivenessVisitor,
this.capture_map);
unsafe {
debug2!("creating fn_maps: {}", transmute::<&IrMaps, *IrMaps>(fn_maps));
debug!("creating fn_maps: {}", transmute::<&IrMaps, *IrMaps>(fn_maps));
}
for arg in decl.inputs.iter() {
do pat_util::pat_bindings(this.tcx.def_map, arg.pat)
|_bm, arg_id, _x, path| {
debug2!("adding argument {}", arg_id);
debug!("adding argument {}", arg_id);
let ident = ast_util::path_to_ident(path);
fn_maps.add_variable(Arg(arg_id, ident));
}
@ -429,7 +429,7 @@ fn visit_fn(v: &mut LivenessVisitor,
fn visit_local(v: &mut LivenessVisitor, local: @Local, this: @mut IrMaps) {
let def_map = this.tcx.def_map;
do pat_util::pat_bindings(def_map, local.pat) |_bm, p_id, sp, path| {
debug2!("adding local variable {}", p_id);
debug!("adding local variable {}", p_id);
let name = ast_util::path_to_ident(path);
this.add_live_node_for_node(p_id, VarDefNode(sp));
let kind = match local.init {
@ -450,7 +450,7 @@ fn visit_arm(v: &mut LivenessVisitor, arm: &Arm, this: @mut IrMaps) {
let def_map = this.tcx.def_map;
for pat in arm.pats.iter() {
do pat_util::pat_bindings(def_map, *pat) |bm, p_id, sp, path| {
debug2!("adding local variable {} from match with bm {:?}",
debug!("adding local variable {} from match with bm {:?}",
p_id, bm);
let name = ast_util::path_to_ident(path);
this.add_live_node_for_node(p_id, VarDefNode(sp));
@ -470,7 +470,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) {
// live nodes required for uses or definitions of variables:
ExprPath(_) | ExprSelf => {
let def = this.tcx.def_map.get_copy(&expr.id);
debug2!("expr {}: path that leads to {:?}", expr.id, def);
debug!("expr {}: path that leads to {:?}", expr.id, def);
if moves::moved_variable_node_id_from_def(def).is_some() {
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
}
@ -515,7 +515,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) {
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
visit::walk_expr(v, expr, this);
}
ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ExprBinary(_, op, _, _) if ast_util::lazy_binop(op) => {
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
visit::walk_expr(v, expr, this);
@ -819,7 +819,7 @@ impl Liveness {
self.indices2(ln, succ_ln, |idx, succ_idx| {
self.users[idx] = self.users[succ_idx]
});
debug2!("init_from_succ(ln={}, succ={})",
debug!("init_from_succ(ln={}, succ={})",
self.ln_str(ln), self.ln_str(succ_ln));
}
@ -843,7 +843,7 @@ impl Liveness {
}
}
debug2!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})",
debug!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})",
ln.to_str(), self.ln_str(succ_ln), first_merge, changed);
return changed;
@ -866,7 +866,7 @@ impl Liveness {
self.users[idx].reader = invalid_node();
self.users[idx].writer = invalid_node();
debug2!("{} defines {} (idx={}): {}", writer.to_str(), var.to_str(),
debug!("{} defines {} (idx={}): {}", writer.to_str(), var.to_str(),
idx, self.ln_str(writer));
}
@ -891,7 +891,7 @@ impl Liveness {
user.used = true;
}
debug2!("{} accesses[{:x}] {}: {}",
debug!("{} accesses[{:x}] {}: {}",
ln.to_str(), acc, var.to_str(), self.ln_str(ln));
}
@ -902,18 +902,18 @@ impl Liveness {
// effectively a return---this only occurs in `for` loops,
// where the body is really a closure.
debug2!("compute: using id for block, {}", block_to_str(body,
debug!("compute: using id for block, {}", block_to_str(body,
self.tcx.sess.intr()));
let entry_ln: LiveNode =
self.with_loop_nodes(body.id, self.s.exit_ln, self.s.exit_ln,
|| { self.propagate_through_fn_block(decl, body) });
// hack to skip the loop unless debug2! is enabled:
debug2!("^^ liveness computation results for body {} (entry={})",
// hack to skip the loop unless debug! is enabled:
debug!("^^ liveness computation results for body {} (entry={})",
{
for ln_idx in range(0u, self.ir.num_live_nodes) {
debug2!("{}", self.ln_str(LiveNode(ln_idx)));
debug!("{}", self.ln_str(LiveNode(ln_idx)));
}
body.id
},
@ -1007,7 +1007,7 @@ impl Liveness {
pub fn propagate_through_expr(&self, expr: @Expr, succ: LiveNode)
-> LiveNode {
debug2!("propagate_through_expr: {}",
debug!("propagate_through_expr: {}",
expr_to_str(expr, self.tcx.sess.intr()));
match expr.node {
@ -1022,7 +1022,7 @@ impl Liveness {
}
ExprFnBlock(_, ref blk) => {
debug2!("{} is an expr_fn_block",
debug!("{} is an expr_fn_block",
expr_to_str(expr, self.tcx.sess.intr()));
/*
@ -1070,7 +1070,7 @@ impl Liveness {
self.propagate_through_loop(expr, Some(cond), blk, succ)
}
ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
// Note that labels have been resolved, so we don't need to look
// at the label ident
@ -1382,7 +1382,7 @@ impl Liveness {
self.merge_from_succ(ln, succ, first_merge);
first_merge = false;
}
debug2!("propagate_through_loop: using id for loop body {} {}",
debug!("propagate_through_loop: using id for loop body {} {}",
expr.id, block_to_str(body, self.tcx.sess.intr()));
let cond_ln = self.propagate_through_opt_expr(cond, ln);
@ -1410,7 +1410,7 @@ impl Liveness {
cont_ln: LiveNode,
f: &fn() -> R)
-> R {
debug2!("with_loop_nodes: {} {}", loop_node_id, *break_ln);
debug!("with_loop_nodes: {} {}", loop_node_id, *break_ln);
self.loop_scope.push(loop_node_id);
self.break_ln.insert(loop_node_id, break_ln);
self.cont_ln.insert(loop_node_id, cont_ln);
@ -1433,7 +1433,7 @@ fn check_local(this: &mut Liveness, local: @Local) {
// No initializer: the variable might be unused; if not, it
// should not be live at this point.
debug2!("check_local() with no initializer");
debug!("check_local() with no initializer");
do this.pat_bindings(local.pat) |ln, var, sp, id| {
if !this.warn_about_unused(sp, id, ln, var) {
match this.live_on_exit(ln, var) {
@ -1499,7 +1499,7 @@ fn check_expr(this: &mut Liveness, expr: @Expr) {
ExprParen(*) | ExprFnBlock(*) | ExprPath(*) | ExprSelf(*) => {
visit::walk_expr(this, expr, ());
}
ExprForLoop(*) => fail2!("non-desugared expr_for_loop")
ExprForLoop(*) => fail!("non-desugared expr_for_loop")
}
}

View file

@ -383,7 +383,7 @@ impl mem_categorization_ctxt {
}
pub fn cat_expr_unadjusted(&self, expr: @ast::Expr) -> cmt {
debug2!("cat_expr: id={} expr={}",
debug!("cat_expr: id={} expr={}",
expr.id, pprust::expr_to_str(expr, self.tcx.sess.intr()));
let expr_ty = self.expr_ty(expr);
@ -436,7 +436,7 @@ impl mem_categorization_ctxt {
return self.cat_rvalue_node(expr, expr_ty);
}
ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop")
ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop")
}
}
@ -870,7 +870,7 @@ impl mem_categorization_ctxt {
// get the type of the *subpattern* and use that.
let tcx = self.tcx;
debug2!("cat_pattern: id={} pat={} cmt={}",
debug!("cat_pattern: id={} pat={} cmt={}",
pat.id, pprust::pat_to_str(pat, tcx.sess.intr()),
cmt.repr(tcx));
let _i = indenter();

View file

@ -275,7 +275,7 @@ impl VisitContext {
* meaning either copied or moved depending on its type.
*/
debug2!("consume_expr(expr={})",
debug!("consume_expr(expr={})",
expr.repr(self.tcx));
let expr_ty = ty::expr_ty_adjusted(self.tcx, expr);
@ -293,7 +293,7 @@ impl VisitContext {
* meaning either copied or moved depending on its type.
*/
debug2!("consume_block(blk.id={:?})", blk.id);
debug!("consume_block(blk.id={:?})", blk.id);
for stmt in blk.stmts.iter() {
self.visit_stmt(*stmt, ());
@ -312,7 +312,7 @@ impl VisitContext {
* in turn trigger calls to the subcomponents of `expr`.
*/
debug2!("use_expr(expr={}, mode={:?})",
debug!("use_expr(expr={}, mode={:?})",
expr.repr(self.tcx),
expr_mode);
@ -326,7 +326,7 @@ impl VisitContext {
_ => expr_mode
};
debug2!("comp_mode = {:?}", comp_mode);
debug!("comp_mode = {:?}", comp_mode);
match expr.node {
ExprPath(*) | ExprSelf => {
@ -500,7 +500,7 @@ impl VisitContext {
self.consume_block(blk);
}
ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ExprUnary(_, _, lhs) => {
if !self.use_overloaded_operator(expr, lhs, [])
@ -620,7 +620,7 @@ impl VisitContext {
BindByRef(_) => false,
BindInfer => {
let pat_ty = ty::node_id_to_type(self.tcx, id);
debug2!("pattern {:?} {} type is {}",
debug!("pattern {:?} {} type is {}",
id,
ast_util::path_to_ident(path).repr(self.tcx),
pat_ty.repr(self.tcx));
@ -628,7 +628,7 @@ impl VisitContext {
}
};
debug2!("pattern binding {:?}: bm={:?}, binding_moves={}",
debug!("pattern binding {:?}: bm={:?}, binding_moves={}",
id, bm, binding_moves);
if binding_moves {
@ -678,7 +678,7 @@ impl VisitContext {
}
pub fn compute_captures(&mut self, fn_expr_id: NodeId) -> @[CaptureVar] {
debug2!("compute_capture_vars(fn_expr_id={:?})", fn_expr_id);
debug!("compute_capture_vars(fn_expr_id={:?})", fn_expr_id);
let _indenter = indenter();
let fn_ty = ty::node_id_to_type(self.tcx, fn_expr_id);
@ -696,7 +696,7 @@ impl VisitContext {
let fvar = &freevars[i];
let fvar_def_id = ast_util::def_id_of_def(fvar.def).node;
let fvar_ty = ty::node_id_to_type(self.tcx, fvar_def_id);
debug2!("fvar_def_id={:?} fvar_ty={}",
debug!("fvar_def_id={:?} fvar_ty={}",
fvar_def_id, ppaux::ty_to_str(self.tcx, fvar_ty));
let mode = if ty::type_moves_by_default(self.tcx, fvar_ty) {
CapMove

View file

@ -192,7 +192,7 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
// Trait implementation methods are all completely public
ast::item_impl(_, Some(*), _, ref methods) => {
for method in methods.iter() {
debug2!("exporting: {}", method.id);
debug!("exporting: {}", method.id);
self.exported_items.insert(method.id);
}
}
@ -203,11 +203,11 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
for method in methods.iter() {
match *method {
ast::provided(ref m) => {
debug2!("provided {}", m.id);
debug!("provided {}", m.id);
self.exported_items.insert(m.id);
}
ast::required(ref m) => {
debug2!("required {}", m.id);
debug!("required {}", m.id);
self.exported_items.insert(m.id);
}
}
@ -267,26 +267,26 @@ impl<'self> PrivacyVisitor<'self> {
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
if !is_local(did) {
if self.external_exports.contains(&did) {
debug2!("privacy - {:?} was externally exported", did);
debug!("privacy - {:?} was externally exported", did);
return Allowable;
}
debug2!("privacy - is {:?} a public method", did);
debug!("privacy - is {:?} a public method", did);
return match self.tcx.methods.find(&did) {
Some(meth) => {
debug2!("privacy - well at least it's a method: {:?}", meth);
debug!("privacy - well at least it's a method: {:?}", meth);
match meth.container {
ty::TraitContainer(id) => {
debug2!("privacy - recursing on trait {:?}", id);
debug!("privacy - recursing on trait {:?}", id);
self.def_privacy(id)
}
ty::ImplContainer(id) => {
match ty::impl_trait_ref(self.tcx, id) {
Some(t) => {
debug2!("privacy - impl of trait {:?}", id);
debug!("privacy - impl of trait {:?}", id);
self.def_privacy(t.def_id)
}
None => {
debug2!("privacy - found a method {:?}",
debug!("privacy - found a method {:?}",
meth.vis);
if meth.vis == ast::public {
Allowable
@ -299,19 +299,19 @@ impl<'self> PrivacyVisitor<'self> {
}
}
None => {
debug2!("privacy - nope, not even a method");
debug!("privacy - nope, not even a method");
ExternallyDenied
}
};
} else if self.exported_items.contains(&did.node) {
debug2!("privacy - exported item {}", self.nodestr(did.node));
debug!("privacy - exported item {}", self.nodestr(did.node));
return Allowable;
}
debug2!("privacy - local {:?} not public all the way down", did);
debug!("privacy - local {:?} not public all the way down", did);
// return quickly for things in the same module
if self.parents.find(&did.node) == self.parents.find(&self.curitem) {
debug2!("privacy - same parent, we're done here");
debug!("privacy - same parent, we're done here");
return Allowable;
}
@ -319,7 +319,7 @@ impl<'self> PrivacyVisitor<'self> {
// destination and the root.
let mut closest_private_id = did.node;
loop {
debug2!("privacy - examining {}", self.nodestr(closest_private_id));
debug!("privacy - examining {}", self.nodestr(closest_private_id));
let vis = match self.tcx.items.find(&closest_private_id) {
Some(&ast_map::node_item(it, _)) => it.vis,
Some(&ast_map::node_method(ref m, _, _)) => m.vis,
@ -339,7 +339,7 @@ impl<'self> PrivacyVisitor<'self> {
// way down in the first place...
assert!(closest_private_id != ast::DUMMY_NODE_ID);
}
debug2!("privacy - closest priv {}", self.nodestr(closest_private_id));
debug!("privacy - closest priv {}", self.nodestr(closest_private_id));
if self.private_accessible(closest_private_id) {
Allowable
} else {
@ -352,7 +352,7 @@ impl<'self> PrivacyVisitor<'self> {
/// inside.
fn private_accessible(&self, id: ast::NodeId) -> bool {
let parent = *self.parents.get(&id);
debug2!("privacy - accessible parent {}", self.nodestr(parent));
debug!("privacy - accessible parent {}", self.nodestr(parent));
// After finding `did`'s closest private member, we roll ourselves back
// to see if this private member's parent is anywhere in our ancestry.
@ -360,7 +360,7 @@ impl<'self> PrivacyVisitor<'self> {
// members, so that's why we test the parent, and not the did itself.
let mut cur = self.curitem;
loop {
debug2!("privacy - questioning {}", self.nodestr(cur));
debug!("privacy - questioning {}", self.nodestr(cur));
match cur {
// If the relevant parent is in our history, then we're allowed
// to look inside any of our ancestor's immediate private items,
@ -458,7 +458,7 @@ impl<'self> PrivacyVisitor<'self> {
// Checks that a path is in scope.
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
debug2!("privacy - path {}", self.nodestr(path_id));
debug!("privacy - path {}", self.nodestr(path_id));
let def = self.tcx.def_map.get_copy(&path_id);
let ck = |tyname: &str| {
let origdid = def_id_of_def(def);
@ -703,7 +703,7 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
}
Some(entry) => entry
};
debug2!("(privacy checking) checking impl method");
debug!("(privacy checking) checking impl method");
self.check_method(expr.span, &entry.origin, ident);
}
_ => {}
@ -773,12 +773,12 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
match vpath.node {
ast::view_path_simple(_, ref path, id) |
ast::view_path_glob(ref path, id) => {
debug2!("privacy - glob/simple {}", id);
debug!("privacy - glob/simple {}", id);
self.check_path(vpath.span, id, path);
}
ast::view_path_list(_, ref list, _) => {
for pid in list.iter() {
debug2!("privacy - list {}", pid.node.id);
debug!("privacy - list {}", pid.node.id);
let seg = ast::PathSegment {
identifier: pid.node.name,
lifetime: None,

View file

@ -93,13 +93,13 @@ impl RegionMaps {
None => {}
}
debug2!("relate_free_regions(sub={:?}, sup={:?})", sub, sup);
debug!("relate_free_regions(sub={:?}, sup={:?})", sub, sup);
self.free_region_map.insert(sub, ~[sup]);
}
pub fn record_parent(&mut self, sub: ast::NodeId, sup: ast::NodeId) {
debug2!("record_parent(sub={:?}, sup={:?})", sub, sup);
debug!("record_parent(sub={:?}, sup={:?})", sub, sup);
assert!(sub != sup);
self.scope_map.insert(sub, sup);
@ -125,7 +125,7 @@ impl RegionMaps {
match self.scope_map.find(&id) {
Some(&r) => r,
None => { fail2!("No enclosing scope for id {:?}", id); }
None => { fail!("No enclosing scope for id {:?}", id); }
}
}
@ -168,7 +168,7 @@ impl RegionMaps {
while superscope != s {
match self.scope_map.find(&s) {
None => {
debug2!("is_subscope_of({:?}, {:?}, s={:?})=false",
debug!("is_subscope_of({:?}, {:?}, s={:?})=false",
subscope, superscope, s);
return false;
@ -177,7 +177,7 @@ impl RegionMaps {
}
}
debug2!("is_subscope_of({:?}, {:?})=true",
debug!("is_subscope_of({:?}, {:?})=true",
subscope, superscope);
return true;
@ -231,7 +231,7 @@ impl RegionMaps {
* duplicated with the code in infer.rs.
*/
debug2!("is_subregion_of(sub_region={:?}, super_region={:?})",
debug!("is_subregion_of(sub_region={:?}, super_region={:?})",
sub_region, super_region);
sub_region == super_region || {
@ -303,7 +303,7 @@ impl RegionMaps {
fn ancestors_of(this: &RegionMaps, scope: ast::NodeId)
-> ~[ast::NodeId]
{
// debug2!("ancestors_of(scope={})", scope);
// debug!("ancestors_of(scope={})", scope);
let mut result = ~[scope];
let mut scope = scope;
loop {
@ -314,7 +314,7 @@ impl RegionMaps {
scope = superscope;
}
}
// debug2!("ancestors_of_loop(scope={})", scope);
// debug!("ancestors_of_loop(scope={})", scope);
}
}
}
@ -323,7 +323,7 @@ impl RegionMaps {
/// Records the current parent (if any) as the parent of `child_id`.
fn parent_to_expr(visitor: &mut RegionResolutionVisitor,
cx: Context, child_id: ast::NodeId, sp: Span) {
debug2!("region::parent_to_expr(span={:?})",
debug!("region::parent_to_expr(span={:?})",
visitor.sess.codemap.span_to_str(sp));
for parent_id in cx.parent.iter() {
visitor.region_maps.record_parent(child_id, *parent_id);
@ -437,7 +437,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
sp: Span,
id: ast::NodeId,
cx: Context) {
debug2!("region::resolve_fn(id={:?}, \
debug!("region::resolve_fn(id={:?}, \
span={:?}, \
body.id={:?}, \
cx.parent={:?})",
@ -619,7 +619,7 @@ impl DetermineRpCtxt {
Some(v) => join_variance(v, variance)
};
debug2!("add_rp() variance for {}: {:?} == {:?} ^ {:?}",
debug!("add_rp() variance for {}: {:?} == {:?} ^ {:?}",
ast_map::node_id_to_str(self.ast_map, id,
token::get_ident_interner()),
joined_variance, old_variance, variance);
@ -637,7 +637,7 @@ impl DetermineRpCtxt {
/// contains a value of type `from`, so if `from` is
/// region-parameterized, so is the current item.
pub fn add_dep(&mut self, from: ast::NodeId) {
debug2!("add dependency from {} -> {} ({} -> {}) with variance {:?}",
debug!("add dependency from {} -> {} ({} -> {}) with variance {:?}",
from, self.item_id,
ast_map::node_id_to_str(self.ast_map, from,
token::get_ident_interner()),
@ -715,7 +715,7 @@ impl DetermineRpCtxt {
let old_anon_implies_rp = self.anon_implies_rp;
self.item_id = item_id;
self.anon_implies_rp = anon_implies_rp;
debug2!("with_item_id({}, {})",
debug!("with_item_id({}, {})",
item_id,
anon_implies_rp);
let _i = ::util::common::indenter();
@ -787,7 +787,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor,
let sess = cx.sess;
match ty.node {
ast::ty_rptr(ref r, _) => {
debug2!("referenced rptr type {}",
debug!("referenced rptr type {}",
pprust::ty_to_str(ty, sess.intr()));
if cx.region_is_relevant(r) {
@ -797,7 +797,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor,
}
ast::ty_closure(ref f) => {
debug2!("referenced fn type: {}",
debug!("referenced fn type: {}",
pprust::ty_to_str(ty, sess.intr()));
match f.region {
Some(_) => {
@ -837,7 +837,7 @@ fn determine_rp_in_ty(visitor: &mut DetermineRpVisitor,
match csearch::get_region_param(cstore, did) {
None => {}
Some(variance) => {
debug2!("reference to external, rp'd type {}",
debug!("reference to external, rp'd type {}",
pprust::ty_to_str(ty, sess.intr()));
if cx.region_is_relevant(&path.segments.last().lifetime) {
let rv = cx.add_variance(variance);
@ -967,7 +967,7 @@ pub fn determine_rp_in_crate(sess: Session,
while cx.worklist.len() != 0 {
let c_id = cx.worklist.pop();
let c_variance = cx.region_paramd_items.get_copy(&c_id);
debug2!("popped {} from worklist", c_id);
debug!("popped {} from worklist", c_id);
match cx.dep_map.find(&c_id) {
None => {}
Some(deps) => {
@ -980,11 +980,11 @@ pub fn determine_rp_in_crate(sess: Session,
}
}
debug2!("{}", {
debug2!("Region variance results:");
debug!("{}", {
debug!("Region variance results:");
let region_paramd_items = cx.region_paramd_items;
for (&key, &value) in region_paramd_items.iter() {
debug2!("item {:?} ({}) is parameterized with variance {:?}",
debug!("item {:?} ({}) is parameterized with variance {:?}",
key,
ast_map::node_id_to_str(ast_map, key,
token::get_ident_interner()),

View file

@ -665,7 +665,7 @@ impl NameBindings {
fn get_module(&mut self) -> @mut Module {
match self.get_module_if_available() {
None => {
fail2!("get_module called on a node with no module \
fail!("get_module called on a node with no module \
definition!")
}
Some(module_def) => module_def
@ -1405,7 +1405,7 @@ impl Resolver {
}
match self.method_map.find_mut(name) {
Some(s) => { s.insert(def_id); },
_ => fail2!("Can't happen"),
_ => fail!("Can't happen"),
}
}
@ -1414,7 +1414,7 @@ impl Resolver {
}
item_mac(*) => {
fail2!("item macros unimplemented")
fail!("item macros unimplemented")
}
}
}
@ -1596,7 +1596,7 @@ impl Resolver {
if self.block_needs_anonymous_module(block) {
let block_id = block.id;
debug2!("(building reduced graph for block) creating a new \
debug!("(building reduced graph for block) creating a new \
anonymous module for block {}",
block_id);
@ -1621,7 +1621,7 @@ impl Resolver {
final_ident: &str,
ident: Ident,
new_parent: ReducedGraphParent) {
debug2!("(building reduced graph for \
debug!("(building reduced graph for \
external crate) building external def, priv {:?}",
vis);
let is_public = vis == ast::public;
@ -1641,12 +1641,12 @@ impl Resolver {
DefTy(def_id) => {
match child_name_bindings.type_def {
Some(TypeNsDef { module_def: Some(module_def), _ }) => {
debug2!("(building reduced graph for external crate) \
debug!("(building reduced graph for external crate) \
already created module");
module_def.def_id = Some(def_id);
}
Some(_) | None => {
debug2!("(building reduced graph for \
debug!("(building reduced graph for \
external crate) building module \
{}", final_ident);
let parent_link = self.get_parent_link(new_parent, ident);
@ -1666,7 +1666,7 @@ impl Resolver {
match def {
DefMod(_) | DefForeignMod(_) => {}
DefVariant(_, variant_id, is_struct) => {
debug2!("(building reduced graph for external crate) building \
debug!("(building reduced graph for external crate) building \
variant {}",
final_ident);
// We assume the parent is visible, or else we wouldn't have seen
@ -1681,12 +1681,12 @@ impl Resolver {
}
}
DefFn(*) | DefStaticMethod(*) | DefStatic(*) => {
debug2!("(building reduced graph for external \
debug!("(building reduced graph for external \
crate) building value (fn/static) {}", final_ident);
child_name_bindings.define_value(def, dummy_sp(), is_public);
}
DefTrait(def_id) => {
debug2!("(building reduced graph for external \
debug!("(building reduced graph for external \
crate) building type {}", final_ident);
// If this is a trait, add all the method names
@ -1700,7 +1700,7 @@ impl Resolver {
get_method_name_and_explicit_self(self.session.cstore,
method_def_id);
debug2!("(building reduced graph for \
debug!("(building reduced graph for \
external crate) ... adding \
trait method '{}'",
self.session.str_of(method_name));
@ -1719,7 +1719,7 @@ impl Resolver {
}
match self.method_map.find_mut(name) {
Some(s) => { s.insert(def_id); },
_ => fail2!("Can't happen"),
_ => fail!("Can't happen"),
}
}
@ -1735,13 +1735,13 @@ impl Resolver {
dummy_sp())
}
DefTy(_) => {
debug2!("(building reduced graph for external \
debug!("(building reduced graph for external \
crate) building type {}", final_ident);
child_name_bindings.define_type(def, dummy_sp(), is_public);
}
DefStruct(def_id) => {
debug2!("(building reduced graph for external \
debug!("(building reduced graph for external \
crate) building type and value for {}",
final_ident);
child_name_bindings.define_type(def, dummy_sp(), is_public);
@ -1751,7 +1751,7 @@ impl Resolver {
self.structs.insert(def_id);
}
DefMethod(*) => {
debug2!("(building reduced graph for external crate) \
debug!("(building reduced graph for external crate) \
ignoring {:?}", def);
// Ignored; handled elsewhere.
}
@ -1759,7 +1759,7 @@ impl Resolver {
DefPrimTy(*) | DefTyParam(*) | DefBinding(*) |
DefUse(*) | DefUpvar(*) | DefRegion(*) |
DefTyParamBinder(*) | DefLabel(*) | DefSelfTy(*) => {
fail2!("didn't expect `{:?}`", def);
fail!("didn't expect `{:?}`", def);
}
}
}
@ -1814,7 +1814,7 @@ impl Resolver {
match static_methods_opt {
Some(ref static_methods) if
static_methods.len() >= 1 => {
debug2!("(building reduced graph for \
debug!("(building reduced graph for \
external crate) processing \
static methods for type name {}",
self.session.str_of(
@ -1866,7 +1866,7 @@ impl Resolver {
for static_method_info in
static_methods.iter() {
let ident = static_method_info.ident;
debug2!("(building reduced graph for \
debug!("(building reduced graph for \
external crate) creating \
static method '{}'",
self.session.str_of(ident));
@ -1893,7 +1893,7 @@ impl Resolver {
}
}
DlField => {
debug2!("(building reduced graph for external crate) \
debug!("(building reduced graph for external crate) \
ignoring field");
}
}
@ -1901,12 +1901,12 @@ impl Resolver {
/// Builds the reduced graph rooted at the given external module.
fn populate_external_module(&mut self, module: @mut Module) {
debug2!("(populating external module) attempting to populate {}",
debug!("(populating external module) attempting to populate {}",
self.module_to_str(module));
let def_id = match module.def_id {
None => {
debug2!("(populating external module) ... no def ID!");
debug!("(populating external module) ... no def ID!");
return
}
Some(def_id) => def_id,
@ -1914,7 +1914,7 @@ impl Resolver {
do csearch::each_child_of_item(self.session.cstore, def_id)
|def_like, child_ident, visibility| {
debug2!("(populating external module) ... found ident: {}",
debug!("(populating external module) ... found ident: {}",
token::ident_to_str(&child_ident));
self.build_reduced_graph_for_external_crate_def(module,
def_like,
@ -1965,14 +1965,14 @@ impl Resolver {
match *subclass {
SingleImport(target, _) => {
debug2!("(building import directive) building import \
debug!("(building import directive) building import \
directive: {}::{}",
self.idents_to_str(directive.module_path),
self.session.str_of(target));
match module_.import_resolutions.find(&target.name) {
Some(&resolution) => {
debug2!("(building import directive) bumping \
debug!("(building import directive) bumping \
reference");
resolution.outstanding_references += 1;
@ -1981,7 +1981,7 @@ impl Resolver {
resolution.value_id = id;
}
None => {
debug2!("(building import directive) creating new");
debug!("(building import directive) creating new");
let resolution = @mut ImportResolution::new(id, is_public);
resolution.outstanding_references = 1;
module_.import_resolutions.insert(target.name, resolution);
@ -2013,14 +2013,14 @@ impl Resolver {
let mut i = 0;
let mut prev_unresolved_imports = 0;
loop {
debug2!("(resolving imports) iteration {}, {} imports left",
debug!("(resolving imports) iteration {}, {} imports left",
i, self.unresolved_imports);
let module_root = self.graph_root.get_module();
self.resolve_imports_for_module_subtree(module_root);
if self.unresolved_imports == 0 {
debug2!("(resolving imports) success");
debug!("(resolving imports) success");
break;
}
@ -2038,7 +2038,7 @@ impl Resolver {
/// submodules.
fn resolve_imports_for_module_subtree(&mut self,
module_: @mut Module) {
debug2!("(resolving imports for module subtree) resolving {}",
debug!("(resolving imports for module subtree) resolving {}",
self.module_to_str(module_));
self.resolve_imports_for_module(module_);
@ -2062,7 +2062,7 @@ impl Resolver {
/// Attempts to resolve imports for the given module only.
fn resolve_imports_for_module(&mut self, module: @mut Module) {
if module.all_imports_resolved() {
debug2!("(resolving imports for module) all imports resolved for \
debug!("(resolving imports for module) all imports resolved for \
{}",
self.module_to_str(module));
return;
@ -2151,7 +2151,7 @@ impl Resolver {
let mut resolution_result = Failed;
let module_path = &import_directive.module_path;
debug2!("(resolving import for module) resolving import `{}::...` in \
debug!("(resolving import for module) resolving import `{}::...` in \
`{}`",
self.idents_to_str(*module_path),
self.module_to_str(module_));
@ -2256,7 +2256,7 @@ impl Resolver {
directive: &ImportDirective,
lp: LastPrivate)
-> ResolveResult<()> {
debug2!("(resolving single import) resolving `{}` = `{}::{}` from \
debug!("(resolving single import) resolving `{}` = `{}::{}` from \
`{}` id {}, last private {:?}",
self.session.str_of(target),
self.module_to_str(containing_module),
@ -2300,7 +2300,7 @@ impl Resolver {
// able to resolve this import.
if containing_module.glob_count > 0 {
debug2!("(resolving single import) unresolved glob; \
debug!("(resolving single import) unresolved glob; \
bailing out");
return Indeterminate;
}
@ -2368,7 +2368,7 @@ impl Resolver {
}
Some(_) => {
// The import is unresolved. Bail out.
debug2!("(resolving single import) unresolved import; \
debug!("(resolving single import) unresolved import; \
bailing out");
return Indeterminate;
}
@ -2403,7 +2403,7 @@ impl Resolver {
match value_result {
BoundResult(target_module, name_bindings) => {
debug2!("(resolving single import) found value target");
debug!("(resolving single import) found value target");
import_resolution.value_target =
Some(Target::new(target_module, name_bindings));
import_resolution.value_id = directive.id;
@ -2411,12 +2411,12 @@ impl Resolver {
}
UnboundResult => { /* Continue. */ }
UnknownResult => {
fail2!("value result should be known at this point");
fail!("value result should be known at this point");
}
}
match type_result {
BoundResult(target_module, name_bindings) => {
debug2!("(resolving single import) found type target: {:?}",
debug!("(resolving single import) found type target: {:?}",
name_bindings.type_def.unwrap().type_def);
import_resolution.type_target =
Some(Target::new(target_module, name_bindings));
@ -2425,7 +2425,7 @@ impl Resolver {
}
UnboundResult => { /* Continue. */ }
UnknownResult => {
fail2!("type result should be known at this point");
fail!("type result should be known at this point");
}
}
@ -2467,7 +2467,7 @@ impl Resolver {
None => {}
}
debug2!("(resolving single import) successfully resolved import");
debug!("(resolving single import) successfully resolved import");
return Success(());
}
@ -2484,12 +2484,12 @@ impl Resolver {
// This function works in a highly imperative manner; it eagerly adds
// everything it can to the list of import resolutions of the module
// node.
debug2!("(resolving glob import) resolving glob import {}", id);
debug!("(resolving glob import) resolving glob import {}", id);
// We must bail out if the node has unresolved imports of any kind
// (including globs).
if !(*containing_module).all_imports_resolved() {
debug2!("(resolving glob import) target module has unresolved \
debug!("(resolving glob import) target module has unresolved \
imports; bailing out");
return Indeterminate;
}
@ -2499,13 +2499,13 @@ impl Resolver {
// Add all resolved imports from the containing module.
for (ident, target_import_resolution) in containing_module.import_resolutions.iter() {
debug2!("(resolving glob import) writing module resolution \
debug!("(resolving glob import) writing module resolution \
{:?} into `{}`",
target_import_resolution.type_target.is_none(),
self.module_to_str(module_));
if !target_import_resolution.is_public {
debug2!("(resolving glob import) nevermind, just kidding");
debug!("(resolving glob import) nevermind, just kidding");
continue
}
@ -2566,7 +2566,7 @@ impl Resolver {
}
}
debug2!("(resolving glob import) writing resolution `{}` in `{}` \
debug!("(resolving glob import) writing resolution `{}` in `{}` \
to `{}`",
interner_get(name),
self.module_to_str(containing_module),
@ -2574,13 +2574,13 @@ impl Resolver {
// Merge the child item into the import resolution.
if name_bindings.defined_in_public_namespace(ValueNS) {
debug2!("(resolving glob import) ... for value target");
debug!("(resolving glob import) ... for value target");
dest_import_resolution.value_target =
Some(Target::new(containing_module, name_bindings));
dest_import_resolution.value_id = id;
}
if name_bindings.defined_in_public_namespace(TypeNS) {
debug2!("(resolving glob import) ... for type target");
debug!("(resolving glob import) ... for type target");
dest_import_resolution.type_target =
Some(Target::new(containing_module, name_bindings));
dest_import_resolution.type_id = id;
@ -2610,7 +2610,7 @@ impl Resolver {
None => {}
}
debug2!("(resolving glob import) successfully resolved import");
debug!("(resolving glob import) successfully resolved import");
return Success(());
}
@ -2658,7 +2658,7 @@ impl Resolver {
return Failed;
}
Indeterminate => {
debug2!("(resolving module path for import) module \
debug!("(resolving module path for import) module \
resolution is indeterminate: {}",
self.session.str_of(name));
return Indeterminate;
@ -2747,7 +2747,7 @@ impl Resolver {
let module_path_len = module_path.len();
assert!(module_path_len > 0);
debug2!("(resolving module path for import) processing `{}` rooted at \
debug!("(resolving module path for import) processing `{}` rooted at \
`{}`",
self.idents_to_str(module_path),
self.module_to_str(module_));
@ -2776,7 +2776,7 @@ impl Resolver {
return Failed;
}
Indeterminate => {
debug2!("(resolving module path for import) indeterminate; \
debug!("(resolving module path for import) indeterminate; \
bailing");
return Indeterminate;
}
@ -2805,7 +2805,7 @@ impl Resolver {
return Failed;
}
Indeterminate => {
debug2!("(resolving module path for import) \
debug!("(resolving module path for import) \
indeterminate; bailing");
return Indeterminate;
}
@ -2842,7 +2842,7 @@ impl Resolver {
search_through_modules:
SearchThroughModulesFlag)
-> ResolveResult<(Target, bool)> {
debug2!("(resolving item in lexical scope) resolving `{}` in \
debug!("(resolving item in lexical scope) resolving `{}` in \
namespace {:?} in `{}`",
self.session.str_of(name),
namespace,
@ -2854,7 +2854,7 @@ impl Resolver {
match module_.children.find(&name.name) {
Some(name_bindings)
if name_bindings.defined_in_namespace(namespace) => {
debug2!("top name bindings succeeded");
debug!("top name bindings succeeded");
return Success((Target::new(module_, *name_bindings), false));
}
Some(_) | None => { /* Not found; continue. */ }
@ -2872,12 +2872,12 @@ impl Resolver {
match (*import_resolution).target_for_namespace(namespace) {
None => {
// Not found; continue.
debug2!("(resolving item in lexical scope) found \
debug!("(resolving item in lexical scope) found \
import resolution, but not in namespace {:?}",
namespace);
}
Some(target) => {
debug2!("(resolving item in lexical scope) using \
debug!("(resolving item in lexical scope) using \
import resolution");
self.used_imports.insert(import_resolution.id(namespace));
return Success((target, false));
@ -2894,7 +2894,7 @@ impl Resolver {
let name_bindings =
@mut Resolver::create_name_bindings_from_module(
*module);
debug2!("lower name bindings succeeded");
debug!("lower name bindings succeeded");
return Success((Target::new(module_, name_bindings), false));
}
}
@ -2907,7 +2907,7 @@ impl Resolver {
match search_module.parent_link {
NoParentLink => {
// No more parents. This module was unresolved.
debug2!("(resolving item in lexical scope) unresolved \
debug!("(resolving item in lexical scope) unresolved \
module");
return Failed;
}
@ -2917,7 +2917,7 @@ impl Resolver {
match search_module.kind {
NormalModuleKind => {
// We stop the search here.
debug2!("(resolving item in lexical \
debug!("(resolving item in lexical \
scope) unresolved module: not \
searching through module \
parents");
@ -2953,13 +2953,13 @@ impl Resolver {
// We couldn't see through the higher scope because of an
// unresolved import higher up. Bail.
debug2!("(resolving item in lexical scope) indeterminate \
debug!("(resolving item in lexical scope) indeterminate \
higher scope; bailing");
return Indeterminate;
}
Success((target, used_reexport)) => {
// We found the module.
debug2!("(resolving item in lexical scope) found name \
debug!("(resolving item in lexical scope) found name \
in module, done");
return Success((target, used_reexport));
}
@ -2983,7 +2983,7 @@ impl Resolver {
Some(ref type_def) => {
match (*type_def).module_def {
None => {
error2!("!!! (resolving module in lexical \
error!("!!! (resolving module in lexical \
scope) module wasn't actually a \
module!");
return Failed;
@ -2994,19 +2994,19 @@ impl Resolver {
}
}
None => {
error2!("!!! (resolving module in lexical scope) module
error!("!!! (resolving module in lexical scope) module
wasn't actually a module!");
return Failed;
}
}
}
Indeterminate => {
debug2!("(resolving module in lexical scope) indeterminate; \
debug!("(resolving module in lexical scope) indeterminate; \
bailing");
return Indeterminate;
}
Failed => {
debug2!("(resolving module in lexical scope) failed to \
debug!("(resolving module in lexical scope) failed to \
resolve");
return Failed;
}
@ -3079,7 +3079,7 @@ impl Resolver {
// Now loop through all the `super`s we find.
while i < module_path.len() &&
"super" == token::ident_to_str(&module_path[i]) {
debug2!("(resolving module prefix) resolving `super` at {}",
debug!("(resolving module prefix) resolving `super` at {}",
self.module_to_str(containing_module));
match self.get_nearest_normal_module_parent(containing_module) {
None => return Failed,
@ -3090,7 +3090,7 @@ impl Resolver {
}
}
debug2!("(resolving module prefix) finished resolving prefix at {}",
debug!("(resolving module prefix) finished resolving prefix at {}",
self.module_to_str(containing_module));
return Success(PrefixFound(containing_module, i));
@ -3108,7 +3108,7 @@ impl Resolver {
namespace: Namespace,
name_search_type: NameSearchType)
-> ResolveResult<(Target, bool)> {
debug2!("(resolving name in module) resolving `{}` in `{}`",
debug!("(resolving name in module) resolving `{}` in `{}`",
self.session.str_of(name),
self.module_to_str(module_));
@ -3117,7 +3117,7 @@ impl Resolver {
match module_.children.find(&name.name) {
Some(name_bindings)
if name_bindings.defined_in_namespace(namespace) => {
debug2!("(resolving name in module) found node as child");
debug!("(resolving name in module) found node as child");
return Success((Target::new(module_, *name_bindings), false));
}
Some(_) | None => {
@ -3138,18 +3138,18 @@ impl Resolver {
Some(import_resolution) => {
if import_resolution.is_public &&
import_resolution.outstanding_references != 0 {
debug2!("(resolving name in module) import \
debug!("(resolving name in module) import \
unresolved; bailing out");
return Indeterminate;
}
match import_resolution.target_for_namespace(namespace) {
None => {
debug2!("(resolving name in module) name found, \
debug!("(resolving name in module) name found, \
but not in namespace {:?}",
namespace);
}
Some(target) => {
debug2!("(resolving name in module) resolved to \
debug!("(resolving name in module) resolved to \
import");
self.used_imports.insert(import_resolution.id(namespace));
return Success((target, true));
@ -3173,7 +3173,7 @@ impl Resolver {
}
// We're out of luck.
debug2!("(resolving name in module) failed to resolve `{}`",
debug!("(resolving name in module) failed to resolve `{}`",
self.session.str_of(name));
return Failed;
}
@ -3233,19 +3233,19 @@ impl Resolver {
match module_.def_id {
Some(def_id) if def_id.crate == LOCAL_CRATE => {
// OK. Continue.
debug2!("(recording exports for module subtree) recording \
debug!("(recording exports for module subtree) recording \
exports for local module `{}`",
self.module_to_str(module_));
}
None => {
// Record exports for the root module.
debug2!("(recording exports for module subtree) recording \
debug!("(recording exports for module subtree) recording \
exports for root module `{}`",
self.module_to_str(module_));
}
Some(_) => {
// Bail out.
debug2!("(recording exports for module subtree) not recording \
debug!("(recording exports for module subtree) not recording \
exports for `{}`",
self.module_to_str(module_));
return;
@ -3278,7 +3278,7 @@ impl Resolver {
match module_.def_id {
Some(def_id) => {
self.export_map2.insert(def_id.node, exports2);
debug2!("(computing exports) writing exports for {} (some)",
debug!("(computing exports) writing exports for {} (some)",
def_id.node);
}
None => {}
@ -3293,7 +3293,7 @@ impl Resolver {
reexport: bool) {
match namebindings.def_for_namespace(ns) {
Some(d) => {
debug2!("(computing exports) YES: {} '{}' => {:?}",
debug!("(computing exports) YES: {} '{}' => {:?}",
if reexport { ~"reexport" } else { ~"export"},
interner_get(name),
def_id_of_def(d));
@ -3304,7 +3304,7 @@ impl Resolver {
});
}
d_opt => {
debug2!("(computing reexports) NO: {:?}", d_opt);
debug!("(computing reexports) NO: {:?}", d_opt);
}
}
}
@ -3318,7 +3318,7 @@ impl Resolver {
for &ns in xs.iter() {
match importresolution.target_for_namespace(ns) {
Some(target) => {
debug2!("(computing exports) maybe reexport '{}'",
debug!("(computing exports) maybe reexport '{}'",
interner_get(*name));
self.add_exports_of_namebindings(exports2,
*name,
@ -3362,14 +3362,14 @@ impl Resolver {
self.populate_module_if_necessary(orig_module);
match orig_module.children.find(&name.name) {
None => {
debug2!("!!! (with scope) didn't find `{}` in `{}`",
debug!("!!! (with scope) didn't find `{}` in `{}`",
self.session.str_of(name),
self.module_to_str(orig_module));
}
Some(name_bindings) => {
match (*name_bindings).get_module_if_available() {
None => {
debug2!("!!! (with scope) didn't find module \
debug!("!!! (with scope) didn't find module \
for `{}` in `{}`",
self.session.str_of(name),
self.module_to_str(orig_module));
@ -3529,13 +3529,13 @@ impl Resolver {
}
fn resolve_crate(&mut self, crate: &ast::Crate) {
debug2!("(resolving crate) starting");
debug!("(resolving crate) starting");
visit::walk_crate(self, crate, ());
}
fn resolve_item(&mut self, item: @item) {
debug2!("(resolving item) resolving {}",
debug!("(resolving item) resolving {}",
self.session.str_of(item.ident));
// Items with the !resolve_unexported attribute are X-ray contexts.
@ -3705,7 +3705,7 @@ impl Resolver {
}
item_mac(*) => {
fail2!("item macros unimplemented")
fail!("item macros unimplemented")
}
}
@ -3724,7 +3724,7 @@ impl Resolver {
for (index, type_parameter) in generics.ty_params.iter().enumerate() {
let ident = type_parameter.ident;
debug2!("with_type_parameter_rib: {} {}", node_id,
debug!("with_type_parameter_rib: {} {}", node_id,
type_parameter.id);
let def_like = DlDef(DefTyParam
(local_def(type_parameter.id),
@ -3822,7 +3822,7 @@ impl Resolver {
this.resolve_type(&argument.ty);
debug2!("(resolving function) recorded argument");
debug!("(resolving function) recorded argument");
}
this.resolve_type(&declaration.output);
@ -3832,7 +3832,7 @@ impl Resolver {
// Resolve the function body.
this.resolve_block(block);
debug2!("(resolving function) leaving function");
debug!("(resolving function) leaving function");
}
self.label_ribs.pop();
@ -3876,7 +3876,7 @@ impl Resolver {
self.resolve_error(trait_reference.path.span, msg);
}
Some(def) => {
debug2!("(resolving trait) found trait def: {:?}", def);
debug!("(resolving trait) found trait def: {:?}", def);
self.record_def(trait_reference.ref_id, def);
}
}
@ -4027,7 +4027,7 @@ impl Resolver {
_name: Ident,
id: NodeId) {
// Write the implementations in scope into the module metadata.
debug2!("(resolving module) resolving module ID {}", id);
debug!("(resolving module) resolving module ID {}", id);
visit::walk_mod(self, module_, ());
}
@ -4127,7 +4127,7 @@ impl Resolver {
}
fn resolve_block(&mut self, block: &Block) {
debug2!("(resolving block) entering block");
debug!("(resolving block) entering block");
self.value_ribs.push(@Rib::new(NormalRibKind));
// Move down in the graph, if there's an anonymous module rooted here.
@ -4135,7 +4135,7 @@ impl Resolver {
match self.current_module.anonymous_children.find(&block.id) {
None => { /* Nothing to do. */ }
Some(&anonymous_module) => {
debug2!("(resolving block) found anonymous module, moving \
debug!("(resolving block) found anonymous module, moving \
down");
self.current_module = anonymous_module;
}
@ -4148,7 +4148,7 @@ impl Resolver {
self.current_module = orig_module;
self.value_ribs.pop();
debug2!("(resolving block) leaving block");
debug!("(resolving block) leaving block");
}
fn resolve_type(&mut self, ty: &Ty) {
@ -4199,7 +4199,7 @@ impl Resolver {
None => {
match self.resolve_path(ty.id, path, TypeNS, true) {
Some(def) => {
debug2!("(resolving type) resolved `{}` to \
debug!("(resolving type) resolved `{}` to \
type {:?}",
self.session.str_of(path.segments
.last()
@ -4218,7 +4218,7 @@ impl Resolver {
match result_def {
Some(def) => {
// Write the result into the def map.
debug2!("(resolving type) writing resolution for `{}` \
debug!("(resolving type) writing resolution for `{}` \
(id {})",
self.path_idents_to_str(path),
path_id);
@ -4282,7 +4282,7 @@ impl Resolver {
match self.resolve_bare_identifier_pattern(ident) {
FoundStructOrEnumVariant(def, lp)
if mode == RefutableMode => {
debug2!("(resolving pattern) resolving `{}` to \
debug!("(resolving pattern) resolving `{}` to \
struct or enum variant",
interner_get(renamed));
@ -4301,7 +4301,7 @@ impl Resolver {
interner_get(renamed)));
}
FoundConst(def, lp) if mode == RefutableMode => {
debug2!("(resolving pattern) resolving `{}` to \
debug!("(resolving pattern) resolving `{}` to \
constant",
interner_get(renamed));
@ -4317,7 +4317,7 @@ impl Resolver {
allowed here");
}
BareIdentifierPatternUnresolved => {
debug2!("(resolving pattern) binding `{}`",
debug!("(resolving pattern) binding `{}`",
interner_get(renamed));
let is_mutable = mutability == Mutable;
@ -4490,7 +4490,7 @@ impl Resolver {
self.record_def(pattern.id, definition);
}
result => {
debug2!("(resolving pattern) didn't find struct \
debug!("(resolving pattern) didn't find struct \
def: {:?}", result);
let msg = format!("`{}` does not name a structure",
self.path_idents_to_str(path));
@ -4515,12 +4515,12 @@ impl Resolver {
ValueNS,
SearchThroughModules) {
Success((target, _)) => {
debug2!("(resolve bare identifier pattern) succeeded in \
debug!("(resolve bare identifier pattern) succeeded in \
finding {} at {:?}",
self.session.str_of(name), target.bindings.value_def);
match target.bindings.value_def {
None => {
fail2!("resolved name in the value namespace to a \
fail!("resolved name in the value namespace to a \
set of name bindings with no def?!");
}
Some(def) => {
@ -4543,11 +4543,11 @@ impl Resolver {
}
Indeterminate => {
fail2!("unexpected indeterminate result");
fail!("unexpected indeterminate result");
}
Failed => {
debug2!("(resolve bare identifier pattern) failed to find {}",
debug!("(resolve bare identifier pattern) failed to find {}",
self.session.str_of(name));
return BareIdentifierPatternUnresolved;
}
@ -4713,7 +4713,7 @@ impl Resolver {
}
Indeterminate => {
fail2!("indeterminate unexpected");
fail!("indeterminate unexpected");
}
Success((resulting_module, resulting_last_private)) => {
@ -4740,7 +4740,7 @@ impl Resolver {
Some(s) => {
match containing_module.def_id {
Some(def_id) if s.contains(&def_id) => {
debug2!("containing module was a trait or impl \
debug!("containing module was a trait or impl \
and name was a method -> not resolved");
return None;
},
@ -4781,7 +4781,7 @@ impl Resolver {
}
Indeterminate => {
fail2!("indeterminate unexpected");
fail!("indeterminate unexpected");
}
Success((resulting_module, resulting_last_private)) => {
@ -4827,7 +4827,7 @@ impl Resolver {
match search_result {
Some(DlDef(def)) => {
debug2!("(resolving path in local ribs) resolved `{}` to \
debug!("(resolving path in local ribs) resolved `{}` to \
local: {:?}",
self.session.str_of(ident),
def);
@ -4885,13 +4885,13 @@ impl Resolver {
None => {
// This can happen if we were looking for a type and
// found a module instead. Modules don't have defs.
debug2!("(resolving item path by identifier in lexical \
debug!("(resolving item path by identifier in lexical \
scope) failed to resolve {} after success...",
self.session.str_of(ident));
return None;
}
Some(def) => {
debug2!("(resolving item path in lexical scope) \
debug!("(resolving item path in lexical scope) \
resolved `{}` to item",
self.session.str_of(ident));
// This lookup is "all public" because it only searched
@ -4902,10 +4902,10 @@ impl Resolver {
}
}
Indeterminate => {
fail2!("unexpected indeterminate result");
fail!("unexpected indeterminate result");
}
Failed => {
debug2!("(resolving item path by identifier in lexical scope) \
debug!("(resolving item path by identifier in lexical scope) \
failed to resolve {}", self.session.str_of(ident));
return None;
}
@ -4983,7 +4983,7 @@ impl Resolver {
match self.resolve_path(expr.id, path, ValueNS, true) {
Some(def) => {
// Write the result into the def map.
debug2!("(resolving expr) resolved `{}`",
debug!("(resolving expr) resolved `{}`",
self.path_idents_to_str(path));
// First-class methods are not supported yet; error
@ -5069,7 +5069,7 @@ impl Resolver {
self.record_def(expr.id, definition);
}
result => {
debug2!("(resolving expression) didn't find struct \
debug!("(resolving expression) didn't find struct \
def: {:?}", result);
let msg = format!("`{}` does not name a structure",
self.path_idents_to_str(path));
@ -5091,7 +5091,7 @@ impl Resolver {
}
}
ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ExprBreak(Some(label)) | ExprAgain(Some(label)) => {
match self.search_ribs(self.label_ribs, label, expr.span,
@ -5142,7 +5142,7 @@ impl Resolver {
self.trait_map.insert(expr.id, @mut traits);
}
ExprMethodCall(_, _, ident, _, _, _) => {
debug2!("(recording candidate traits for expr) recording \
debug!("(recording candidate traits for expr) recording \
traits for {}",
expr.id);
let traits = self.search_for_traits_containing_method(ident);
@ -5217,7 +5217,7 @@ impl Resolver {
fn search_for_traits_containing_method(&mut self, name: Ident)
-> ~[DefId] {
debug2!("(searching for traits containing method) looking for '{}'",
debug!("(searching for traits containing method) looking for '{}'",
self.session.str_of(name));
let mut found_traits = ~[];
@ -5319,7 +5319,7 @@ impl Resolver {
found_traits: &mut ~[DefId],
trait_def_id: DefId,
name: Ident) {
debug2!("(adding trait info) found trait {}:{} for method '{}'",
debug!("(adding trait info) found trait {}:{} for method '{}'",
trait_def_id.crate,
trait_def_id.node,
self.session.str_of(name));
@ -5338,7 +5338,7 @@ impl Resolver {
}
fn record_def(&mut self, node_id: NodeId, (def, lp): (Def, LastPrivate)) {
debug2!("(recording def) recording {:?} for {:?}, last private {:?}",
debug!("(recording def) recording {:?} for {:?}, last private {:?}",
def, node_id, lp);
self.last_private.insert(node_id, lp);
do self.def_map.insert_or_update_with(node_id, def) |_, old_value| {
@ -5449,15 +5449,15 @@ impl Resolver {
}
fn dump_module(&mut self, module_: @mut Module) {
debug2!("Dump of module `{}`:", self.module_to_str(module_));
debug!("Dump of module `{}`:", self.module_to_str(module_));
debug2!("Children:");
debug!("Children:");
self.populate_module_if_necessary(module_);
for (&name, _) in module_.children.iter() {
debug2!("* {}", interner_get(name));
debug!("* {}", interner_get(name));
}
debug2!("Import resolutions:");
debug!("Import resolutions:");
for (name, import_resolution) in module_.import_resolutions.iter() {
let value_repr;
match import_resolution.target_for_namespace(ValueNS) {
@ -5477,7 +5477,7 @@ impl Resolver {
}
}
debug2!("* {}:{}{}", interner_get(*name),
debug!("* {}:{}{}", interner_get(*name),
value_repr, type_repr);
}
}

View file

@ -123,20 +123,20 @@ fn stack_check_fn<'a>(v: &mut StackCheckVisitor,
}
};
let new_cx = Context {safe_stack: safe_stack};
debug2!("stack_check_fn(safe_stack={}, id={:?})", safe_stack, id);
debug!("stack_check_fn(safe_stack={}, id={:?})", safe_stack, id);
visit::walk_fn(v, fk, decl, body, sp, id, new_cx);
}
fn stack_check_expr<'a>(v: &mut StackCheckVisitor,
expr: @ast::Expr,
cx: Context) {
debug2!("stack_check_expr(safe_stack={}, expr={})",
debug!("stack_check_expr(safe_stack={}, expr={})",
cx.safe_stack, expr.repr(v.tcx));
if !cx.safe_stack {
match expr.node {
ast::ExprCall(callee, _, _) => {
let callee_ty = ty::expr_ty(v.tcx, callee);
debug2!("callee_ty={}", callee_ty.repr(v.tcx));
debug!("callee_ty={}", callee_ty.repr(v.tcx));
match ty::get(callee_ty).sty {
ty::ty_bare_fn(ref fty) => {
if !fty.abis.is_rust() && !fty.abis.is_intrinsic() {

View file

@ -264,7 +264,7 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool {
a_expr = e.unwrap();
}
UnitLikeStructLit(_) => {
fail2!("UnitLikeStructLit should have been handled \
fail!("UnitLikeStructLit should have been handled \
above")
}
}
@ -277,14 +277,14 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool {
b_expr = e.unwrap();
}
UnitLikeStructLit(_) => {
fail2!("UnitLikeStructLit should have been handled \
fail!("UnitLikeStructLit should have been handled \
above")
}
}
match const_eval::compare_lit_exprs(tcx, a_expr, b_expr) {
Some(val1) => val1 == 0,
None => fail2!("compare_list_exprs: type mismatch"),
None => fail!("compare_list_exprs: type mismatch"),
}
}
}
@ -294,7 +294,7 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool {
let m2 = const_eval::compare_lit_exprs(tcx, a2, b2);
match (m1, m2) {
(Some(val1), Some(val2)) => (val1 == 0 && val2 == 0),
_ => fail2!("compare_list_exprs: type mismatch"),
_ => fail!("compare_list_exprs: type mismatch"),
}
}
(&var(a, _), &var(b, _)) => a == b,
@ -439,7 +439,7 @@ fn expand_nested_bindings<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug2!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
debug!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -486,7 +486,7 @@ fn enter_match<'r>(bcx: @mut Block,
val: ValueRef,
e: enter_pat)
-> ~[Match<'r>] {
debug2!("enter_match(bcx={}, m={}, col={}, val={})",
debug!("enter_match(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -523,7 +523,7 @@ fn enter_match<'r>(bcx: @mut Block,
}
}
debug2!("result={}", result.repr(bcx.tcx()));
debug!("result={}", result.repr(bcx.tcx()));
return result;
}
@ -535,7 +535,7 @@ fn enter_default<'r>(bcx: @mut Block,
val: ValueRef,
chk: FailureHandler)
-> ~[Match<'r>] {
debug2!("enter_default(bcx={}, m={}, col={}, val={})",
debug!("enter_default(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -605,7 +605,7 @@ fn enter_opt<'r>(bcx: @mut Block,
variant_size: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug2!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
*opt,
@ -741,7 +741,7 @@ fn enter_rec_or_struct<'r>(bcx: @mut Block,
fields: &[ast::Ident],
val: ValueRef)
-> ~[Match<'r>] {
debug2!("enter_rec_or_struct(bcx={}, m={}, col={}, val={})",
debug!("enter_rec_or_struct(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -776,7 +776,7 @@ fn enter_tup<'r>(bcx: @mut Block,
val: ValueRef,
n_elts: uint)
-> ~[Match<'r>] {
debug2!("enter_tup(bcx={}, m={}, col={}, val={})",
debug!("enter_tup(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -802,7 +802,7 @@ fn enter_tuple_struct<'r>(bcx: @mut Block,
val: ValueRef,
n_elts: uint)
-> ~[Match<'r>] {
debug2!("enter_tuple_struct(bcx={}, m={}, col={}, val={})",
debug!("enter_tuple_struct(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -827,7 +827,7 @@ fn enter_box<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug2!("enter_box(bcx={}, m={}, col={}, val={})",
debug!("enter_box(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -854,7 +854,7 @@ fn enter_uniq<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug2!("enter_uniq(bcx={}, m={}, col={}, val={})",
debug!("enter_uniq(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -881,7 +881,7 @@ fn enter_region<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug2!("enter_region(bcx={}, m={}, col={}, val={})",
debug!("enter_region(bcx={}, m={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
col,
@ -1225,7 +1225,7 @@ impl FailureHandler {
fn handle_fail(&self) -> BasicBlockRef {
match *self {
Infallible => {
fail2!("attempted to fail in infallible failure handler!")
fail!("attempted to fail in infallible failure handler!")
}
JumpToBasicBlock(basic_block) => basic_block,
CustomFailureHandlerClass(custom_failure_handler) => {
@ -1376,7 +1376,7 @@ fn insert_lllocals(bcx: @mut Block,
}
};
debug2!("binding {:?} to {}", binding_info.id, bcx.val_to_str(llval));
debug!("binding {:?} to {}", binding_info.id, bcx.val_to_str(llval));
llmap.insert(binding_info.id, llval);
if bcx.sess().opts.extra_debuginfo {
@ -1397,7 +1397,7 @@ fn compile_guard(bcx: @mut Block,
vals: &[ValueRef],
chk: FailureHandler)
-> @mut Block {
debug2!("compile_guard(bcx={}, guard_expr={}, m={}, vals={})",
debug!("compile_guard(bcx={}, guard_expr={}, m={}, vals={})",
bcx.to_str(),
bcx.expr_to_str(guard_expr),
m.repr(bcx.tcx()),
@ -1451,7 +1451,7 @@ fn compile_submatch(bcx: @mut Block,
m: &[Match],
vals: &[ValueRef],
chk: FailureHandler) {
debug2!("compile_submatch(bcx={}, m={}, vals={})",
debug!("compile_submatch(bcx={}, m={}, vals={})",
bcx.to_str(),
m.repr(bcx.tcx()),
vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
@ -1617,7 +1617,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
// Decide what kind of branch we need
let opts = get_options(bcx, m, col);
debug2!("options={:?}", opts);
debug!("options={:?}", opts);
let mut kind = no_branch;
let mut test_val = val;
if opts.len() > 0u {
@ -2104,7 +2104,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
* - binding_mode: is this for an argument or a local variable?
*/
debug2!("bind_irrefutable_pat(bcx={}, pat={}, binding_mode={:?})",
debug!("bind_irrefutable_pat(bcx={}, pat={}, binding_mode={:?})",
bcx.to_str(),
pat.repr(bcx.tcx()),
binding_mode);

View file

@ -113,13 +113,13 @@ pub fn represent_node(bcx: @mut Block, node: ast::NodeId) -> @Repr {
/// Decides how to represent a given type.
pub fn represent_type(cx: &mut CrateContext, t: ty::t) -> @Repr {
debug2!("Representing: {}", ty_to_str(cx.tcx, t));
debug!("Representing: {}", ty_to_str(cx.tcx, t));
match cx.adt_reprs.find(&t) {
Some(repr) => return *repr,
None => { }
}
let repr = @represent_type_uncached(cx, t);
debug2!("Represented as: {:?}", repr)
debug!("Represented as: {:?}", repr)
cx.adt_reprs.insert(t, repr);
return repr;
}

View file

@ -85,7 +85,7 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
constraints.push_str(clobbers);
}
debug2!("Asm Constraints: {:?}", constraints);
debug!("Asm Constraints: {:?}", constraints);
let numOutputs = outputs.len();

View file

@ -122,7 +122,7 @@ impl Drop for _InsnCtxt {
}
pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
debug2!("new InsnCtxt: {}", s);
debug!("new InsnCtxt: {}", s);
do local_data::modify(task_local_insn_key) |c| {
do c.map |mut ctx| {
ctx.push(s);
@ -379,7 +379,7 @@ pub fn malloc_raw_dyn(bcx: @mut Block,
(ty::mk_imm_box,
require_alloc_fn(bcx, t, ClosureExchangeMallocFnLangItem))
}
_ => fail2!("heap_exchange already handled")
_ => fail!("heap_exchange already handled")
};
// Grab the TypeRef type of box_ptr_ty.
@ -911,18 +911,18 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
}
match bcx.node_info {
None => debug2!("invoke at ???"),
None => debug!("invoke at ???"),
Some(node_info) => {
debug2!("invoke at {}",
debug!("invoke at {}",
bcx.sess().codemap.span_to_str(node_info.span));
}
}
if need_invoke(bcx) {
unsafe {
debug2!("invoking {} at {}", llfn, bcx.llbb);
debug!("invoking {} at {}", llfn, bcx.llbb);
for &llarg in llargs.iter() {
debug2!("arg: {}", llarg);
debug!("arg: {}", llarg);
}
}
let normal_bcx = sub_block(bcx, "normal return");
@ -935,9 +935,9 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
return (llresult, normal_bcx);
} else {
unsafe {
debug2!("calling {} at {}", llfn, bcx.llbb);
debug!("calling {} at {}", llfn, bcx.llbb);
for &llarg in llargs.iter() {
debug2!("arg: {}", llarg);
debug!("arg: {}", llarg);
}
}
let llresult = Call(bcx, llfn, llargs, attributes);
@ -1157,7 +1157,7 @@ pub fn ignore_lhs(_bcx: @mut Block, local: &ast::Local) -> bool {
pub fn init_local(bcx: @mut Block, local: &ast::Local) -> @mut Block {
debug2!("init_local(bcx={}, local.id={:?})",
debug!("init_local(bcx={}, local.id={:?})",
bcx.to_str(), local.id);
let _indenter = indenter();
@ -1178,7 +1178,7 @@ pub fn init_local(bcx: @mut Block, local: &ast::Local) -> @mut Block {
pub fn trans_stmt(cx: @mut Block, s: &ast::Stmt) -> @mut Block {
let _icx = push_ctxt("trans_stmt");
debug2!("trans_stmt({})", stmt_to_str(s, cx.tcx().sess.intr()));
debug!("trans_stmt({})", stmt_to_str(s, cx.tcx().sess.intr()));
if cx.sess().asm_comments() {
add_span_comment(cx, s.span, stmt_to_str(s, cx.ccx().sess.intr()));
@ -1341,7 +1341,7 @@ pub fn cleanup_and_leave(bcx: @mut Block,
let mut bcx = bcx;
let is_lpad = leave == None;
loop {
debug2!("cleanup_and_leave: leaving {}", cur.to_str());
debug!("cleanup_and_leave: leaving {}", cur.to_str());
if bcx.sess().trace() {
trans_trace(
@ -1415,7 +1415,7 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option<BasicBlockRef>) -> @mut Block
let mut cur = bcx;
let mut bcx = bcx;
loop {
debug2!("cleanup_block: {}", cur.to_str());
debug!("cleanup_block: {}", cur.to_str());
if bcx.sess().trace() {
trans_trace(
@ -1465,7 +1465,7 @@ pub fn with_scope(bcx: @mut Block,
f: &fn(@mut Block) -> @mut Block) -> @mut Block {
let _icx = push_ctxt("with_scope");
debug2!("with_scope(bcx={}, opt_node_info={:?}, name={})",
debug!("with_scope(bcx={}, opt_node_info={:?}, name={})",
bcx.to_str(), opt_node_info, name);
let _indenter = indenter();
@ -1684,7 +1684,7 @@ pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext,
-> @mut FunctionContext {
for p in param_substs.iter() { p.validate(); }
debug2!("new_fn_ctxt_w_id(path={}, id={:?}, \
debug!("new_fn_ctxt_w_id(path={}, id={:?}, \
param_substs={})",
path_str(ccx.sess, path),
id,
@ -1798,7 +1798,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
args: &[ast::arg],
raw_llargs: &[ValueRef],
arg_tys: &[ty::t]) -> @mut Block {
debug2!("copy_args_to_allocas: raw_llargs={} arg_tys={}",
debug!("copy_args_to_allocas: raw_llargs={} arg_tys={}",
raw_llargs.llrepr(fcx.ccx),
arg_tys.repr(fcx.ccx.tcx));
@ -1922,7 +1922,7 @@ pub fn trans_closure(ccx: @mut CrateContext,
let _icx = push_ctxt("trans_closure");
set_uwtable(llfndecl);
debug2!("trans_closure(..., param_substs={})",
debug!("trans_closure(..., param_substs={})",
param_substs.repr(ccx.tcx));
let fcx = new_fn_ctxt_w_id(ccx,
@ -2002,7 +2002,7 @@ pub fn trans_fn(ccx: @mut CrateContext,
let the_path_str = path_str(ccx.sess, path);
let _s = StatRecorder::new(ccx, the_path_str);
debug2!("trans_fn(self_arg={:?}, param_substs={})",
debug!("trans_fn(self_arg={:?}, param_substs={})",
self_arg,
param_substs.repr(ccx.tcx));
let _icx = push_ctxt("trans_fn");
@ -2038,7 +2038,7 @@ fn insert_synthetic_type_entries(bcx: @mut Block,
let tcx = bcx.tcx();
for i in range(0u, fn_args.len()) {
debug2!("setting type of argument {} (pat node {}) to {}",
debug!("setting type of argument {} (pat node {}) to {}",
i, fn_args[i].pat.id, bcx.ty_to_str(arg_tys[i]));
let pat_id = fn_args[i].pat.id;
@ -2214,7 +2214,7 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
let path = match ccx.tcx.items.get_copy(&item.id) {
ast_map::node_item(_, p) => p,
// tjc: ?
_ => fail2!("trans_item"),
_ => fail!("trans_item"),
};
match item.node {
ast::item_fn(ref decl, purity, _abis, ref generics, ref body) => {
@ -2357,7 +2357,7 @@ pub fn register_fn(ccx: @mut CrateContext,
assert!(f.abis.is_rust() || f.abis.is_intrinsic());
f
}
_ => fail2!("expected bare rust fn or an intrinsic")
_ => fail!("expected bare rust fn or an intrinsic")
};
let llfn = decl_rust_fn(ccx, f.sig.inputs, f.sig.output, sym);
@ -2373,7 +2373,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext,
cc: lib::llvm::CallConv,
fn_ty: Type)
-> ValueRef {
debug2!("register_fn_fuller creating fn for item {} with path {}",
debug!("register_fn_fuller creating fn for item {} with path {}",
node_id,
ast_map::path_to_str(item_path(ccx, &node_id), token::get_ident_interner()));
@ -2452,7 +2452,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
};
(start_fn, args)
} else {
debug2!("using user-defined start fn");
debug!("using user-defined start fn");
let args = ~[
C_null(Type::opaque_box(ccx).ptr_to()),
llvm::LLVMGetParam(llfn, 0 as c_uint),
@ -2500,7 +2500,7 @@ fn exported_name(ccx: &mut CrateContext, path: path, ty: ty::t, attrs: &[ast::At
}
pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
debug2!("get_item_val(id=`{:?}`)", id);
debug!("get_item_val(id=`{:?}`)", id);
let val = ccx.item_vals.find_copy(&id);
match val {
@ -2522,10 +2522,10 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
// we need to get the symbol from csearch instead of
// using the current crate's name/version
// information in the hash of the symbol
debug2!("making {}", sym);
debug!("making {}", sym);
let sym = match ccx.external_srcs.find(&i.id) {
Some(&did) => {
debug2!("but found in other crate...");
debug!("but found in other crate...");
csearch::get_symbol(ccx.sess.cstore, did)
}
None => sym
@ -2575,7 +2575,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
}
if !inlineable {
debug2!("{} not inlined", sym);
debug!("{} not inlined", sym);
ccx.non_inlineable_statics.insert(id);
}
ccx.item_symbols.insert(i.id, sym);
@ -2596,7 +2596,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
llfn
}
_ => fail2!("get_item_val: weird result in table")
_ => fail!("get_item_val: weird result in table")
};
match (attr::first_attr_value_str_by_name(i.attrs, "link_section")) {
@ -2612,7 +2612,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
}
ast_map::node_trait_method(trait_method, _, pth) => {
debug2!("get_item_val(): processing a node_trait_method");
debug!("get_item_val(): processing a node_trait_method");
match *trait_method {
ast::required(_) => {
ccx.sess.bug("unexpected variant: required trait method in \
@ -2669,11 +2669,11 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
ast::item_enum(_, _) => {
register_fn(ccx, (*v).span, sym, id, ty)
}
_ => fail2!("node_variant, shouldn't happen")
_ => fail!("node_variant, shouldn't happen")
};
}
ast::struct_variant_kind(_) => {
fail2!("struct variant kind unexpected in get_item_val")
fail!("struct variant kind unexpected in get_item_val")
}
}
set_inline_hint(llfn);

View file

@ -29,7 +29,7 @@ pub fn terminate(cx: &mut Block, _: &str) {
pub fn check_not_terminated(cx: &Block) {
if cx.terminated {
fail2!("already terminated!");
fail!("already terminated!");
}
}
@ -117,7 +117,7 @@ pub fn Invoke(cx: @mut Block,
}
check_not_terminated(cx);
terminate(cx, "Invoke");
debug2!("Invoke({} with arguments ({}))",
debug!("Invoke({} with arguments ({}))",
cx.val_to_str(Fn),
Args.map(|a| cx.val_to_str(*a)).connect(", "));
B(cx).invoke(Fn, Args, Then, Catch, attributes)

View file

@ -476,7 +476,7 @@ impl Builder {
}
pub fn store(&self, val: ValueRef, ptr: ValueRef) {
debug2!("Store {} -> {}",
debug!("Store {} -> {}",
self.ccx.tn.val_to_str(val),
self.ccx.tn.val_to_str(ptr));
assert!(is_not_null(self.llbuilder));
@ -487,7 +487,7 @@ impl Builder {
}
pub fn atomic_store(&self, val: ValueRef, ptr: ValueRef, order: AtomicOrdering) {
debug2!("Store {} -> {}",
debug!("Store {} -> {}",
self.ccx.tn.val_to_str(val),
self.ccx.tn.val_to_str(ptr));
self.count_insn("store.atomic");
@ -726,7 +726,7 @@ impl Builder {
pub fn add_span_comment(&self, sp: Span, text: &str) {
if self.ccx.sess.asm_comments() {
let s = format!("{} ({})", text, self.ccx.sess.codemap.span_to_str(sp));
debug2!("{}", s);
debug!("{}", s);
self.add_comment(s);
}
}
@ -758,11 +758,11 @@ impl Builder {
else { lib::llvm::False };
let argtys = do inputs.map |v| {
debug2!("Asm Input Type: {:?}", self.ccx.tn.val_to_str(*v));
debug!("Asm Input Type: {:?}", self.ccx.tn.val_to_str(*v));
val_ty(*v)
};
debug2!("Asm Output Type: {:?}", self.ccx.tn.type_to_str(output));
debug!("Asm Output Type: {:?}", self.ccx.tn.type_to_str(output));
let fty = Type::func(argtys, &output);
unsafe {
let v = llvm::LLVMInlineAsm(

View file

@ -51,7 +51,7 @@ fn ty_align(ty: Type) -> uint {
let elt = ty.element_type();
ty_align(elt)
}
_ => fail2!("ty_align: unhandled type")
_ => fail!("ty_align: unhandled type")
}
}
@ -81,7 +81,7 @@ fn ty_size(ty: Type) -> uint {
let eltsz = ty_size(elt);
len * eltsz
}
_ => fail2!("ty_size: unhandled type")
_ => fail!("ty_size: unhandled type")
}
}

View file

@ -51,7 +51,7 @@ fn ty_align(ty: Type) -> uint {
let elt = ty.element_type();
ty_align(elt)
}
_ => fail2!("ty_size: unhandled type")
_ => fail!("ty_size: unhandled type")
}
}
@ -81,7 +81,7 @@ fn ty_size(ty: Type) -> uint {
let eltsz = ty_size(elt);
len * eltsz
}
_ => fail2!("ty_size: unhandled type")
_ => fail!("ty_size: unhandled type")
}
}

View file

@ -112,7 +112,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
let elt = ty.element_type();
ty_align(elt)
}
_ => fail2!("ty_size: unhandled type")
_ => fail!("ty_size: unhandled type")
}
}
@ -141,7 +141,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
let eltsz = ty_size(elt);
len * eltsz
}
_ => fail2!("ty_size: unhandled type")
_ => fail!("ty_size: unhandled type")
}
}
@ -232,7 +232,7 @@ fn classify_ty(ty: Type) -> ~[RegClass] {
i += 1u;
}
}
_ => fail2!("classify: unhandled type")
_ => fail!("classify: unhandled type")
}
}
@ -325,7 +325,7 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
SSEDs => {
tys.push(Type::f64());
}
_ => fail2!("llregtype: unhandled class")
_ => fail!("llregtype: unhandled class")
}
i += 1u;
}

View file

@ -79,7 +79,7 @@ pub struct Callee {
pub fn trans(bcx: @mut Block, expr: &ast::Expr) -> Callee {
let _icx = push_ctxt("trans_callee");
debug2!("callee::trans(expr={})", expr.repr(bcx.tcx()));
debug!("callee::trans(expr={})", expr.repr(bcx.tcx()));
// pick out special kinds of expressions that can be called:
match expr.node {
@ -180,7 +180,7 @@ pub fn trans_fn_ref(bcx: @mut Block,
let type_params = node_id_type_params(bcx, ref_id);
let vtables = node_vtables(bcx, ref_id);
debug2!("trans_fn_ref(def_id={}, ref_id={:?}, type_params={}, vtables={})",
debug!("trans_fn_ref(def_id={}, ref_id={:?}, type_params={}, vtables={})",
def_id.repr(bcx.tcx()), ref_id, type_params.repr(bcx.tcx()),
vtables.repr(bcx.tcx()));
trans_fn_ref_with_vtables(bcx, def_id, ref_id, type_params, vtables)
@ -266,7 +266,7 @@ pub fn trans_fn_ref_with_vtables(
let ccx = bcx.ccx();
let tcx = ccx.tcx;
debug2!("trans_fn_ref_with_vtables(bcx={}, def_id={}, ref_id={:?}, \
debug!("trans_fn_ref_with_vtables(bcx={}, def_id={}, ref_id={:?}, \
type_params={}, vtables={})",
bcx.to_str(),
def_id.repr(bcx.tcx()),
@ -329,7 +329,7 @@ pub fn trans_fn_ref_with_vtables(
resolve_default_method_vtables(bcx, impl_id,
method, &substs, vtables);
debug2!("trans_fn_with_vtables - default method: \
debug!("trans_fn_with_vtables - default method: \
substs = {}, trait_subst = {}, \
first_subst = {}, new_subst = {}, \
vtables = {}, \
@ -472,7 +472,7 @@ pub fn trans_method_call(in_cx: @mut Block,
dest: expr::Dest)
-> @mut Block {
let _icx = push_ctxt("trans_method_call");
debug2!("trans_method_call(call_ex={}, rcvr={})",
debug!("trans_method_call(call_ex={}, rcvr={})",
call_ex.repr(in_cx.tcx()),
rcvr.repr(in_cx.tcx()));
trans_call_inner(
@ -483,7 +483,7 @@ pub fn trans_method_call(in_cx: @mut Block,
|cx| {
match cx.ccx().maps.method_map.find_copy(&call_ex.id) {
Some(origin) => {
debug2!("origin for {}: {}",
debug!("origin for {}: {}",
call_ex.repr(in_cx.tcx()),
origin.repr(in_cx.tcx()));
@ -562,7 +562,7 @@ pub fn trans_lang_call_with_type_params(bcx: @mut Block,
substituted);
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
}
_ => fail2!()
_ => fail!()
}
Callee { bcx: callee.bcx, data: Fn(FnData { llfn: new_llval }) }
},
@ -840,7 +840,7 @@ pub fn trans_arg_expr(bcx: @mut Block,
let _icx = push_ctxt("trans_arg_expr");
let ccx = bcx.ccx();
debug2!("trans_arg_expr(formal_arg_ty=({}), self_mode={:?}, arg_expr={})",
debug!("trans_arg_expr(formal_arg_ty=({}), self_mode={:?}, arg_expr={})",
formal_arg_ty.repr(bcx.tcx()),
self_mode,
arg_expr.repr(bcx.tcx()));
@ -850,7 +850,7 @@ pub fn trans_arg_expr(bcx: @mut Block,
let arg_datum = arg_datumblock.datum;
let bcx = arg_datumblock.bcx;
debug2!(" arg datum: {}", arg_datum.to_str(bcx.ccx()));
debug!(" arg datum: {}", arg_datum.to_str(bcx.ccx()));
let mut val;
if ty::type_is_bot(arg_datum.ty) {
@ -890,11 +890,11 @@ pub fn trans_arg_expr(bcx: @mut Block,
val = match self_mode {
ty::ByRef => {
debug2!("by ref arg with type {}", bcx.ty_to_str(arg_datum.ty));
debug!("by ref arg with type {}", bcx.ty_to_str(arg_datum.ty));
arg_datum.to_ref_llval(bcx)
}
ty::ByCopy => {
debug2!("by copy arg with type {}", bcx.ty_to_str(arg_datum.ty));
debug!("by copy arg with type {}", bcx.ty_to_str(arg_datum.ty));
arg_datum.to_appropriate_llval(bcx)
}
}
@ -904,12 +904,12 @@ pub fn trans_arg_expr(bcx: @mut Block,
if formal_arg_ty != arg_datum.ty {
// this could happen due to e.g. subtyping
let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, formal_arg_ty);
debug2!("casting actual type ({}) to match formal ({})",
debug!("casting actual type ({}) to match formal ({})",
bcx.val_to_str(val), bcx.llty_str(llformal_arg_ty));
val = PointerCast(bcx, val, llformal_arg_ty);
}
}
debug2!("--- trans_arg_expr passing {}", bcx.val_to_str(val));
debug!("--- trans_arg_expr passing {}", bcx.val_to_str(val));
return rslt(bcx, val);
}

View file

@ -151,7 +151,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
}
});
let cdata_ty = ty::mk_tup(tcx, bound_tys);
debug2!("cdata_ty={}", ty_to_str(tcx, cdata_ty));
debug!("cdata_ty={}", ty_to_str(tcx, cdata_ty));
return cdata_ty;
}
@ -224,12 +224,12 @@ pub fn store_environment(bcx: @mut Block,
let Result {bcx: bcx, val: llbox} = allocate_cbox(bcx, sigil, cdata_ty);
let llbox = PointerCast(bcx, llbox, llboxptr_ty);
debug2!("tuplify_box_ty = {}", ty_to_str(tcx, cbox_ty));
debug!("tuplify_box_ty = {}", ty_to_str(tcx, cbox_ty));
// Copy expr values into boxed bindings.
let mut bcx = bcx;
for (i, bv) in bound_values.iter().enumerate() {
debug2!("Copy {} into closure", bv.to_str(ccx));
debug!("Copy {} into closure", bv.to_str(ccx));
if ccx.sess.asm_comments() {
add_comment(bcx, format!("Copy {} into closure",
@ -268,7 +268,7 @@ pub fn build_closure(bcx0: @mut Block,
// Package up the captured upvars
let mut env_vals = ~[];
for cap_var in cap_vars.iter() {
debug2!("Building closure: captured variable {:?}", *cap_var);
debug!("Building closure: captured variable {:?}", *cap_var);
let datum = expr::trans_local_var(bcx, cap_var.def);
match cap_var.mode {
moves::CapRef => {
@ -384,7 +384,7 @@ pub fn trans_expr_fn(bcx: @mut Block,
let fty = node_id_type(bcx, outer_id);
let f = match ty::get(fty).sty {
ty::ty_closure(ref f) => f,
_ => fail2!("expected closure")
_ => fail!("expected closure")
};
let sub_path = vec::append_one(bcx.fcx.path.clone(),

View file

@ -449,7 +449,7 @@ pub fn add_clean(bcx: @mut Block, val: ValueRef, t: ty::t) {
return
}
debug2!("add_clean({}, {}, {})", bcx.to_str(), bcx.val_to_str(val), t.repr(bcx.tcx()));
debug!("add_clean({}, {}, {})", bcx.to_str(), bcx.val_to_str(val), t.repr(bcx.tcx()));
let cleanup_type = cleanup_type(bcx.tcx(), t);
do in_scope_cx(bcx, None) |scope_info| {
@ -464,7 +464,7 @@ pub fn add_clean(bcx: @mut Block, val: ValueRef, t: ty::t) {
pub fn add_clean_temp_immediate(cx: @mut Block, val: ValueRef, ty: ty::t) {
if !ty::type_needs_drop(cx.tcx(), ty) { return; }
debug2!("add_clean_temp_immediate({}, {}, {})",
debug!("add_clean_temp_immediate({}, {}, {})",
cx.to_str(), cx.val_to_str(val),
ty.repr(cx.tcx()));
let cleanup_type = cleanup_type(cx.tcx(), ty);
@ -493,7 +493,7 @@ pub fn add_clean_temp_mem_in_scope(bcx: @mut Block,
pub fn add_clean_temp_mem_in_scope_(bcx: @mut Block, scope_id: Option<ast::NodeId>,
val: ValueRef, t: ty::t) {
if !ty::type_needs_drop(bcx.tcx(), t) { return; }
debug2!("add_clean_temp_mem({}, {}, {})",
debug!("add_clean_temp_mem({}, {}, {})",
bcx.to_str(), bcx.val_to_str(val),
t.repr(bcx.tcx()));
let cleanup_type = cleanup_type(bcx.tcx(), t);
@ -522,7 +522,7 @@ pub fn add_clean_return_to_mut(bcx: @mut Block,
//! box was frozen initially. Here, both `frozen_val_ref` and
//! `bits_val_ref` are in fact pointers to stack slots.
debug2!("add_clean_return_to_mut({}, {}, {})",
debug!("add_clean_return_to_mut({}, {}, {})",
bcx.to_str(),
bcx.val_to_str(frozen_val_ref),
bcx.val_to_str(bits_val_ref));
@ -776,7 +776,7 @@ pub fn in_scope_cx(cx: @mut Block, scope_id: Option<ast::NodeId>, f: &fn(si: &mu
Some(inf) => match scope_id {
Some(wanted) => match inf.node_info {
Some(NodeInfo { id: actual, _ }) if wanted == actual => {
debug2!("in_scope_cx: selected cur={} (cx={})",
debug!("in_scope_cx: selected cur={} (cx={})",
cur.to_str(), cx.to_str());
f(inf);
return;
@ -784,7 +784,7 @@ pub fn in_scope_cx(cx: @mut Block, scope_id: Option<ast::NodeId>, f: &fn(si: &mu
_ => inf.parent,
},
None => {
debug2!("in_scope_cx: selected cur={} (cx={})",
debug!("in_scope_cx: selected cur={} (cx={})",
cur.to_str(), cx.to_str());
f(inf);
return;
@ -987,7 +987,7 @@ pub fn const_get_elt(cx: &CrateContext, v: ValueRef, us: &[c_uint])
llvm::LLVMConstExtractValue(v, p, len as c_uint)
};
debug2!("const_get_elt(v={}, us={:?}, r={})",
debug!("const_get_elt(v={}, us={:?}, r={})",
cx.tn.val_to_str(v), us, cx.tn.val_to_str(r));
return r;
@ -1230,7 +1230,7 @@ pub fn find_vtable(tcx: ty::ctxt,
n_param: typeck::param_index,
n_bound: uint)
-> typeck::vtable_origin {
debug2!("find_vtable(n_param={:?}, n_bound={}, ps={})",
debug!("find_vtable(n_param={:?}, n_bound={}, ps={})",
n_param, n_bound, ps.repr(tcx));
let param_bounds = match n_param {

View file

@ -245,7 +245,7 @@ impl CrateContext {
pub fn const_inbounds_gepi(&self,
pointer: ValueRef,
indices: &[uint]) -> ValueRef {
debug2!("const_inbounds_gepi: pointer={} indices={:?}",
debug!("const_inbounds_gepi: pointer={} indices={:?}",
self.tn.val_to_str(pointer), indices);
let v: ~[ValueRef] =
indices.iter().map(|i| C_i32(*i as i32)).collect();

View file

@ -50,7 +50,7 @@ pub fn trans_if(bcx: @mut Block,
els: Option<@ast::Expr>,
dest: expr::Dest)
-> @mut Block {
debug2!("trans_if(bcx={}, cond={}, thn={:?}, dest={})",
debug!("trans_if(bcx={}, cond={}, thn={:?}, dest={})",
bcx.to_str(), bcx.expr_to_str(cond), thn.id,
dest.to_str(bcx.ccx()));
let _indenter = indenter();
@ -119,7 +119,7 @@ pub fn trans_if(bcx: @mut Block,
}
};
debug2!("then_bcx_in={}, else_bcx_in={}",
debug!("then_bcx_in={}, else_bcx_in={}",
then_bcx_in.to_str(), else_bcx_in.to_str());
CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb);

View file

@ -242,7 +242,7 @@ impl Datum {
action: CopyAction,
datum: Datum)
-> @mut Block {
debug2!("store_to_datum(self={}, action={:?}, datum={})",
debug!("store_to_datum(self={}, action={:?}, datum={})",
self.to_str(bcx.ccx()), action, datum.to_str(bcx.ccx()));
assert!(datum.mode.is_by_ref());
self.store_to(bcx, action, datum.val)
@ -275,7 +275,7 @@ impl Datum {
return bcx;
}
debug2!("copy_to(self={}, action={:?}, dst={})",
debug!("copy_to(self={}, action={:?}, dst={})",
self.to_str(bcx.ccx()), action, bcx.val_to_str(dst));
// Watch out for the case where we are writing the copying the
@ -340,7 +340,7 @@ impl Datum {
let _icx = push_ctxt("move_to");
let mut bcx = bcx;
debug2!("move_to(self={}, action={:?}, dst={})",
debug!("move_to(self={}, action={:?}, dst={})",
self.to_str(bcx.ccx()), action, bcx.val_to_str(dst));
if ty::type_is_voidish(bcx.tcx(), self.ty) {
@ -607,7 +607,7 @@ impl Datum {
-> (Option<Datum>, @mut Block) {
let ccx = bcx.ccx();
debug2!("try_deref(expr_id={:?}, derefs={:?}, is_auto={}, self={:?})",
debug!("try_deref(expr_id={:?}, derefs={:?}, is_auto={}, self={:?})",
expr_id, derefs, is_auto, self.to_str(bcx.ccx()));
let bcx =
@ -732,7 +732,7 @@ impl Datum {
-> DatumBlock {
let _icx = push_ctxt("autoderef");
debug2!("autoderef(expr_id={}, max={:?}, self={:?})",
debug!("autoderef(expr_id={}, max={:?}, self={:?})",
expr_id, max, self.to_str(bcx.ccx()));
let _indenter = indenter();

View file

@ -146,7 +146,7 @@ pub struct CrateDebugContext {
impl CrateDebugContext {
pub fn new(llmod: ModuleRef, crate: ~str) -> CrateDebugContext {
debug2!("CrateDebugContext::new");
debug!("CrateDebugContext::new");
let builder = unsafe { llvm::LLVMDIBuilderCreate(llmod) };
// DIBuilder inherits context from the module, so we'd better use the same one
let llcontext = unsafe { llvm::LLVMGetModuleContext(llmod) };
@ -234,7 +234,7 @@ pub fn finalize(cx: @mut CrateContext) {
return;
}
debug2!("finalize");
debug!("finalize");
compile_unit_metadata(cx);
unsafe {
llvm::LLVMDIBuilderFinalize(DIB(cx));
@ -497,7 +497,7 @@ pub fn set_source_location(fcx: &FunctionContext,
let cx = fcx.ccx;
debug2!("set_source_location: {}", cx.sess.codemap.span_to_str(span));
debug!("set_source_location: {}", cx.sess.codemap.span_to_str(span));
if fcx.debug_context.get_ref(cx, span).source_locations_enabled {
let loc = span_start(cx, span);
@ -857,7 +857,7 @@ fn compile_unit_metadata(cx: @mut CrateContext) {
let dcx = debug_context(cx);
let crate_name: &str = dcx.crate_file;
debug2!("compile_unit_metadata: {:?}", crate_name);
debug!("compile_unit_metadata: {:?}", crate_name);
// FIXME (#9639): This needs to handle non-utf8 paths
let work_dir = cx.sess.working_dir.as_str().unwrap();
@ -968,7 +968,7 @@ fn file_metadata(cx: &mut CrateContext, full_path: &str) -> DIFile {
None => ()
}
debug2!("file_metadata: {}", full_path);
debug!("file_metadata: {}", full_path);
// FIXME (#9639): This needs to handle non-utf8 paths
let work_dir = cx.sess.working_dir.as_str().unwrap();
@ -1011,7 +1011,7 @@ fn scope_metadata(fcx: &FunctionContext,
fn basic_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType {
debug2!("basic_type_metadata: {:?}", ty::get(t));
debug!("basic_type_metadata: {:?}", ty::get(t));
let (name, encoding) = match ty::get(t).sty {
ty::ty_nil | ty::ty_bot => (~"uint", DW_ATE_unsigned),
@ -1849,7 +1849,7 @@ fn vec_slice_metadata(cx: &mut CrateContext,
span: Span)
-> DICompositeType {
debug2!("vec_slice_metadata: {:?}", ty::get(vec_type));
debug!("vec_slice_metadata: {:?}", ty::get(vec_type));
let slice_llvm_type = type_of::type_of(cx, vec_type);
let slice_type_name = ppaux::ty_to_str(cx.tcx, vec_type);
@ -1964,7 +1964,7 @@ fn trait_metadata(cx: &mut CrateContext,
}
fn unimplemented_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType {
debug2!("unimplemented_type_metadata: {:?}", ty::get(t));
debug!("unimplemented_type_metadata: {:?}", ty::get(t));
let name = ppaux::ty_to_str(cx.tcx, t);
let metadata = do format!("NYI<{}>", name).with_c_str |name| {
@ -2016,7 +2016,7 @@ fn type_metadata(cx: &mut CrateContext,
pointer_type_metadata(cx, pointer_type, box_metadata)
}
debug2!("type_metadata: {:?}", ty::get(t));
debug!("type_metadata: {:?}", ty::get(t));
let sty = &ty::get(t).sty;
let type_metadata = match *sty {
@ -2135,7 +2135,7 @@ fn set_debug_location(cx: &mut CrateContext, debug_location: DebugLocation) {
match debug_location {
KnownLocation { scope, line, col } => {
debug2!("setting debug location to {} {}", line, col);
debug!("setting debug location to {} {}", line, col);
let elements = [C_i32(line as i32), C_i32(col as i32), scope, ptr::null()];
unsafe {
metadata_node = llvm::LLVMMDNodeInContext(debug_context(cx).llcontext,
@ -2144,7 +2144,7 @@ fn set_debug_location(cx: &mut CrateContext, debug_location: DebugLocation) {
}
}
UnknownLocation => {
debug2!("clearing debug location ");
debug!("clearing debug location ");
metadata_node = ptr::null();
}
};

View file

@ -183,7 +183,7 @@ fn drop_and_cancel_clean(bcx: @mut Block, dat: Datum) -> @mut Block {
}
pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
debug2!("trans_to_datum(expr={})", bcx.expr_to_str(expr));
debug!("trans_to_datum(expr={})", bcx.expr_to_str(expr));
let mut bcx = bcx;
let mut datum = unpack_datum!(bcx, trans_to_datum_unadjusted(bcx, expr));
@ -191,7 +191,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
None => { return DatumBlock {bcx: bcx, datum: datum}; }
Some(adj) => { adj }
};
debug2!("unadjusted datum: {}", datum.to_str(bcx.ccx()));
debug!("unadjusted datum: {}", datum.to_str(bcx.ccx()));
match *adjustment {
AutoAddEnv(*) => {
datum = unpack_datum!(bcx, add_env(bcx, expr, datum));
@ -233,7 +233,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
};
}
}
debug2!("after adjustments, datum={}", datum.to_str(bcx.ccx()));
debug!("after adjustments, datum={}", datum.to_str(bcx.ccx()));
return DatumBlock {bcx: bcx, datum: datum};
fn auto_ref(bcx: @mut Block, datum: Datum) -> DatumBlock {
@ -289,7 +289,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
let tcx = bcx.tcx();
let closure_ty = expr_ty_adjusted(bcx, expr);
debug2!("add_env(closure_ty={})", closure_ty.repr(tcx));
debug!("add_env(closure_ty={})", closure_ty.repr(tcx));
let scratch = scratch_datum(bcx, closure_ty, "__adjust", false);
let llfn = GEPi(bcx, scratch.val, [0u, abi::fn_field_code]);
assert_eq!(datum.appropriate_mode(bcx.ccx()), ByValue);
@ -313,7 +313,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
source_datum: Datum) -> DatumBlock {
let tcx = bcx.tcx();
let target_obj_ty = expr_ty_adjusted(bcx, expr);
debug2!("auto_borrow_obj(target={})",
debug!("auto_borrow_obj(target={})",
target_obj_ty.repr(tcx));
// Extract source store information
@ -434,7 +434,7 @@ pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block {
let ty = expr_ty(bcx, expr);
debug2!("trans_into_unadjusted(expr={}, dest={})",
debug!("trans_into_unadjusted(expr={}, dest={})",
bcx.expr_to_str(expr),
dest.to_str(bcx.ccx()));
let _indenter = indenter();
@ -450,7 +450,7 @@ pub fn trans_into(bcx: @mut Block, expr: &ast::Expr, dest: Dest) -> @mut Block {
};
let kind = bcx.expr_kind(expr);
debug2!("expr kind = {:?}", kind);
debug!("expr kind = {:?}", kind);
return match kind {
ty::LvalueExpr => {
let datumblock = trans_lvalue_unadjusted(bcx, expr);
@ -508,7 +508,7 @@ fn trans_to_datum_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
let mut bcx = bcx;
debug2!("trans_to_datum_unadjusted(expr={})", bcx.expr_to_str(expr));
debug!("trans_to_datum_unadjusted(expr={})", bcx.expr_to_str(expr));
let _indenter = indenter();
debuginfo::set_source_location(bcx.fcx, expr.id, expr.span);
@ -720,7 +720,7 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: &ast::Expr,
ast::ExprFnBlock(ref decl, ref body) => {
let expr_ty = expr_ty(bcx, expr);
let sigil = ty::ty_closure_sigil(expr_ty);
debug2!("translating fn_block {} with type {}",
debug!("translating fn_block {} with type {}",
expr_to_str(expr, tcx.sess.intr()),
expr_ty.repr(tcx));
return closure::trans_expr_fn(bcx, sigil, decl, body,
@ -889,7 +889,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
let _icx = push_ctxt("trans_lval");
let mut bcx = bcx;
debug2!("trans_lvalue(expr={})", bcx.expr_to_str(expr));
debug!("trans_lvalue(expr={})", bcx.expr_to_str(expr));
let _indenter = indenter();
trace_span!(bcx, expr.span, shorten(bcx.expr_to_str(expr)));
@ -977,8 +977,8 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
let (bcx, base, len) =
base_datum.get_vec_base_and_len(bcx, index_expr.span, index_expr.id, 0);
debug2!("trans_index: base {}", bcx.val_to_str(base));
debug2!("trans_index: len {}", bcx.val_to_str(len));
debug!("trans_index: base {}", bcx.val_to_str(base));
debug!("trans_index: len {}", bcx.val_to_str(len));
let bounds_check = ICmp(bcx, lib::llvm::IntUGE, ix_val, len);
let bcx = do with_cond(bcx, bounds_check) |bcx| {
@ -1109,7 +1109,7 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum {
}
};
debug2!("def_self() reference, self_info.t={}",
debug!("def_self() reference, self_info.t={}",
self_info.t.repr(bcx.tcx()));
Datum {
@ -1135,7 +1135,7 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum {
}
};
let ty = node_id_type(bcx, nid);
debug2!("take_local(nid={:?}, v={}, ty={})",
debug!("take_local(nid={:?}, v={}, ty={})",
nid, bcx.val_to_str(v), bcx.ty_to_str(ty));
Datum {
val: v,
@ -1756,7 +1756,7 @@ fn trans_assign_op(bcx: @mut Block,
let _icx = push_ctxt("trans_assign_op");
let mut bcx = bcx;
debug2!("trans_assign_op(expr={})", bcx.expr_to_str(expr));
debug!("trans_assign_op(expr={})", bcx.expr_to_str(expr));
// Evaluate LHS (destination), which should be an lvalue
let dst_datum = unpack_datum!(bcx, trans_lvalue_unadjusted(bcx, dst));

View file

@ -110,7 +110,7 @@ pub fn register_foreign_item_fn(ccx: @mut CrateContext,
* Just adds a LLVM global.
*/
debug2!("register_foreign_item_fn(abis={}, \
debug!("register_foreign_item_fn(abis={}, \
path={}, \
foreign_item.id={:?})",
abis.repr(ccx.tcx),
@ -165,7 +165,7 @@ pub fn trans_native_call(bcx: @mut Block,
let ccx = bcx.ccx();
let tcx = bcx.tcx();
debug2!("trans_native_call(callee_ty={}, \
debug!("trans_native_call(callee_ty={}, \
llfn={}, \
llretptr={})",
callee_ty.repr(tcx),
@ -210,7 +210,7 @@ pub fn trans_native_call(bcx: @mut Block,
// Does Rust pass this argument by pointer?
let rust_indirect = type_of::arg_is_indirect(ccx, fn_sig.inputs[i]);
debug2!("argument {}, llarg_rust={}, rust_indirect={}, arg_ty={}",
debug!("argument {}, llarg_rust={}, rust_indirect={}, arg_ty={}",
i,
ccx.tn.val_to_str(llarg_rust),
rust_indirect,
@ -224,7 +224,7 @@ pub fn trans_native_call(bcx: @mut Block,
llarg_rust = scratch;
}
debug2!("llarg_rust={} (after indirection)",
debug!("llarg_rust={} (after indirection)",
ccx.tn.val_to_str(llarg_rust));
// Check whether we need to do any casting
@ -233,7 +233,7 @@ pub fn trans_native_call(bcx: @mut Block,
None => ()
}
debug2!("llarg_rust={} (after casting)",
debug!("llarg_rust={} (after casting)",
ccx.tn.val_to_str(llarg_rust));
// Finally, load the value if needed for the foreign ABI
@ -244,7 +244,7 @@ pub fn trans_native_call(bcx: @mut Block,
Load(bcx, llarg_rust)
};
debug2!("argument {}, llarg_foreign={}",
debug!("argument {}, llarg_foreign={}",
i, ccx.tn.val_to_str(llarg_foreign));
// fill padding with undef value
@ -289,10 +289,10 @@ pub fn trans_native_call(bcx: @mut Block,
None => fn_type.ret_ty.ty
};
debug2!("llretptr={}", ccx.tn.val_to_str(llretptr));
debug2!("llforeign_retval={}", ccx.tn.val_to_str(llforeign_retval));
debug2!("llrust_ret_ty={}", ccx.tn.type_to_str(llrust_ret_ty));
debug2!("llforeign_ret_ty={}", ccx.tn.type_to_str(llforeign_ret_ty));
debug!("llretptr={}", ccx.tn.val_to_str(llretptr));
debug!("llforeign_retval={}", ccx.tn.val_to_str(llforeign_retval));
debug!("llrust_ret_ty={}", ccx.tn.type_to_str(llrust_ret_ty));
debug!("llforeign_ret_ty={}", ccx.tn.type_to_str(llforeign_ret_ty));
if llrust_ret_ty == llforeign_ret_ty {
Store(bcx, llforeign_retval, llretptr);
@ -318,7 +318,7 @@ pub fn trans_native_call(bcx: @mut Block,
let llforeign_align = machine::llalign_of_min(ccx, llforeign_ret_ty);
let llrust_align = machine::llalign_of_min(ccx, llrust_ret_ty);
let llalign = uint::min(llforeign_align, llrust_align);
debug2!("llrust_size={:?}", llrust_size);
debug!("llrust_size={:?}", llrust_size);
base::call_memcpy(bcx, llretptr_i8, llscratch_i8,
C_uint(ccx, llrust_size), llalign as u32);
}
@ -377,7 +377,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
lib::llvm::CCallConv,
llfn_ty);
add_argument_attributes(&tys, llfn);
debug2!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
node_id, ccx.tn.type_to_str(llfn_ty), ccx.tn.val_to_str(llfn));
llfn
}
@ -430,7 +430,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
}
};
debug2!("build_rust_fn: path={} id={:?} t={}",
debug!("build_rust_fn: path={} id={:?} t={}",
path.repr(tcx),
id,
t.repr(tcx));
@ -457,7 +457,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
"foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn");
let tcx = ccx.tcx;
debug2!("build_wrap_fn(llrustfn={}, llwrapfn={})",
debug!("build_wrap_fn(llrustfn={}, llwrapfn={})",
ccx.tn.val_to_str(llrustfn),
ccx.tn.val_to_str(llwrapfn));
@ -512,14 +512,14 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
// alloca some scratch space on the stack.
match foreign_outptr {
Some(llforeign_outptr) => {
debug2!("out pointer, foreign={}",
debug!("out pointer, foreign={}",
ccx.tn.val_to_str(llforeign_outptr));
let llrust_retptr =
llvm::LLVMBuildBitCast(builder,
llforeign_outptr,
llrust_ret_ty.ptr_to().to_ref(),
noname());
debug2!("out pointer, foreign={} (casted)",
debug!("out pointer, foreign={} (casted)",
ccx.tn.val_to_str(llrust_retptr));
llrust_args.push(llrust_retptr);
return_alloca = None;
@ -532,7 +532,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
llrust_ret_ty.to_ref(),
s))
};
debug2!("out pointer, \
debug!("out pointer, \
allocad={}, \
llrust_ret_ty={}, \
return_ty={}",
@ -552,7 +552,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
// Push an (null) env pointer
let env_pointer = base::null_env_ptr(ccx);
debug2!("env pointer={}", ccx.tn.val_to_str(env_pointer));
debug!("env pointer={}", ccx.tn.val_to_str(env_pointer));
llrust_args.push(env_pointer);
// Build up the arguments to the call to the rust function.
@ -569,9 +569,9 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
let foreign_index = next_foreign_arg(llforeign_arg_ty.pad.is_some());
let mut llforeign_arg = llvm::LLVMGetParam(llwrapfn, foreign_index);
debug2!("llforeign_arg \\#{}: {}",
debug!("llforeign_arg \\#{}: {}",
i, ccx.tn.val_to_str(llforeign_arg));
debug2!("rust_indirect = {}, foreign_indirect = {}",
debug!("rust_indirect = {}, foreign_indirect = {}",
rust_indirect, foreign_indirect);
// Ensure that the foreign argument is indirect (by
@ -602,14 +602,14 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
llvm::LLVMBuildLoad(builder, llforeign_arg, noname())
};
debug2!("llrust_arg \\#{}: {}",
debug!("llrust_arg \\#{}: {}",
i, ccx.tn.val_to_str(llrust_arg));
llrust_args.push(llrust_arg);
}
// Perform the call itself
let llrust_ret_val = do llrust_args.as_imm_buf |ptr, len| {
debug2!("calling llrustfn = {}", ccx.tn.val_to_str(llrustfn));
debug!("calling llrustfn = {}", ccx.tn.val_to_str(llrustfn));
llvm::LLVMBuildCall(builder, llrustfn, ptr,
len as c_uint, noname())
};
@ -737,7 +737,7 @@ fn foreign_types_for_fn_ty(ccx: &mut CrateContext,
llsig.llarg_tys,
llsig.llret_ty,
ret_def);
debug2!("foreign_types_for_fn_ty(\
debug!("foreign_types_for_fn_ty(\
ty={}, \
llsig={} -> {}, \
fn_ty={} -> {}, \

View file

@ -213,12 +213,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
match ti.take_glue {
Some(_) => (),
None => {
debug2!("+++ lazily_emit_tydesc_glue TAKE {}",
debug!("+++ lazily_emit_tydesc_glue TAKE {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "take");
ti.take_glue = Some(glue_fn);
make_generic_glue(ccx, ti.ty, glue_fn, make_take_glue, "take");
debug2!("--- lazily_emit_tydesc_glue TAKE {}",
debug!("--- lazily_emit_tydesc_glue TAKE {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
}
}
@ -226,12 +226,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
match ti.drop_glue {
Some(_) => (),
None => {
debug2!("+++ lazily_emit_tydesc_glue DROP {}",
debug!("+++ lazily_emit_tydesc_glue DROP {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "drop");
ti.drop_glue = Some(glue_fn);
make_generic_glue(ccx, ti.ty, glue_fn, make_drop_glue, "drop");
debug2!("--- lazily_emit_tydesc_glue DROP {}",
debug!("--- lazily_emit_tydesc_glue DROP {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
}
}
@ -239,12 +239,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
match ti.free_glue {
Some(_) => (),
None => {
debug2!("+++ lazily_emit_tydesc_glue FREE {}",
debug!("+++ lazily_emit_tydesc_glue FREE {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "free");
ti.free_glue = Some(glue_fn);
make_generic_glue(ccx, ti.ty, glue_fn, make_free_glue, "free");
debug2!("--- lazily_emit_tydesc_glue FREE {}",
debug!("--- lazily_emit_tydesc_glue FREE {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
}
}
@ -252,12 +252,12 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
match ti.visit_glue {
Some(_) => (),
None => {
debug2!("+++ lazily_emit_tydesc_glue VISIT {}",
debug!("+++ lazily_emit_tydesc_glue VISIT {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "visit");
ti.visit_glue = Some(glue_fn);
make_generic_glue(ccx, ti.ty, glue_fn, make_visit_glue, "visit");
debug2!("--- lazily_emit_tydesc_glue VISIT {}",
debug!("--- lazily_emit_tydesc_glue VISIT {}",
ppaux::ty_to_str(ccx.tcx, ti.ty));
}
}
@ -640,7 +640,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
let llalign = llalign_of(ccx, llty);
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc").to_managed();
note_unique_llvm_symbol(ccx, name);
debug2!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx, t), name);
debug!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx, t), name);
let gvar = do name.with_c_str |buf| {
unsafe {
llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type.to_ref(), buf)
@ -661,7 +661,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
free_glue: None,
visit_glue: None
};
debug2!("--- declare_tydesc {}", ppaux::ty_to_str(ccx.tcx, t));
debug!("--- declare_tydesc {}", ppaux::ty_to_str(ccx.tcx, t));
return inf;
}
@ -671,7 +671,7 @@ pub fn declare_generic_glue(ccx: &mut CrateContext, t: ty::t, llfnty: Type,
name: &str) -> ValueRef {
let _icx = push_ctxt("declare_generic_glue");
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name)).to_managed();
debug2!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
debug!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
note_unique_llvm_symbol(ccx, fn_nm);
let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty);
set_glue_inlining(llfn, t);
@ -771,7 +771,7 @@ pub fn emit_tydescs(ccx: &mut CrateContext) {
}
};
debug2!("ti.borrow_offset: {}", ccx.tn.val_to_str(ti.borrow_offset));
debug!("ti.borrow_offset: {}", ccx.tn.val_to_str(ti.borrow_offset));
let tydesc = C_named_struct(ccx.tydesc_type,
[ti.size, // size

View file

@ -29,7 +29,7 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId)
match ccx.external.find(&fn_id) {
Some(&Some(node_id)) => {
// Already inline
debug2!("maybe_instantiate_inline({}): already inline as node id {}",
debug!("maybe_instantiate_inline({}): already inline as node id {}",
ty::item_path_str(ccx.tcx, fn_id), node_id);
return local_def(node_id);
}
@ -141,7 +141,7 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId)
_ => {
let self_ty = ty::node_id_to_type(ccx.tcx,
mth.self_id);
debug2!("calling inline trans_fn with self_ty {}",
debug!("calling inline trans_fn with self_ty {}",
ty_to_str(ccx.tcx, self_ty));
match mth.explicit_self.node {
ast::sty_value => impl_self(self_ty, ty::ByRef),

View file

@ -41,7 +41,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
substs: @param_substs,
attributes: &[ast::Attribute],
ref_id: Option<ast::NodeId>) {
debug2!("trans_intrinsic(item.ident={})", ccx.sess.str_of(item.ident));
debug!("trans_intrinsic(item.ident={})", ccx.sess.str_of(item.ident));
fn simple_llvm_intrinsic(bcx: @mut Block, name: &'static str, num_args: uint) {
assert!(num_args <= 4);
@ -311,7 +311,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
if in_type_size != out_type_size {
let sp = match ccx.tcx.items.get_copy(&ref_id.unwrap()) {
ast_map::node_expr(e) => e.span,
_ => fail2!("transmute has non-expr arg"),
_ => fail!("transmute has non-expr arg"),
};
let pluralize = |n| if 1u == n { "" } else { "s" };
ccx.sess.span_fatal(sp,

View file

@ -55,7 +55,7 @@ pub fn trans_impl(ccx: @mut CrateContext,
let _icx = push_ctxt("impl::trans_impl");
let tcx = ccx.tcx;
debug2!("trans_impl(path={}, name={}, id={:?})",
debug!("trans_impl(path={}, name={}, id={:?})",
path.repr(tcx), name.repr(tcx), id);
// Both here and below with generic methods, be sure to recurse and look for
@ -117,7 +117,7 @@ pub fn trans_method(ccx: @mut CrateContext,
ty::subst_tps(ccx.tcx, *tys, *self_sub, self_ty)
}
};
debug2!("calling trans_fn with self_ty {}",
debug!("calling trans_fn with self_ty {}",
self_ty.repr(ccx.tcx));
match method.explicit_self.node {
ast::sty_value => impl_self(self_ty, ty::ByRef),
@ -161,7 +161,7 @@ pub fn trans_method_callee(bcx: @mut Block,
-> Callee {
let _icx = push_ctxt("impl::trans_method_callee");
debug2!("trans_method_callee(callee_id={:?}, this={}, mentry={})",
debug!("trans_method_callee(callee_id={:?}, this={}, mentry={})",
callee_id,
bcx.expr_to_str(this),
mentry.repr(bcx.tcx()));
@ -199,7 +199,7 @@ pub fn trans_method_callee(bcx: @mut Block,
trait_id, off, vtbl)
}
// how to get rid of this?
None => fail2!("trans_method_callee: missing param_substs")
None => fail!("trans_method_callee: missing param_substs")
}
}
@ -220,7 +220,7 @@ pub fn trans_static_method_callee(bcx: @mut Block,
let _icx = push_ctxt("impl::trans_static_method_callee");
let ccx = bcx.ccx();
debug2!("trans_static_method_callee(method_id={:?}, trait_id={}, \
debug!("trans_static_method_callee(method_id={:?}, trait_id={}, \
callee_id={:?})",
method_id,
ty::item_path_str(bcx.tcx(), trait_id),
@ -250,16 +250,16 @@ pub fn trans_static_method_callee(bcx: @mut Block,
ast_map::node_trait_method(trait_method, _, _) => {
ast_util::trait_method_to_ty_method(trait_method).ident
}
_ => fail2!("callee is not a trait method")
_ => fail!("callee is not a trait method")
}
} else {
let path = csearch::get_item_path(bcx.tcx(), method_id);
match path[path.len()-1] {
path_pretty_name(s, _) | path_name(s) => { s }
path_mod(_) => { fail2!("path doesn't have a name?") }
path_mod(_) => { fail!("path doesn't have a name?") }
}
};
debug2!("trans_static_method_callee: method_id={:?}, callee_id={:?}, \
debug!("trans_static_method_callee: method_id={:?}, callee_id={:?}, \
name={}", method_id, callee_id, ccx.sess.str_of(mname));
let vtbls = resolve_vtables_in_fn_ctxt(
@ -287,7 +287,7 @@ pub fn trans_static_method_callee(bcx: @mut Block,
FnData {llfn: PointerCast(bcx, lval, llty)}
}
_ => {
fail2!("vtable_param left in monomorphized \
fail!("vtable_param left in monomorphized \
function's vtable substs");
}
}
@ -362,7 +362,7 @@ pub fn trans_monomorphized_callee(bcx: @mut Block,
}
}
typeck::vtable_param(*) => {
fail2!("vtable_param left in monomorphized function's vtable substs");
fail!("vtable_param left in monomorphized function's vtable substs");
}
};
@ -395,13 +395,13 @@ pub fn combine_impl_and_methods_tps(bcx: @mut Block,
let method = ty::method(ccx.tcx, mth_did);
let n_m_tps = method.generics.type_param_defs.len();
let node_substs = node_id_type_params(bcx, callee_id);
debug2!("rcvr_substs={:?}", rcvr_substs.repr(ccx.tcx));
debug!("rcvr_substs={:?}", rcvr_substs.repr(ccx.tcx));
let ty_substs
= vec::append(rcvr_substs.to_owned(),
node_substs.tailn(node_substs.len() - n_m_tps));
debug2!("n_m_tps={:?}", n_m_tps);
debug2!("node_substs={:?}", node_substs.repr(ccx.tcx));
debug2!("ty_substs={:?}", ty_substs.repr(ccx.tcx));
debug!("n_m_tps={:?}", n_m_tps);
debug!("node_substs={:?}", node_substs.repr(ccx.tcx));
debug!("ty_substs={:?}", ty_substs.repr(ccx.tcx));
// Now, do the same work for the vtables. The vtables might not
@ -474,13 +474,13 @@ pub fn trans_trait_callee_from_llval(bcx: @mut Block,
let ccx = bcx.ccx();
// Load the data pointer from the object.
debug2!("(translating trait callee) loading second index from pair");
debug!("(translating trait callee) loading second index from pair");
let llboxptr = GEPi(bcx, llpair, [0u, abi::trt_field_box]);
let llbox = Load(bcx, llboxptr);
let llself = PointerCast(bcx, llbox, Type::opaque_box(ccx).ptr_to());
// Load the function from the vtable and cast it to the expected type.
debug2!("(translating trait callee) loading method");
debug!("(translating trait callee) loading method");
let llcallee_ty = type_of_fn_from_ty(ccx, callee_ty);
let llvtable = Load(bcx,
PointerCast(bcx,
@ -524,7 +524,7 @@ pub fn vtable_id(ccx: @mut CrateContext,
}
// can't this be checked at the callee?
_ => fail2!("vtable_id")
_ => fail!("vtable_id")
}
}
@ -611,7 +611,7 @@ fn emit_vtable_methods(bcx: @mut Block,
// the method type from the impl to substitute into.
let m_id = method_with_name(ccx, impl_id, ident.name);
let m = ty::method(tcx, m_id);
debug2!("(making impl vtable) emitting method {} at subst {}",
debug!("(making impl vtable) emitting method {} at subst {}",
m.repr(tcx),
substs.repr(tcx));
let fty = ty::subst_tps(tcx,
@ -619,7 +619,7 @@ fn emit_vtable_methods(bcx: @mut Block,
None,
ty::mk_bare_fn(tcx, m.fty.clone()));
if m.generics.has_type_params() || ty::type_has_self(fty) {
debug2!("(making impl vtable) method has self or type params: {}",
debug!("(making impl vtable) method has self or type params: {}",
tcx.sess.str_of(ident));
C_null(Type::nil().ptr_to())
} else {

View file

@ -36,7 +36,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
ref_id: Option<ast::NodeId>)
-> (ValueRef, bool)
{
debug2!("monomorphic_fn(\
debug!("monomorphic_fn(\
fn_id={}, \
real_substs={}, \
vtables={}, \
@ -68,7 +68,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
must_cast = true;
}
debug2!("monomorphic_fn(\
debug!("monomorphic_fn(\
fn_id={}, \
psubsts={}, \
hash_id={:?})",
@ -78,7 +78,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
match ccx.monomorphized.find(&hash_id) {
Some(&val) => {
debug2!("leaving monomorphic fn {}",
debug!("leaving monomorphic fn {}",
ty::item_path_str(ccx.tcx, fn_id));
return (val, must_cast);
}
@ -140,7 +140,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
ast_map::node_struct_ctor(_, i, pt) => (pt, i.ident, i.span)
};
debug2!("monomorphic_fn about to subst into {}", llitem_ty.repr(ccx.tcx));
debug!("monomorphic_fn about to subst into {}", llitem_ty.repr(ccx.tcx));
let mono_ty = match is_static_provided {
None => ty::subst_tps(ccx.tcx, psubsts.tys,
psubsts.self_ty, llitem_ty),
@ -164,7 +164,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
(psubsts.tys.slice(0, idx) +
&[psubsts.self_ty.unwrap()] +
psubsts.tys.tailn(idx));
debug2!("static default: changed substitution to {}",
debug!("static default: changed substitution to {}",
substs.repr(ccx.tcx));
ty::subst_tps(ccx.tcx, substs, None, llitem_ty)
@ -176,7 +176,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
assert!(f.abis.is_rust() || f.abis.is_intrinsic());
f
}
_ => fail2!("expected bare rust fn or an intrinsic")
_ => fail!("expected bare rust fn or an intrinsic")
};
ccx.stats.n_monos += 1;
@ -197,7 +197,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
let mut pt = (*pt).clone();
pt.push(elt);
let s = mangle_exported_name(ccx, pt.clone(), mono_ty);
debug2!("monomorphize_fn mangled to {}", s);
debug!("monomorphize_fn mangled to {}", s);
let mk_lldecl = || {
let lldecl = decl_internal_rust_fn(ccx, f.sig.inputs, f.sig.output, s);
@ -290,7 +290,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
};
ccx.monomorphizing.insert(fn_id, depth);
debug2!("leaving monomorphic fn {}", ty::item_path_str(ccx.tcx, fn_id));
debug!("leaving monomorphic fn {}", ty::item_path_str(ccx.tcx, fn_id));
(lldecl, must_cast)
}
@ -302,7 +302,7 @@ pub fn make_mono_id(ccx: @mut CrateContext,
let substs_iter = substs.self_ty.iter().chain(substs.tys.iter());
let precise_param_ids: ~[(ty::t, Option<@~[mono_id]>)] = match substs.vtables {
Some(vts) => {
debug2!("make_mono_id vtables={} substs={}",
debug!("make_mono_id vtables={} substs={}",
vts.repr(ccx.tcx), substs.tys.repr(ccx.tcx));
let vts_iter = substs.self_vtables.iter().chain(vts.iter());
vts_iter.zip(substs_iter).map(|(vtable, subst)| {

View file

@ -98,10 +98,10 @@ impl Reflector {
let mth_ty =
ty::mk_bare_fn(tcx, self.visitor_methods[mth_idx].fty.clone());
let v = self.visitor_val;
debug2!("passing {} args:", args.len());
debug!("passing {} args:", args.len());
let mut bcx = self.bcx;
for (i, a) in args.iter().enumerate() {
debug2!("arg {}: {}", i, bcx.val_to_str(*a));
debug!("arg {}: {}", i, bcx.val_to_str(*a));
}
let bool_ty = ty::mk_bool();
let result = unpack_result!(bcx, callee::trans_call_inner(
@ -151,7 +151,7 @@ impl Reflector {
pub fn visit_ty(&mut self, t: ty::t) {
let bcx = self.bcx;
let tcx = bcx.ccx().tcx;
debug2!("reflect::visit_ty {}", ty_to_str(bcx.ccx().tcx, t));
debug!("reflect::visit_ty {}", ty_to_str(bcx.ccx().tcx, t));
match ty::get(t).sty {
ty::ty_bot => self.leaf("bot"),

View file

@ -169,7 +169,7 @@ pub fn trans_fixed_vstore(bcx: @mut Block,
// to store the array of the suitable size, so all we have to do is
// generate the content.
debug2!("trans_fixed_vstore(vstore_expr={}, dest={:?})",
debug!("trans_fixed_vstore(vstore_expr={}, dest={:?})",
bcx.expr_to_str(vstore_expr), dest.to_str(bcx.ccx()));
let _indenter = indenter();
@ -199,7 +199,7 @@ pub fn trans_slice_vstore(bcx: @mut Block,
let ccx = bcx.ccx();
debug2!("trans_slice_vstore(vstore_expr={}, dest={})",
debug!("trans_slice_vstore(vstore_expr={}, dest={})",
bcx.expr_to_str(vstore_expr), dest.to_str(ccx));
let _indenter = indenter();
@ -214,7 +214,7 @@ pub fn trans_slice_vstore(bcx: @mut Block,
// Handle the &[...] case:
let vt = vec_types_from_expr(bcx, vstore_expr);
let count = elements_required(bcx, content_expr);
debug2!("vt={}, count={:?}", vt.to_str(ccx), count);
debug!("vt={}, count={:?}", vt.to_str(ccx), count);
// Make a fixed-length backing array and allocate it on the stack.
let llcount = C_uint(ccx, count);
@ -255,7 +255,7 @@ pub fn trans_lit_str(bcx: @mut Block,
// different from trans_slice_vstore() above because it does need to copy
// the content anywhere.
debug2!("trans_lit_str(lit_expr={}, dest={})",
debug!("trans_lit_str(lit_expr={}, dest={})",
bcx.expr_to_str(lit_expr),
dest.to_str(bcx.ccx()));
let _indenter = indenter();
@ -286,7 +286,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a
// @[...] or ~[...] (also @"..." or ~"...") allocate boxes in the
// appropriate heap and write the array elements into them.
debug2!("trans_uniq_or_managed_vstore(vstore_expr={}, heap={:?})",
debug!("trans_uniq_or_managed_vstore(vstore_expr={}, heap={:?})",
bcx.expr_to_str(vstore_expr), heap);
let _indenter = indenter();
@ -317,7 +317,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a
_ => {}
}
}
heap_exchange_closure => fail2!("vectors use exchange_alloc"),
heap_exchange_closure => fail!("vectors use exchange_alloc"),
heap_managed | heap_managed_unique => {}
}
@ -329,7 +329,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: &a
add_clean_free(bcx, val, heap);
let dataptr = get_dataptr(bcx, get_bodyptr(bcx, val, vt.vec_ty));
debug2!("alloc_vec() returned val={}, dataptr={}",
debug!("alloc_vec() returned val={}, dataptr={}",
bcx.val_to_str(val), bcx.val_to_str(dataptr));
let bcx = write_content(bcx, &vt, vstore_expr,
@ -349,7 +349,7 @@ pub fn write_content(bcx: @mut Block,
let _icx = push_ctxt("tvec::write_content");
let mut bcx = bcx;
debug2!("write_content(vt={}, dest={}, vstore_expr={:?})",
debug!("write_content(vt={}, dest={}, vstore_expr={:?})",
vt.to_str(bcx.ccx()),
dest.to_str(bcx.ccx()),
bcx.expr_to_str(vstore_expr));
@ -382,7 +382,7 @@ pub fn write_content(bcx: @mut Block,
let mut temp_cleanups = ~[];
for (i, element) in elements.iter().enumerate() {
let lleltptr = GEPi(bcx, lldest, [i]);
debug2!("writing index {:?} with lleltptr={:?}",
debug!("writing index {:?} with lleltptr={:?}",
i, bcx.val_to_str(lleltptr));
bcx = expr::trans_into(bcx, *element,
SaveIn(lleltptr));

View file

@ -364,7 +364,7 @@ impl Type {
Double => 64,
X86_FP80 => 80,
FP128 | PPC_FP128 => 128,
_ => fail2!("llvm_float_width called on a non-float type")
_ => fail!("llvm_float_width called on a non-float type")
}
}
}

View file

@ -172,7 +172,7 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
// NB: If you update this, be sure to update `sizing_type_of()` as well.
pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
debug2!("type_of {:?}: {:?}", t, ty::get(t));
debug!("type_of {:?}: {:?}", t, ty::get(t));
// Check the cache.
match cx.lltypes.find(&t) {

View file

@ -39,7 +39,7 @@ pub fn root_and_write_guard(datum: &Datum,
expr_id: ast::NodeId,
derefs: uint) -> @mut Block {
let key = root_map_key { id: expr_id, derefs: derefs };
debug2!("write_guard::root_and_write_guard(key={:?})", key);
debug!("write_guard::root_and_write_guard(key={:?})", key);
// root the autoderef'd value, if necessary:
//
@ -66,7 +66,7 @@ pub fn return_to_mut(mut bcx: @mut Block,
bits_val_ref: ValueRef,
filename_val: ValueRef,
line_val: ValueRef) -> @mut Block {
debug2!("write_guard::return_to_mut(root_key={:?}, {}, {}, {})",
debug!("write_guard::return_to_mut(root_key={:?}, {}, {}, {})",
root_key,
bcx.to_str(),
bcx.val_to_str(frozen_val_ref),
@ -111,7 +111,7 @@ fn root(datum: &Datum,
//! case, we will call this function, which will stash a copy
//! away until we exit the scope `scope_id`.
debug2!("write_guard::root(root_key={:?}, root_info={:?}, datum={:?})",
debug!("write_guard::root(root_key={:?}, root_info={:?}, datum={:?})",
root_key, root_info, datum.to_str(bcx.ccx()));
if bcx.sess().trace() {
@ -184,7 +184,7 @@ fn root(datum: &Datum,
fn perform_write_guard(datum: &Datum,
bcx: @mut Block,
span: Span) -> @mut Block {
debug2!("perform_write_guard");
debug!("perform_write_guard");
let llval = datum.to_value_llval(bcx);
let (filename, line) = filename_and_line_num_from_span(bcx, span);

View file

@ -1514,7 +1514,7 @@ pub fn fold_regions(
fldr: &fn(r: Region, in_fn: bool) -> Region) -> t {
fn do_fold(cx: ctxt, ty: t, in_fn: bool,
fldr: &fn(Region, bool) -> Region) -> t {
debug2!("do_fold(ty={}, in_fn={})", ty_to_str(cx, ty), in_fn);
debug!("do_fold(ty={}, in_fn={})", ty_to_str(cx, ty), in_fn);
if !type_has_regions(ty) { return ty; }
fold_regions_and_ty(
cx, ty,
@ -1655,7 +1655,7 @@ pub fn simd_type(cx: ctxt, ty: t) -> t {
let fields = lookup_struct_fields(cx, did);
lookup_field_type(cx, did, fields[0].id, substs)
}
_ => fail2!("simd_type called on invalid type")
_ => fail!("simd_type called on invalid type")
}
}
@ -1665,14 +1665,14 @@ pub fn simd_size(cx: ctxt, ty: t) -> uint {
let fields = lookup_struct_fields(cx, did);
fields.len()
}
_ => fail2!("simd_size called on invalid type")
_ => fail!("simd_size called on invalid type")
}
}
pub fn get_element_type(ty: t, i: uint) -> t {
match get(ty).sty {
ty_tup(ref ts) => return ts[i],
_ => fail2!("get_element_type called on invalid type")
_ => fail!("get_element_type called on invalid type")
}
}
@ -2323,7 +2323,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
let mut tc = TC_ALL;
do each_inherited_builtin_bound(cx, bounds, traits) |bound| {
debug2!("tc = {}, bound = {:?}", tc.to_str(), bound);
debug!("tc = {}, bound = {:?}", tc.to_str(), bound);
tc = tc - match bound {
BoundStatic => TypeContents::nonstatic(cx),
BoundSend => TypeContents::nonsendable(cx),
@ -2333,7 +2333,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
};
}
debug2!("result = {}", tc.to_str());
debug!("result = {}", tc.to_str());
return tc;
// Iterates over all builtin bounds on the type parameter def, including
@ -2363,7 +2363,7 @@ pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool {
pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
fn type_requires(cx: ctxt, seen: &mut ~[DefId],
r_ty: t, ty: t) -> bool {
debug2!("type_requires({}, {})?",
debug!("type_requires({}, {})?",
::util::ppaux::ty_to_str(cx, r_ty),
::util::ppaux::ty_to_str(cx, ty));
@ -2372,7 +2372,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
subtypes_require(cx, seen, r_ty, ty)
};
debug2!("type_requires({}, {})? {}",
debug!("type_requires({}, {})? {}",
::util::ppaux::ty_to_str(cx, r_ty),
::util::ppaux::ty_to_str(cx, ty),
r);
@ -2381,7 +2381,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
fn subtypes_require(cx: ctxt, seen: &mut ~[DefId],
r_ty: t, ty: t) -> bool {
debug2!("subtypes_require({}, {})?",
debug!("subtypes_require({}, {})?",
::util::ppaux::ty_to_str(cx, r_ty),
::util::ppaux::ty_to_str(cx, ty));
@ -2455,7 +2455,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
}
};
debug2!("subtypes_require({}, {})? {}",
debug!("subtypes_require({}, {})? {}",
::util::ppaux::ty_to_str(cx, r_ty),
::util::ppaux::ty_to_str(cx, ty),
r);
@ -2472,7 +2472,7 @@ pub fn type_structurally_contains(cx: ctxt,
test: &fn(x: &sty) -> bool)
-> bool {
let sty = &get(ty).sty;
debug2!("type_structurally_contains: {}",
debug!("type_structurally_contains: {}",
::util::ppaux::ty_to_str(cx, ty));
if test(sty) { return true; }
match *sty {
@ -2819,7 +2819,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig {
ty_bare_fn(ref f) => f.sig.clone(),
ty_closure(ref f) => f.sig.clone(),
ref s => {
fail2!("ty_fn_sig() called on non-fn type: {:?}", s)
fail!("ty_fn_sig() called on non-fn type: {:?}", s)
}
}
}
@ -2830,7 +2830,7 @@ pub fn ty_fn_args(fty: t) -> ~[t] {
ty_bare_fn(ref f) => f.sig.inputs.clone(),
ty_closure(ref f) => f.sig.inputs.clone(),
ref s => {
fail2!("ty_fn_args() called on non-fn type: {:?}", s)
fail!("ty_fn_args() called on non-fn type: {:?}", s)
}
}
}
@ -2839,7 +2839,7 @@ pub fn ty_closure_sigil(fty: t) -> Sigil {
match get(fty).sty {
ty_closure(ref f) => f.sigil,
ref s => {
fail2!("ty_closure_sigil() called on non-closure type: {:?}", s)
fail!("ty_closure_sigil() called on non-closure type: {:?}", s)
}
}
}
@ -2849,7 +2849,7 @@ pub fn ty_fn_purity(fty: t) -> ast::purity {
ty_bare_fn(ref f) => f.purity,
ty_closure(ref f) => f.purity,
ref s => {
fail2!("ty_fn_purity() called on non-fn type: {:?}", s)
fail!("ty_fn_purity() called on non-fn type: {:?}", s)
}
}
}
@ -2859,7 +2859,7 @@ pub fn ty_fn_ret(fty: t) -> t {
ty_bare_fn(ref f) => f.sig.output,
ty_closure(ref f) => f.sig.output,
ref s => {
fail2!("ty_fn_ret() called on non-fn type: {:?}", s)
fail!("ty_fn_ret() called on non-fn type: {:?}", s)
}
}
}
@ -2876,7 +2876,7 @@ pub fn ty_vstore(ty: t) -> vstore {
match get(ty).sty {
ty_evec(_, vstore) => vstore,
ty_estr(vstore) => vstore,
ref s => fail2!("ty_vstore() called on invalid sty: {:?}", s)
ref s => fail!("ty_vstore() called on invalid sty: {:?}", s)
}
}
@ -3310,7 +3310,7 @@ pub fn expr_kind(tcx: ctxt,
RvalueStmtExpr
}
ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ast::ExprLogLevel |
ast::ExprLit(_) | // Note: lit_str is carved out above
@ -3338,7 +3338,7 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => {
return id;
}
ast::StmtMac(*) => fail2!("unexpanded macro in trans")
ast::StmtMac(*) => fail!("unexpanded macro in trans")
}
}
@ -3689,7 +3689,7 @@ fn lookup_locally_or_in_crate_store<V:Clone>(
}
if def_id.crate == ast::LOCAL_CRATE {
fail2!("No def'n found for {:?} in tcx.{}", def_id, descr);
fail!("No def'n found for {:?} in tcx.{}", def_id, descr);
}
let v = load_external();
map.insert(def_id, v.clone());
@ -3732,7 +3732,7 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
None => {}
}
let ret = if id.crate == ast::LOCAL_CRATE {
debug2!("(impl_trait_ref) searching for trait impl {:?}", id);
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
match cx.items.find(&id.node) {
Some(&ast_map::node_item(@ast::item {
node: ast::item_impl(_, ref opt_trait, _, _),
@ -4491,7 +4491,7 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt,
// Add the given trait ty to the hash map
while i < trait_refs.len() {
debug2!("each_bound_trait_and_supertraits(i={:?}, trait_ref={})",
debug!("each_bound_trait_and_supertraits(i={:?}, trait_ref={})",
i, trait_refs[i].repr(tcx));
if !f(trait_refs[i]) {
@ -4501,7 +4501,7 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt,
// Add supertraits to supertrait_set
let supertrait_refs = trait_ref_supertraits(tcx, trait_refs[i]);
for &supertrait_ref in supertrait_refs.iter() {
debug2!("each_bound_trait_and_supertraits(supertrait_ref={})",
debug!("each_bound_trait_and_supertraits(supertrait_ref={})",
supertrait_ref.repr(tcx));
let d_id = supertrait_ref.def_id;

Some files were not shown because too many files have changed in this diff Show more