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 {
~"pretty" => mode_pretty,
~"debug-info" => mode_debug_info,
~"codegen" => mode_codegen,
- _ => fail2!("invalid mode")
+ _ => fail!("invalid mode")
}
}
// 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 {
}
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 {
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}];
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)
}
}
}
Some(colon) => {
let value = line.slice(colon + keycolon.len(),
line.len()).to_owned();
- debug2!("{}: {}", directive, value);
+ debug!("{}: {}", directive, value);
Some(value)
}
None => None
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),
\n",
expected, actual);
io::stdout().write_str(msg);
- fail2!();
+ fail!();
}
}
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
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;
}
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) &&
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());
}
}
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 =
\n",
err, ProcRes.cmdline, ProcRes.stdout, ProcRes.stderr);
io::stdout().write_str(msg);
- fail2!();
+ fail!();
}
fn _arm_exec_compiled_test(config: &config, props: &TestProps,
return os
}
}
- fail2!("Cannot determine OS from triple");
+ fail!("Cannot determine OS from triple");
}
pub fn make_new_path(path: &str) -> ~str {
pub fn path_div() -> ~str { ~";" }
pub fn logv(config: &config, s: ~str) {
- debug2!("{}", s);
+ debug!("{}", s);
if config.verbose { io::println(s); }
}
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
}
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!");
}
}
}
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
}
assert_eq!(arc_v.get()[2], 3);
assert_eq!(arc_v.get()[4], 5);
- info2!("{:?}", arc_v);
+ info!("{:?}", arc_v);
}
#[test]
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);
}
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)
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);
// Now, fail while allocating
do arena.alloc::<@int> {
// Now fail.
- fail2!();
+ fail!();
};
}
v.push('=' as u8);
}
}
- _ => fail2!("Algebra is broken, please alert the math police")
+ _ => fail!("Algebra is broken, please alert the math police")
}
unsafe {
}
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 {
let mut b = Bitv::new(14, true);
b.clear();
do b.ones |i| {
- fail2!("found 1 at {:?}", i)
+ fail!("found 1 at {:?}", i)
};
}
let mut b = Bitv::new(140, true);
b.clear();
do b.ones |i| {
- fail2!("found 1 at {:?}", i)
+ fail!("found 1 at {:?}", i)
};
}
let (port, chan) = rendezvous();
do spawn_unlinked {
chan.duplex_stream.send(()); // Can't access this field outside this module
- fail2!()
+ fail!()
}
port.recv()
}
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
- fail2!()
+ fail!()
}
chan.try_send(());
}
let (port, chan) = rendezvous();
do spawn_unlinked {
port.duplex_stream.recv();
- fail2!()
+ fail!()
}
chan.send(());
}
}
}
-/// 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) {
} else {
match hi.checked_add(&new_high_bits) {
Some(y) => return (y, x),
- None => fail2!("Numeric overflow occured.")
+ None => fail!("Numeric overflow occured.")
}
}
},
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
// 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.")
}
}
}
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) => {
(data[start + 3u] as uint),
next: start + 4u};
}
- fail2!("vint too big");
+ fail!("vint too big");
}
#[cfg(target_arch = "x86")]
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!();
}
}
}
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,
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;
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
}
}
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
}
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
}
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);
_: &[&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);
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)
}
_: &[&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);
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)
}
_: uint,
f: &fn(&mut Decoder) -> T)
-> T {
- debug2!("read_struct(name={})", name);
+ debug!("read_struct(name={})", name);
f(self)
}
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)
}
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)
}
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)
}
}
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)
}
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)
}
}
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)
};
}
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 {
// 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);
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()) {
}
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());
}
}
#[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)
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);
}
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);
}
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;
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);
let state = replace(&mut this.state, Evaluating);
match state {
Forced(v) => v,
- _ => fail2!( "Logic error." ),
+ _ => fail!( "Logic error." ),
}
}
*/
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()
#[test]
#[should_fail]
fn test_futurefail() {
- let mut f = Future::spawn(|| fail2!());
+ let mut f = Future::spawn(|| fail!());
let _x: ~str = f.get();
}
//! ];
//! 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);
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)
}
}
} = (*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,
}
]
},
- (_,_) => fail2!("something is wrong with the long-form opt")
+ (_,_) => fail!("something is wrong with the long-form opt")
}
}
}
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
(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 }
assert!(m.opt_present("test"));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
- _ => { fail2!("test_reqopt_long failed"); }
+ _ => { fail!("test_reqopt_long failed"); }
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(m.opt_present("t"));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(m.opt_present("test"));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(m.opt_present("test")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
- _ => fail2!()
+ _ => fail!()
}
}
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!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(m.opt_present("t")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(m.free[0] == ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, OptionDuplicated_),
- _ => fail2!()
+ _ => fail!()
}
}
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 1);
}
- _ => fail2!()
+ _ => fail!()
}
}
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 2);
}
- _ => fail2!()
+ _ => fail!()
}
}
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 2);
}
- _ => fail2!()
+ _ => fail!()
}
}
Ok(ref m) => {
assert_eq!(m.opt_count("verbose"), 1);
}
- _ => fail2!()
+ _ => fail!()
}
}
Ok(ref m) => {
assert_eq!(m.opt_count("verbose"), 2);
}
- _ => fail2!()
+ _ => fail!()
}
}
assert!((m.opt_present("test")));
assert_eq!(m.opt_str("test").unwrap(), ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("test")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(pair[0] == ~"20");
assert!(pair[1] == ~"30");
}
- _ => fail2!()
+ _ => fail!()
}
}
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), ~"20");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Ok(ref m) => assert!(!m.opt_present("t")),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, ArgumentMissing_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(pair[0] == ~"20");
assert!(pair[1] == ~"30");
}
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, UnrecognizedOption_),
- _ => fail2!()
+ _ => fail!()
}
}
let rs = getopts(args, opts);
match rs {
Err(f) => check_fail_type(f, UnrecognizedOption_),
- _ => fail2!()
+ _ => fail!()
}
}
assert!(pair[1] == ~"-60 70");
assert!((!m.opt_present("notpresent")));
}
- _ => fail2!()
+ _ => fail!()
}
}
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"]));
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"]));
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");
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);
}
let usage = groups::usage("Usage: fruits", optgroups);
- debug2!("expected: <<{}>>", expected);
- debug2!("generated: <<{}>>", usage);
+ debug!("expected: <<{}>>", expected);
+ debug!("generated: <<{}>>", usage);
assert!(usage == expected)
}
let usage = groups::usage("Usage: fruits", optgroups);
- debug2!("expected: <<{}>>", expected);
- debug2!("generated: <<{}>>", usage);
+ debug!("expected: <<{}>>", expected);
+ debug!("generated: <<{}>>", usage);
assert!(usage == expected)
}
}
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)
}
}
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 }
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)
}
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) => {
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)
}
idx: uint,
f: &fn(&mut Decoder) -> T)
-> T {
- debug2!("read_enum_variant_arg(idx={})", idx);
+ debug!("read_enum_variant_arg(idx={})", idx);
f(self)
}
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)
}
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)
}
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
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)
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)
}
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)
}
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)
}
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_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();
}
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();
}
len
}
- json => fail2!("not an object: {:?}", json),
+ json => fail!("not an object: {:?}", json),
};
f(self, len)
}
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)
}
}
pub fn tail<T>(ls: @List<T>) -> @List<T> {
match *ls {
Cons(_, tl) => return tl,
- Nil => fail2!("list empty")
+ Nil => fail!("list empty")
}
}
match *ls {
Cons(ref hd, _) => (*hd).clone(),
// makes me sad
- _ => fail2!("head invoked on empty list")
+ _ => fail!("head invoked on empty list")
}
}
impl Neg<BigUint> for BigUint {
#[inline]
- fn neg(&self) -> BigUint { fail2!() }
+ fn neg(&self) -> BigUint { fail!() }
}
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()); }
14 => (38416, 4),
15 => (50625, 4),
16 => (65536, 4),
- _ => fail2!()
+ _ => fail!()
}
}
14 => (1475789056, 8),
15 => (2562890625, 8),
16 => (4294967296, 8),
- _ => fail2!()
+ _ => fail!()
}
}
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),
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())
~"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" +
(10, match bits {
32 => ~"55340232229718589441",
16 => ~"12885032961",
- _ => fail2!()
+ _ => fail!()
}),
(16, ~"3" +
str::from_chars(vec::from_elem(bits / 4 - 1, '0')) + "2" +
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);
}
#[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();
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
}
}
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
}
}
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);
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);
if buf.is_empty() {
bad_parse::cond.raise(())
}
- debug2!("extracted nonempty prefix: {}", buf);
+ debug!("extracted nonempty prefix: {}", buf);
(buf, ch)
}
}
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() {
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));
}
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);
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);
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;
}
let immut_names = names;
for (&a, &b) in expected.iter().zip(immut_names.iter()) {
- debug2!("{} {}", a, b);
+ debug!("{} {}", a, b);
assert_eq!(a, b);
}
}
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;
}
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
}
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;
}
};
tim_sort(arr);
- fail2!("Guarantee the fail");
+ fail!("Guarantee the fail");
}
#[deriving(Clone)]
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");
}
}
}
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");
}
}
}
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()
}
}
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 {
let result: result::Result<(),()> = do task::try {
do m2.lock {
- fail2!();
+ fail!();
}
};
assert!(result.is_err());
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
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");
}
}
}
}
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
let _ = p.recv();
do m.lock_cond |cond| {
if !cond.signal_on(0) {
- fail2!(); // success; punt sibling awake.
+ fail!(); // success; punt sibling awake.
}
}
};
let result: result::Result<(),()> = do task::try || {
do lock_rwlock_in_mode(&x2, mode1) {
- fail2!();
+ fail!();
}
};
assert!(result.is_err());
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!");
}
}
}
self.out.write(s.unwrap());
return true
} else {
- warn2!("{}", s.unwrap_err());
+ warn!("{}", s.unwrap_err());
}
}
false
self.out.write(s.unwrap());
return true
} else {
- warn2!("{}", s.unwrap_err());
+ warn!("{}", s.unwrap_err());
}
}
false
self.out.write(s.unwrap());
return true
} else {
- warn2!("{}", s.unwrap_err());
+ warn!("{}", s.unwrap_err());
}
}
false
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());
}
}
'x' => FormatHex,
'X' => FormatHEX,
's' => FormatString,
- _ => fail2!("bad FormatOp char")
+ _ => fail!("bad FormatOp char")
}
}
fn to_char(self) -> char {
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");
}
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
}
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();
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");
}
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.
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");
}
}
};
#[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
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
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),
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 => {}
// 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();
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 => {
};
if ok {
- debug2!("rewriting file '{:?}' with updated metrics", p);
+ debug!("rewriting file '{:?}' with updated metrics", p);
self.save(p);
}
return (diff, ok)
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);
}
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,
#[test]
pub fn do_not_run_ignored_tests() {
- fn f() { fail2!(); }
+ fn f() { fail!(); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
#[test]
fn test_should_fail() {
- fn f() { fail2!(); }
+ fn f() { fail!(); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
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());
}
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));
}
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);
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);
}
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);
== 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);
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)
}
}
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");
}
}
return match node.take() {
- Some(~TreeNode{value, _}) => Some(value), None => fail2!()
+ Some(~TreeNode{value, _}) => Some(value), None => fail!()
};
}
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));
}
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);
}
pub fn info(&self, i: &str) {
- info2!("workcache: {}", i);
+ info!("workcache: {}", i);
}
}
// 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);
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());
}
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());
}
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());
}
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| {
&'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)
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);
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());
}
}
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(" ")));
}
return ~[];
}
- debug2!("preparing the RPATH!");
+ debug!("preparing the RPATH!");
let sysroot = sess.filesearch.sysroot();
let output = out_filename;
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
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);
}
}
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()));
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
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;
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;
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;
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) {
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",
&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());
}
};
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) {
tests");
}
_ => {
- debug2!("this is a test function");
+ debug!("this is a test function");
let test = Test {
span: i.span,
path: self.cx.path.clone(),
should_fail: should_fail(i)
};
self.cx.testfns.push(test);
- // debug2!("have {} test/bench functions",
+ // debug!("have {} test/bench functions",
// cx.testfns.len());
}
}
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;
}
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));
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));
}
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);
}
}
}
}
};
- debug2!("resolving extern mod stmt. ident: {:?}, meta: {:?}",
+ debug!("resolving extern mod stmt. ident: {:?}, meta: {:?}",
ident, meta_items);
let cnum = resolve_crate(e,
ident,
// 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();
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.
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: @~[],
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,
(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)
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
}
}
'g' => PublicField,
'j' => PrivateField,
'N' => InheritedField,
- c => fail2!("unexpected family char: {}", c)
+ c => fail!("unexpected family char: {}", c)
}
}
'y' => ast::public,
'n' => ast::private,
'i' => ast::inherited,
- _ => fail2!("unknown visibility character")
+ _ => fail!("unknown visibility character")
}
}
}
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")
}
}
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,
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,
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);
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,
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);
match ch as char {
'i' => ast::MutImmutable,
'm' => ast::MutMutable,
- _ => fail2!("unknown mutability character: `{}`", ch as char),
+ _ => fail!("unknown mutability character: `{}`", ch as char),
}
}
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);
}
}
}
match item_family(impl_method_doc) {
StaticMethod => purity = ast::impure_fn,
UnsafeStaticMethod => purity = ast::unsafe_fn,
- _ => fail2!()
+ _ => fail!()
}
static_impl_methods.push(StaticMethodInfo {
PublicField => ast::public,
PrivateField => ast::private,
InheritedField => ast::inherited,
- _ => fail2!()
+ _ => fail!()
}
}
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));
}
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")
}
}
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 => {
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;
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);
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);
}
}
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,
}
}
None => {
- debug2!("(encoding info for module) found no reexports for {}",
+ debug!("(encoding info for module) found no reexports for {}",
id);
}
}
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() {
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,
// 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);
}
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);
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);
match p {
unsafe_fn => 'U',
impure_fn => 'F',
- _ => fail2!("extern fn can't be static")
+ _ => fail!("extern fn can't be static")
}
}
}
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);
// 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")
}
}
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")
}
}
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()),
abi);
}
// case for separate item and foreign-item tables
- _ => fail2!("bad foreign item")
+ _ => fail!("bad foreign item")
}
}
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) {
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()) {
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()) {
}
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,
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());
}
}
}
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")
}
}
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
}
}
_ => {}
}
}
- 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> {
// 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| {
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;
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);
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;
assert_eq!(next(st), '.');
ty::NonerasedRegions(regions)
}
- _ => fail2!("parse_bound_region: bad input")
+ _ => fail!("parse_bound_region: bad input")
}
}
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")
}
}
'e' => {
ty::re_static
}
- _ => fail2!("parse_region: bad input")
+ _ => fail!("parse_region: bad input")
}
}
match next(st) {
'n' => None,
's' => Some(f(st)),
- _ => fail2!("parse_opt: bad input")
+ _ => fail!("parse_opt: bad input")
}
}
'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(),
}
'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' => {
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!();}
}
}
'u' => unsafe_fn,
'i' => impure_fn,
'c' => extern_fn,
- _ => fail2!("parse_purity: bad purity {}", c)
+ _ => fail!("parse_purity: bad purity {}", c)
}
}
match c {
'o' => ast::Once,
'm' => ast::Many,
- _ => fail2!("parse_onceness: bad onceness")
+ _ => fail!("parse_onceness: bad onceness")
}
}
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);
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 }
return param_bounds;
}
_ => {
- fail2!("parse_bounds: bad bounds")
+ fail!("parse_bounds: bad bounds")
}
}
}
}
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")
}
}
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());
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());
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);
};
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(),
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()));
}
_ => { }
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 {
)
}
// hard to avoid - user input
- _ => fail2!("bad enum variant")
+ _ => fail!("bad enum variant")
}
}
}
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);
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));
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;
}
}
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);
}
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);
}
}
}
- debug2!(">< Side table doc loaded");
+ debug!(">< Side table doc loaded");
true
};
}
== pprust::item_to_str(item_exp,
token::get_ident_interner()));
}
- _ => fail2!()
+ _ => fail!()
}
}
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,
//! 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() {
//! 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()));
//! 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()));
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; }
* 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(
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:
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) |
//! 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, _)) => {
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);
}
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`
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);
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);
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,
// 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);
}
}
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()),
// 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);
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) {
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.
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);
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;
}
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) => {
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()),
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);
}
};
- debug2!("guarantee_valid(borrow_id={:?}), loan={}",
+ debug!("guarantee_valid(borrow_id={:?}), loan={}",
borrow_id, loan.repr(self.tcx()));
// let loan_path = loan.loan_path;
&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) =
}
};
- debug2!("move_path(lp={}, index={:?})",
+ debug!("move_path(lp={}, index={:?})",
lp.repr(tcx),
index);
* location `id` with kind `kind`.
*/
- debug2!("add_move(lp={}, id={:?}, kind={:?})",
+ debug!("add_move(lp={}, id={:?}, kind={:?})",
lp.repr(tcx),
id,
kind);
* 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);
};
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);
expr_exit
}
- ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
+ ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
ast::ExprLoop(ref body, _) => {
//
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 \
ast_map::node_item(it, _) => {
self.visit_item(it, ());
}
- _ => fail2!("const not bound to an item")
+ _ => fail!("const not bound to an item")
},
_ => ()
},
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")
}
}
}
return Some(variant(v.id));
}
}
- fail2!();
+ fail!();
} else { None }
}
ty::ty_nil => None,
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 }
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(),
}
}
single => true,
- _ => fail2!("type error")
+ _ => fail!("type error")
};
if match_ {
Some(r.tail().to_owned())
}
}
single => true,
- _ => fail2!("type error")
+ _ => fail!("type error")
};
if match_ {
Some(r.tail().to_owned())
}
}
single => true,
- _ => fail2!("type error")
+ _ => fail!("type error")
};
if match_ { Some(r.tail().to_owned()) } else { None }
}
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);
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 = ~[];
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);
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);
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);
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));
}
}
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)
}
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)
}
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)
}
}
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)
}
}
}
- debug2!("Dataflow result:");
- debug2!("{}", {
+ debug!("Dataflow result:");
+ debug!("{}", {
let this = @(*self).clone();
this.pretty_print_to(io::stderr(), blk);
""
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);
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);
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, _) => {
//
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)));
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)));
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
}
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
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;
}
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
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;
}
}
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;
}
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 => {}
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(*) => {
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,
}
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")
}
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(_) => {
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 {
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
}
}
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) => {
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) => {
// 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 \
}
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() {
};
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),
}
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) {
return *k;
}
}
- fail2!("unregistered lint {:?}", lint);
+ fail!("unregistered lint {:?}", lint);
}
fn span_lint(&self, lint: lint, span: Span, msg: &str) {
format!("{} [-{} {}]", msg,
match level {
warn => 'W', deny => 'D', forbid => 'F',
- allow => fail2!()
+ allow => fail!()
}, self.lint_to_str(lint).replace("_", "-"))
},
Node(src) => {
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() {
ast::BiGt => v >= min,
ast::BiGe => v > min,
ast::BiEq | ast::BiNe => v >= min && v <= max,
- _ => fail2!()
+ _ => fail!()
}
}
ast::lit_int_unsuffixed(v) => v,
_ => return true
},
- _ => fail2!()
+ _ => fail!()
};
is_valid(norm_binop, lit_val, min, max)
}
ast::lit_int_unsuffixed(v) => v as u64,
_ => return true
},
- _ => fail2!()
+ _ => fail!()
};
is_valid(norm_binop, lit_val, min, max)
}
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
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 {
ImplicitRet => {}
}
- debug2!("{} is {:?}", v.to_str(), vk);
+ debug!("{} is {:?}", v.to_str(), vk);
v
}
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:
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));
}
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 {
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));
// 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));
}
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);
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));
}
}
}
- 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;
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));
}
user.used = true;
}
- debug2!("{} accesses[{:x}] {}: {}",
+ debug!("{} accesses[{:x}] {}: {}",
ln.to_str(), acc, var.to_str(), self.ln_str(ln));
}
// 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
},
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 {
}
ExprFnBlock(_, ref blk) => {
- debug2!("{} is an expr_fn_block",
+ debug!("{} is an expr_fn_block",
expr_to_str(expr, self.tcx.sess.intr()));
/*
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
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);
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);
// 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) {
ExprParen(*) | ExprFnBlock(*) | ExprPath(*) | ExprSelf(*) => {
visit::walk_expr(this, expr, ());
}
- ExprForLoop(*) => fail2!("non-desugared expr_for_loop")
+ ExprForLoop(*) => fail!("non-desugared expr_for_loop")
}
}
}
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);
return self.cat_rvalue_node(expr, expr_ty);
}
- ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop")
+ ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop")
}
}
// 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();
* 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);
* 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, ());
* 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);
_ => expr_mode
};
- debug2!("comp_mode = {:?}", comp_mode);
+ debug!("comp_mode = {:?}", comp_mode);
match expr.node {
ExprPath(*) | ExprSelf => {
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, [])
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));
}
};
- debug2!("pattern binding {:?}: bm={:?}, binding_moves={}",
+ debug!("pattern binding {:?}: bm={:?}, binding_moves={}",
id, bm, binding_moves);
if binding_moves {
}
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);
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
// 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);
}
}
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);
}
}
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
}
}
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;
}
// 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,
// 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 {
/// 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.
// 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,
// 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);
}
Some(entry) => entry
};
- debug2!("(privacy checking) checking impl method");
+ debug!("(privacy checking) checking impl method");
self.check_method(expr.span, &entry.origin, ident);
}
_ => {}
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,
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);
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); }
}
}
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;
}
}
- debug2!("is_subscope_of({:?}, {:?})=true",
+ debug!("is_subscope_of({:?}, {:?})=true",
subscope, superscope);
return true;
* 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 || {
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 {
scope = superscope;
}
}
- // debug2!("ancestors_of_loop(scope={})", scope);
+ // debug!("ancestors_of_loop(scope={})", scope);
}
}
}
/// 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);
sp: Span,
id: ast::NodeId,
cx: Context) {
- debug2!("region::resolve_fn(id={:?}, \
+ debug!("region::resolve_fn(id={:?}, \
span={:?}, \
body.id={:?}, \
cx.parent={:?})",
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);
/// 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()),
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();
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) {
}
ast::ty_closure(ref f) => {
- debug2!("referenced fn type: {}",
+ debug!("referenced fn type: {}",
pprust::ty_to_str(ty, sess.intr()));
match f.region {
Some(_) => {
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);
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) => {
}
}
- 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()),
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
}
match self.method_map.find_mut(name) {
Some(s) => { s.insert(def_id); },
- _ => fail2!("Can't happen"),
+ _ => fail!("Can't happen"),
}
}
}
item_mac(*) => {
- fail2!("item macros unimplemented")
+ fail!("item macros unimplemented")
}
}
}
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);
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;
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);
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
}
}
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
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));
}
match self.method_map.find_mut(name) {
Some(s) => { s.insert(def_id); },
- _ => fail2!("Can't happen"),
+ _ => fail!("Can't happen"),
}
}
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);
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.
}
DefPrimTy(*) | DefTyParam(*) | DefBinding(*) |
DefUse(*) | DefUpvar(*) | DefRegion(*) |
DefTyParamBinder(*) | DefLabel(*) | DefSelfTy(*) => {
- fail2!("didn't expect `{:?}`", def);
+ fail!("didn't expect `{:?}`", def);
}
}
}
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(
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));
}
}
DlField => {
- debug2!("(building reduced graph for external crate) \
+ debug!("(building reduced graph for external crate) \
ignoring field");
}
}
/// 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,
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,
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;
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);
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;
}
/// 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_);
/// 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;
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_));
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),
// 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;
}
}
Some(_) => {
// The import is unresolved. Bail out.
- debug2!("(resolving single import) unresolved import; \
+ debug!("(resolving single import) unresolved import; \
bailing out");
return Indeterminate;
}
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;
}
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));
}
UnboundResult => { /* Continue. */ }
UnknownResult => {
- fail2!("type result should be known at this point");
+ fail!("type result should be known at this point");
}
}
None => {}
}
- debug2!("(resolving single import) successfully resolved import");
+ debug!("(resolving single import) successfully resolved import");
return Success(());
}
// 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;
}
// 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
}
}
}
- debug2!("(resolving glob import) writing resolution `{}` in `{}` \
+ debug!("(resolving glob import) writing resolution `{}` in `{}` \
to `{}`",
interner_get(name),
self.module_to_str(containing_module),
// 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;
None => {}
}
- debug2!("(resolving glob import) successfully resolved import");
+ debug!("(resolving glob import) successfully resolved import");
return Success(());
}
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;
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_));
return Failed;
}
Indeterminate => {
- debug2!("(resolving module path for import) indeterminate; \
+ debug!("(resolving module path for import) indeterminate; \
bailing");
return Indeterminate;
}
return Failed;
}
Indeterminate => {
- debug2!("(resolving module path for import) \
+ debug!("(resolving module path for import) \
indeterminate; bailing");
return Indeterminate;
}
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,
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. */ }
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));
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));
}
}
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;
}
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");
// 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));
}
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;
}
}
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;
}
// 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,
}
}
- 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));
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_));
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 => {
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));
}
// 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;
}
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;
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 => {}
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));
});
}
d_opt => {
- debug2!("(computing reexports) NO: {:?}", d_opt);
+ debug!("(computing reexports) NO: {:?}", d_opt);
}
}
}
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,
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));
}
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.
}
item_mac(*) => {
- fail2!("item macros unimplemented")
+ fail!("item macros unimplemented")
}
}
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),
this.resolve_type(&argument.ty);
- debug2!("(resolving function) recorded argument");
+ debug!("(resolving function) recorded argument");
}
this.resolve_type(&declaration.output);
// Resolve the function body.
this.resolve_block(block);
- debug2!("(resolving function) leaving function");
+ debug!("(resolving function) leaving function");
}
self.label_ribs.pop();
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);
}
}
_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_, ());
}
}
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.
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;
}
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) {
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()
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);
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));
interner_get(renamed)));
}
FoundConst(def, lp) if mode == RefutableMode => {
- debug2!("(resolving pattern) resolving `{}` to \
+ debug!("(resolving pattern) resolving `{}` to \
constant",
interner_get(renamed));
allowed here");
}
BareIdentifierPatternUnresolved => {
- debug2!("(resolving pattern) binding `{}`",
+ debug!("(resolving pattern) binding `{}`",
interner_get(renamed));
let is_mutable = mutability == Mutable;
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));
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) => {
}
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;
}
}
Indeterminate => {
- fail2!("indeterminate unexpected");
+ fail!("indeterminate unexpected");
}
Success((resulting_module, resulting_last_private)) => {
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;
},
}
Indeterminate => {
- fail2!("indeterminate unexpected");
+ fail!("indeterminate unexpected");
}
Success((resulting_module, resulting_last_private)) => {
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);
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
}
}
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;
}
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
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));
}
}
- 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,
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);
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 = ~[];
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));
}
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| {
}
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) {
}
}
- debug2!("* {}:{}{}", interner_get(*name),
+ debug!("* {}:{}{}", interner_get(*name),
value_repr, type_repr);
}
}
}
};
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() {
a_expr = e.unwrap();
}
UnitLikeStructLit(_) => {
- fail2!("UnitLikeStructLit should have been handled \
+ fail!("UnitLikeStructLit should have been handled \
above")
}
}
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"),
}
}
}
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,
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,
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,
}
}
- debug2!("result={}", result.repr(bcx.tcx()));
+ debug!("result={}", result.repr(bcx.tcx()));
return result;
}
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,
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,
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,
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,
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,
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,
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,
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,
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) => {
}
};
- 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 {
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()),
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)));
// 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 {
* - 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);
/// 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;
}
constraints.push_str(clobbers);
}
- debug2!("Asm Constraints: {:?}", constraints);
+ debug!("Asm Constraints: {:?}", constraints);
let numOutputs = outputs.len();
}
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);
(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.
}
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");
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);
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();
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()));
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(
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(
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();
-> @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,
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));
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,
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");
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;
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) => {
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);
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()));
};
(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),
}
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 {
// 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
}
if !inlineable {
- debug2!("{} not inlined", sym);
+ debug!("{} not inlined", sym);
ccx.non_inlineable_statics.insert(id);
}
ccx.item_symbols.insert(i.id, sym);
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")) {
}
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 \
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);
pub fn check_not_terminated(cx: &Block) {
if cx.terminated {
- fail2!("already terminated!");
+ fail!("already terminated!");
}
}
}
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)
}
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));
}
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");
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);
}
}
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(
let elt = ty.element_type();
ty_align(elt)
}
- _ => fail2!("ty_align: unhandled type")
+ _ => fail!("ty_align: unhandled type")
}
}
let eltsz = ty_size(elt);
len * eltsz
}
- _ => fail2!("ty_size: unhandled type")
+ _ => fail!("ty_size: unhandled type")
}
}
let elt = ty.element_type();
ty_align(elt)
}
- _ => fail2!("ty_size: unhandled type")
+ _ => fail!("ty_size: unhandled type")
}
}
let eltsz = ty_size(elt);
len * eltsz
}
- _ => fail2!("ty_size: unhandled type")
+ _ => fail!("ty_size: unhandled type")
}
}
let elt = ty.element_type();
ty_align(elt)
}
- _ => fail2!("ty_size: unhandled type")
+ _ => fail!("ty_size: unhandled type")
}
}
let eltsz = ty_size(elt);
len * eltsz
}
- _ => fail2!("ty_size: unhandled type")
+ _ => fail!("ty_size: unhandled type")
}
}
i += 1u;
}
}
- _ => fail2!("classify: unhandled type")
+ _ => fail!("classify: unhandled type")
}
}
SSEDs => {
tys.push(Type::f64());
}
- _ => fail2!("llregtype: unhandled class")
+ _ => fail!("llregtype: unhandled class")
}
i += 1u;
}
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 {
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)
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()),
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 = {}, \
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(
|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()));
substituted);
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
}
- _ => fail2!()
+ _ => fail!()
}
Callee { bcx: callee.bcx, data: Fn(FnData { llfn: new_llval }) }
},
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()));
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) {
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)
}
}
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);
}
}
});
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;
}
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",
// 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 => {
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(),
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| {
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);
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);
//! 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));
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;
_ => 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;
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;
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 {
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();
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();
}
};
- 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);
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)
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
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) {
-> (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 =
-> 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();
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) };
return;
}
- debug2!("finalize");
+ debug!("finalize");
compile_unit_metadata(cx);
unsafe {
llvm::LLVMDIBuilderFinalize(DIB(cx));
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);
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();
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();
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),
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);
}
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| {
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 {
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,
}
}
UnknownLocation => {
- debug2!("clearing debug location ");
+ debug!("clearing debug location ");
metadata_node = ptr::null();
}
};
}
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));
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));
};
}
}
- 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 {
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);
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
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();
};
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);
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);
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,
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)));
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| {
}
};
- debug2!("def_self() reference, self_info.t={}",
+ debug!("def_self() reference, self_info.t={}",
self_info.t.repr(bcx.tcx()));
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,
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));
* 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),
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),
// 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,
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
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
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
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);
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);
}
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
}
}
};
- debug2!("build_rust_fn: path={} id={:?} t={}",
+ debug!("build_rust_fn: path={} id={:?} t={}",
path.repr(tcx),
id,
t.repr(tcx));
"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));
// 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;
llrust_ret_ty.to_ref(),
s))
};
- debug2!("out pointer, \
+ debug!("out pointer, \
allocad={}, \
llrust_ret_ty={}, \
return_ty={}",
// 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.
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
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())
};
llsig.llarg_tys,
llsig.llret_ty,
ret_def);
- debug2!("foreign_types_for_fn_ty(\
+ debug!("foreign_types_for_fn_ty(\
ty={}, \
llsig={} -> {}, \
fn_ty={} -> {}, \
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));
}
}
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));
}
}
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));
}
}
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));
}
}
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)
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;
}
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);
}
};
- 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
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);
}
_ => {
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),
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);
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,
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
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),
-> 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()));
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")
}
}
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),
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(
FnData {llfn: PointerCast(bcx, lval, llty)}
}
_ => {
- fail2!("vtable_param left in monomorphized \
+ fail!("vtable_param left in monomorphized \
function's vtable substs");
}
}
}
}
typeck::vtable_param(*) => {
- fail2!("vtable_param left in monomorphized function's vtable substs");
+ fail!("vtable_param left in monomorphized function's vtable substs");
}
};
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
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,
}
// can't this be checked at the callee?
- _ => fail2!("vtable_id")
+ _ => fail!("vtable_id")
}
}
// 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,
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 {
ref_id: Option<ast::NodeId>)
-> (ValueRef, bool)
{
- debug2!("monomorphic_fn(\
+ debug!("monomorphic_fn(\
fn_id={}, \
real_substs={}, \
vtables={}, \
must_cast = true;
}
- debug2!("monomorphic_fn(\
+ debug!("monomorphic_fn(\
fn_id={}, \
psubsts={}, \
hash_id={:?})",
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);
}
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),
(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)
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;
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);
};
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)
}
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)| {
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(
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"),
// 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();
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();
// 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);
// 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();
// @[...] 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();
_ => {}
}
}
- heap_exchange_closure => fail2!("vectors use exchange_alloc"),
+ heap_exchange_closure => fail!("vectors use exchange_alloc"),
heap_managed | heap_managed_unique => {}
}
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,
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));
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));
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")
}
}
}
// 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) {
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:
//
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),
//! 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() {
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);
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,
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")
}
}
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")
}
}
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),
};
}
- debug2!("result = {}", tc.to_str());
+ debug!("result = {}", tc.to_str());
return tc;
// Iterates over all builtin bounds on the type parameter def, including
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));
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);
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));
}
};
- debug2!("subtypes_require({}, {})? {}",
+ debug!("subtypes_require({}, {})? {}",
::util::ppaux::ty_to_str(cx, r_ty),
::util::ppaux::ty_to_str(cx, ty),
r);
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 {
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)
}
}
}
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)
}
}
}
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)
}
}
}
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)
}
}
}
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)
}
}
}
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)
}
}
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
ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => {
return id;
}
- ast::StmtMac(*) => fail2!("unexpanded macro in trans")
+ ast::StmtMac(*) => fail!("unexpanded macro in trans")
}
}
}
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());
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, _, _),
// 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]) {
// 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;
opt_self_info: Option<&SelfInfo>,
decl: &ast::fn_decl) -> (Option<Option<ty::t>>, ty::BareFnTy)
{
- debug2!("ty_of_bare_fn");
+ debug!("ty_of_bare_fn");
// new region names that appear inside of the fn decl are bound to
// that function type
// names or they are provided, but not both.
assert!(lifetimes.is_empty() || expected_sig.is_none());
- debug2!("ty_of_fn_decl");
+ debug!("ty_of_fn_decl");
let _i = indenter();
// resolve the function bound region in the original region
fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(begin));
let e_ty =
fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(end));
- debug2!("pat_range beginning type: {:?}", b_ty);
- debug2!("pat_range ending type: {:?}", e_ty);
+ debug!("pat_range beginning type: {:?}", b_ty);
+ debug!("pat_range ending type: {:?}", e_ty);
if !require_same_types(
tcx, Some(fcx.infcx()), false, pat.span, b_ty, e_ty,
|| ~"mismatched types in range")
}
fcx.write_ty(pat.id, typ);
- debug2!("(checking match) writing type for pat id {}", pat.id);
+ debug!("(checking match) writing type for pat id {}", pat.id);
match sub {
Some(p) => check_pat(pcx, p, expected),
};
let self_ty = structurally_resolved_type(fcx, self_expr.span, self_ty);
- debug2!("method lookup(self_ty={}, expr={}, self_expr={})",
+ debug!("method lookup(self_ty={}, expr={}, self_expr={})",
self_ty.repr(fcx.tcx()), expr.repr(fcx.tcx()),
self_expr.repr(fcx.tcx()));
- debug2!("searching inherent candidates");
+ debug!("searching inherent candidates");
lcx.push_inherent_candidates(self_ty);
let mme = lcx.search(self_ty);
if mme.is_some() {
return mme;
}
- debug2!("searching extension candidates");
+ debug!("searching extension candidates");
lcx.reset_candidates();
lcx.push_bound_candidates(self_ty);
lcx.push_extension_candidates();
let mut self_ty = self_ty;
let mut autoderefs = 0;
loop {
- debug2!("loop: self_ty={} autoderefs={}",
+ debug!("loop: self_ty={} autoderefs={}",
self.ty_to_str(self_ty), autoderefs);
match self.deref_args {
fn push_inherent_candidates_from_object(&self,
did: DefId,
substs: &ty::substs) {
- debug2!("push_inherent_candidates_from_object(did={}, substs={})",
+ debug!("push_inherent_candidates_from_object(did={}, substs={})",
self.did_to_str(did),
substs_to_str(self.tcx(), substs));
let _indenter = indenter();
fn push_inherent_candidates_from_param(&self,
rcvr_ty: ty::t,
param_ty: param_ty) {
- debug2!("push_inherent_candidates_from_param(param_ty={:?})",
+ debug!("push_inherent_candidates_from_param(param_ty={:?})",
param_ty);
let _indenter = indenter();
let cand = mk_cand(bound_trait_ref, method,
pos, this_bound_idx);
- debug2!("pushing inherent candidate for param: {:?}", cand);
+ debug!("pushing inherent candidate for param: {:?}", cand);
self.inherent_candidates.push(cand);
}
None => {
- debug2!("trait doesn't contain method: {:?}",
+ debug!("trait doesn't contain method: {:?}",
bound_trait_ref.def_id);
// check next trait or bound
}
if !self.impl_dups.insert(impl_info.did) {
return; // already visited
}
- debug2!("push_candidates_from_impl: {} {} {}",
+ debug!("push_candidates_from_impl: {} {} {}",
token::interner_get(self.m_name),
impl_info.ident.repr(self.tcx()),
impl_info.methods.map(|m| m.ident).repr(self.tcx()));
match self.search_for_method(self_ty) {
None => None,
Some(mme) => {
- debug2!("(searching for autoderef'd method) writing \
+ debug!("(searching for autoderef'd method) writing \
adjustment ({}) to {}",
autoderefs,
self.self_expr.id);
fn search_for_method(&self, rcvr_ty: ty::t)
-> Option<method_map_entry> {
- debug2!("search_for_method(rcvr_ty={})", self.ty_to_str(rcvr_ty));
+ debug!("search_for_method(rcvr_ty={})", self.ty_to_str(rcvr_ty));
let _indenter = indenter();
// I am not sure that inherent methods should have higher
// priority, but it is necessary ATM to handle some of the
// existing code.
- debug2!("searching inherent candidates");
+ debug!("searching inherent candidates");
match self.consider_candidates(rcvr_ty, self.inherent_candidates) {
None => {}
Some(mme) => {
}
}
- debug2!("searching extension candidates");
+ debug!("searching extension candidates");
match self.consider_candidates(rcvr_ty, self.extension_candidates) {
None => {
return None;
let mut j = i + 1;
while j < candidates.len() {
let candidate_b = &candidates[j];
- debug2!("attempting to merge {:?} and {:?}",
+ debug!("attempting to merge {:?} and {:?}",
candidate_a, candidate_b);
let candidates_same = match (&candidate_a.origin,
&candidate_b.origin) {
let tcx = self.tcx();
let fty = ty::mk_bare_fn(tcx, candidate.method_ty.fty.clone());
- debug2!("confirm_candidate(expr={}, candidate={}, fty={})",
+ debug!("confirm_candidate(expr={}, candidate={}, fty={})",
self.expr.repr(tcx),
self.cand_to_str(candidate),
self.ty_to_str(fty));
};
// Compute the method type with type parameters substituted
- debug2!("fty={} all_substs={}",
+ debug!("fty={} all_substs={}",
self.ty_to_str(fty),
ty::substs_to_str(tcx, &all_substs));
let fty = ty::subst(tcx, &all_substs, fty);
- debug2!("after subst, fty={}", self.ty_to_str(fty));
+ debug!("after subst, fty={}", self.ty_to_str(fty));
// Replace any bound regions that appear in the function
// signature with region variables
purity: bare_fn_ty.purity,
abis: bare_fn_ty.abis.clone(),
});
- debug2!("after replacing bound regions, fty={}", self.ty_to_str(fty));
+ debug!("after replacing bound regions, fty={}", self.ty_to_str(fty));
let self_mode = get_mode_from_explicit_self(candidate.method_ty.explicit_self);
// `rcvr_ty` is the type of the expression. It may be a subtype of a
// candidate method's `self_ty`.
fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool {
- debug2!("is_relevant(rcvr_ty={}, candidate={})",
+ debug!("is_relevant(rcvr_ty={}, candidate={})",
self.ty_to_str(rcvr_ty), self.cand_to_str(candidate));
return match candidate.method_ty.explicit_self {
sty_static => {
- debug2!("(is relevant?) explicit self is static");
+ debug!("(is relevant?) explicit self is static");
false
}
}
sty_region(_, m) => {
- debug2!("(is relevant?) explicit self is a region");
+ debug!("(is relevant?) explicit self is a region");
match ty::get(rcvr_ty).sty {
ty::ty_rptr(_, mt) => {
mutability_matches(mt.mutbl, m) &&
}
sty_box(m) => {
- debug2!("(is relevant?) explicit self is a box");
+ debug!("(is relevant?) explicit self is a box");
match ty::get(rcvr_ty).sty {
ty::ty_box(mt) => {
mutability_matches(mt.mutbl, m) &&
}
sty_uniq => {
- debug2!("(is relevant?) explicit self is a unique pointer");
+ debug!("(is relevant?) explicit self is a unique pointer");
match ty::get(rcvr_ty).sty {
ty::ty_uniq(mt) => {
rcvr_matches_ty(self.fcx, mt.ty, candidate)
match self.tcx().items.find(&did.node) {
Some(&ast_map::node_method(m, _, _))
| Some(&ast_map::node_trait_method(@ast::provided(m), _, _)) => m.span,
- _ => fail2!("report_static_candidate: bad item {:?}", did)
+ _ => fail!("report_static_candidate: bad item {:?}", did)
}
} else {
self.expr.span
_ => Some(self.fcx.to_ty(&local.ty))
};
self.assign(local.id, o_ty);
- debug2!("Local variable {} is assigned type {}",
+ debug!("Local variable {} is assigned type {}",
self.fcx.pat_to_str(local.pat),
self.fcx.infcx().ty_to_str(
self.fcx.inh.locals.get_copy(&local.id)));
ast::PatIdent(_, ref path, _)
if pat_util::pat_is_binding(self.fcx.ccx.tcx.def_map, p) => {
self.assign(p.id, None);
- debug2!("Pattern binding {} is assigned to {}",
+ debug!("Pattern binding {} is assigned to {}",
self.tcx.sess.str_of(path.segments[0].identifier),
self.fcx.infcx().ty_to_str(
self.fcx.inh.locals.get_copy(&p.id)));
let arg_tys = fn_sig.inputs.map(|a| *a);
let ret_ty = fn_sig.output;
- debug2!("check_fn(arg_tys={:?}, ret_ty={:?}, opt_self_ty={:?})",
+ debug!("check_fn(arg_tys={:?}, ret_ty={:?}, opt_self_ty={:?})",
arg_tys.map(|&a| ppaux::ty_to_str(tcx, a)),
ppaux::ty_to_str(tcx, ret_ty),
opt_self_info.map(|si| ppaux::ty_to_str(tcx, si.self_ty)));
// Add the self parameter
for self_info in opt_self_info.iter() {
visit.assign(self_info.self_id, Some(self_info.self_ty));
- debug2!("self is assigned to {}",
+ debug!("self is assigned to {}",
fcx.infcx().ty_to_str(
fcx.inh.locals.get_copy(&self_info.self_id)));
}
}
pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
- debug2!("check_item(it.id={}, it.ident={})",
+ debug!("check_item(it.id={}, it.ident={})",
it.id,
ty::item_path_str(ccx.tcx, local_def(it.id)));
let _indenter = indenter();
}
ast::item_impl(_, _, _, ref ms) => {
let rp = ccx.tcx.region_paramd_items.find(&it.id).map(|x| *x);
- debug2!("item_impl {} with id {} rp {:?}",
+ debug!("item_impl {} with id {} rp {:?}",
ccx.tcx.sess.str_of(it.ident), it.id, rp);
for m in ms.iter() {
check_method(ccx, *m);
#[inline]
pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) {
- debug2!("write_ty({}, {}) in fcx {}",
+ debug!("write_ty({}, {}) in fcx {}",
node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag());
self.inh.node_types.insert(node_id, ty);
}
pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::substs) {
if !ty::substs_is_noop(&substs) {
- debug2!("write_substs({}, {}) in fcx {}",
+ debug!("write_substs({}, {}) in fcx {}",
node_id,
ty::substs_to_str(self.tcx(), &substs),
self.tag());
pub fn write_adjustment(&self,
node_id: ast::NodeId,
adj: @ty::AutoAdjustment) {
- debug2!("write_adjustment(node_id={:?}, adj={:?})", node_id, adj);
+ debug!("write_adjustment(node_id={:?}, adj={:?})", node_id, adj);
self.inh.adjustments.insert(node_id, adj);
}
expr: @ast::Expr,
expected: Option<ty::t>,
unifier: &fn()) {
- debug2!(">> typechecking");
+ debug!(">> typechecking");
fn check_method_argument_types(
fcx: @mut FnCtxt,
vec::from_elem(supplied_arg_count, ty::mk_err())
};
- debug2!("check_argument_types: formal_tys={:?}",
+ debug!("check_argument_types: formal_tys={:?}",
formal_tys.map(|t| fcx.infcx().ty_to_str(*t)));
// Check the arguments.
let xs = [false, true];
for check_blocks in xs.iter() {
let check_blocks = *check_blocks;
- debug2!("check_blocks={}", check_blocks);
+ debug!("check_blocks={}", check_blocks);
// More awful hacks: before we check the blocks, try to do
// an "opportunistic" vtable resolution of any trait
};
if is_block == check_blocks {
- debug2!("checking the argument");
+ debug!("checking the argument");
let mut formal_ty = formal_tys[i];
match deref_args {
method_map.insert(expr.id, (*entry));
}
None => {
- debug2!("(checking method call) failing expr is {}", expr.id);
+ debug!("(checking method call) failing expr is {}", expr.id);
fcx.type_error_message(expr.span,
|actual| {
ty::mk_closure(tcx, fn_ty_copy)
};
- debug2!("check_expr_fn_with_unifier fty={}",
+ debug!("check_expr_fn_with_unifier fty={}",
fcx.infcx().ty_to_str(fty));
fcx.write_ty(expr.id, fty);
// (1) verify that the class id actually has a field called
// field
- debug2!("class named {}", ppaux::ty_to_str(tcx, base_t));
+ debug!("class named {}", ppaux::ty_to_str(tcx, base_t));
let cls_items = ty::lookup_struct_fields(tcx, base_id);
match lookup_field_ty(tcx, base_id, cls_items,
field, &(*substs)) {
}
}
ast::ExprForLoop(*) =>
- fail2!("non-desugared expr_for_loop"),
+ fail!("non-desugared expr_for_loop"),
ast::ExprLoop(ref body, _) => {
check_block_no_value(fcx, (body));
if !may_break(tcx, expr.id, body) {
demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
}
// argh
- _ => fail2!("expected fn ty")
+ _ => fail!("expected fn ty")
}
fcx.write_ty(expr.id, fcx.node_ty(b.id));
}
let t_1 = fcx.to_ty(t);
let t_e = fcx.expr_ty(e);
- debug2!("t_1={}", fcx.infcx().ty_to_str(t_1));
- debug2!("t_e={}", fcx.infcx().ty_to_str(t_e));
+ debug!("t_1={}", fcx.infcx().ty_to_str(t_1));
+ debug!("t_e={}", fcx.infcx().ty_to_str(t_e));
if ty::type_is_error(t_e) {
fcx.write_error(id);
}
}
- debug2!("type of expr({}) {} is...", expr.id,
+ debug!("type of expr({}) {} is...", expr.id,
syntax::print::pprust::expr_to_str(expr, tcx.sess.intr()));
- debug2!("... {}, expected is {}",
+ debug!("... {}, expected is {}",
ppaux::ty_to_str(tcx, fcx.expr_ty(expr)),
match expected {
Some(t) => ppaux::ty_to_str(tcx, t),
match v.node.disr_expr {
Some(e) => {
- debug2!("disr expr, checking {}", pprust::expr_to_str(e, ccx.tcx.sess.intr()));
+ debug!("disr expr, checking {}", pprust::expr_to_str(e, ccx.tcx.sess.intr()));
let fcx = blank_fn_ctxt(ccx, rty, e.id);
let declty = ty::mk_int_var(ccx.tcx, fcx.infcx().next_int_var_id());
def: ast::Def,
span: Span,
node_id: ast::NodeId) {
- debug2!(">>> instantiate_path");
+ debug!(">>> instantiate_path");
let ty_param_count = tpt.generics.type_param_defs.len();
let mut ty_substs_len = 0;
ty_substs_len += segment.types.len()
}
- debug2!("tpt={} ty_param_count={:?} ty_substs_len={:?}",
+ debug!("tpt={} ty_param_count={:?} ty_substs_len={:?}",
tpt.repr(fcx.tcx()),
ty_param_count,
ty_substs_len);
};
fcx.write_ty_substs(node_id, tpt.ty, substs);
- debug2!("<<<");
+ debug!("<<<");
}
// Resolves `typ` by a single level if `typ` is a type variable. If no
span: Span,
tps: &OptVec<ast::TyParam>,
ty: ty::t) {
- debug2!("check_bounds_are_used(n_tps={}, ty={})",
+ debug!("check_bounds_are_used(n_tps={}, ty={})",
tps.len(), ppaux::ty_to_str(ccx.tcx, ty));
// make a vector of booleans initially false, set to true when used
|t| {
match ty::get(t).sty {
ty::ty_param(param_ty {idx, _}) => {
- debug2!("Found use of ty param \\#{}", idx);
+ debug!("Found use of ty param \\#{}", idx);
tps_used[idx] = true;
}
_ => ()
fn constrain_bindings_in_pat(pat: @ast::Pat, rcx: &mut Rcx) {
let tcx = rcx.fcx.tcx();
- debug2!("regionck::visit_pat(pat={})", pat.repr(tcx));
+ debug!("regionck::visit_pat(pat={})", pat.repr(tcx));
do pat_util::pat_bindings(tcx.def_map, pat) |_, id, span, _| {
// If we have a variable that contains region'd data, that
// data will be accessible from anywhere that the variable is
}
fn visit_expr(rcx: &mut Rcx, expr: @ast::Expr) {
- debug2!("regionck::visit_expr(e={}, repeating_scope={:?})",
+ debug!("regionck::visit_expr(e={}, repeating_scope={:?})",
expr.repr(rcx.fcx.tcx()), rcx.repeating_scope);
let has_method_map = rcx.fcx.inh.method_map.contains_key(&expr.id);
{
let r = rcx.fcx.inh.adjustments.find(&expr.id);
for &adjustment in r.iter() {
- debug2!("adjustment={:?}", adjustment);
+ debug!("adjustment={:?}", adjustment);
match *adjustment {
@ty::AutoDerefRef(
ty::AutoDerefRef {autoderefs: autoderefs, autoref: opt_autoref}) =>
//! appear in the arguments appropriately.
let tcx = rcx.fcx.tcx();
- debug2!("constrain_call(call_expr={}, implicitly_ref_args={:?})",
+ debug!("constrain_call(call_expr={}, implicitly_ref_args={:?})",
call_expr.repr(tcx), implicitly_ref_args);
let callee_ty = rcx.resolve_node_type(callee_id);
if ty::type_is_error(callee_ty) {
let tcx = rcx.fcx.tcx();
let r_deref_expr = ty::re_scope(deref_expr.id);
for i in range(0u, derefs) {
- debug2!("constrain_derefs(deref_expr=?, derefd_ty={}, derefs={:?}/{:?}",
+ debug!("constrain_derefs(deref_expr=?, derefd_ty={}, derefs={:?}/{:?}",
rcx.fcx.infcx().ty_to_str(derefd_ty),
i, derefs);
* includes the deref expr.
*/
- debug2!("constrain_index(index_expr=?, indexed_ty={}",
+ debug!("constrain_index(index_expr=?, indexed_ty={}",
rcx.fcx.infcx().ty_to_str(indexed_ty));
let r_index_expr = ty::re_scope(index_expr.id);
*/
let tcx = rcx.fcx.ccx.tcx;
- debug2!("constrain_free_variables({}, {})",
+ debug!("constrain_free_variables({}, {})",
region.repr(tcx), expr.repr(tcx));
for freevar in get_freevars(tcx, expr.id).iter() {
- debug2!("freevar def is {:?}", freevar.def);
+ debug!("freevar def is {:?}", freevar.def);
let def = freevar.def;
let en_region = encl_region_of_def(rcx.fcx, def);
- debug2!("en_region = {}", en_region.repr(tcx));
+ debug!("en_region = {}", en_region.repr(tcx));
rcx.fcx.mk_subr(true, infer::FreeVariable(freevar.span),
region, en_region);
}
let ty0 = rcx.resolve_node_type(id);
let adjustment = rcx.fcx.inh.adjustments.find_copy(&id);
let ty = ty::adjust_ty(tcx, origin.span(), ty0, adjustment);
- debug2!("constrain_regions_in_type_of_node(\
+ debug!("constrain_regions_in_type_of_node(\
ty={}, ty0={}, id={}, minimum_lifetime={:?}, adjustment={:?})",
ty_to_str(tcx, ty), ty_to_str(tcx, ty0),
id, minimum_lifetime, adjustment);
let e = rcx.errors_reported;
let tcx = rcx.fcx.ccx.tcx;
- debug2!("constrain_regions_in_type(minimum_lifetime={}, ty={})",
+ debug!("constrain_regions_in_type(minimum_lifetime={}, ty={})",
region_to_str(tcx, "", false, minimum_lifetime),
ty_to_str(tcx, ty));
do relate_nested_regions(tcx, Some(minimum_lifetime), ty) |r_sub, r_sup| {
- debug2!("relate(r_sub={}, r_sup={})",
+ debug!("relate(r_sub={}, r_sup={})",
region_to_str(tcx, "", false, r_sub),
region_to_str(tcx, "", false, r_sup));
* to the lifetime of its guarantor (if any).
*/
- debug2!("guarantor::for_addr_of(base=?)");
+ debug!("guarantor::for_addr_of(base=?)");
let guarantor = guarantor(rcx, base);
link(rcx, expr.span, expr.id, guarantor);
* linked to the lifetime of its guarantor (if any).
*/
- debug2!("regionck::for_match()");
+ debug!("regionck::for_match()");
let discr_guarantor = guarantor(rcx, discr);
- debug2!("discr_guarantor={}", discr_guarantor.repr(rcx.tcx()));
+ debug!("discr_guarantor={}", discr_guarantor.repr(rcx.tcx()));
for arm in arms.iter() {
for pat in arm.pats.iter() {
link_ref_bindings_in_pat(rcx, *pat, discr_guarantor);
* region pointers.
*/
- debug2!("guarantor::for_autoref(autoref={:?})", autoref);
+ debug!("guarantor::for_autoref(autoref={:?})", autoref);
let mut expr_ct = categorize_unadjusted(rcx, expr);
- debug2!(" unadjusted cat={:?}", expr_ct.cat);
+ debug!(" unadjusted cat={:?}", expr_ct.cat);
expr_ct = apply_autoderefs(
rcx, expr, autoderefs, expr_ct);
*/
let tcx = rcx.tcx();
- debug2!("guarantor::for_by_ref(expr={}, callee_scope={:?})",
+ debug!("guarantor::for_by_ref(expr={}, callee_scope={:?})",
expr.repr(tcx), callee_scope);
let expr_cat = categorize(rcx, expr);
- debug2!("guarantor::for_by_ref(expr={:?}, callee_scope={:?}) category={:?}",
+ debug!("guarantor::for_by_ref(expr={:?}, callee_scope={:?}) category={:?}",
expr.id, callee_scope, expr_cat);
let minimum_lifetime = ty::re_scope(callee_scope);
for guarantor in expr_cat.guarantor.iter() {
* to the lifetime of its guarantor (if any).
*/
- debug2!("link(id={:?}, guarantor={:?})", id, guarantor);
+ debug!("link(id={:?}, guarantor={:?})", id, guarantor);
let bound = match guarantor {
None => {
let rptr_ty = rcx.resolve_node_type(id);
if !ty::type_is_bot(rptr_ty) {
let tcx = rcx.fcx.ccx.tcx;
- debug2!("rptr_ty={}", ty_to_str(tcx, rptr_ty));
+ debug!("rptr_ty={}", ty_to_str(tcx, rptr_ty));
let r = ty::ty_region(tcx, span, rptr_ty);
rcx.fcx.mk_subr(true, infer::Reborrow(span), r, bound);
}
* `&expr`).
*/
- debug2!("guarantor()");
+ debug!("guarantor()");
match expr.node {
ast::ExprUnary(_, ast::UnDeref, b) => {
let cat = categorize(rcx, b);
rcx.fcx.tcx(), rcx.fcx.inh.method_map, expr));
None
}
- ast::ExprForLoop(*) => fail2!("non-desugared expr_for_loop"),
+ ast::ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
}
}
fn categorize(rcx: &mut Rcx, expr: @ast::Expr) -> ExprCategorization {
- debug2!("categorize()");
+ debug!("categorize()");
let mut expr_ct = categorize_unadjusted(rcx, expr);
- debug2!("before adjustments, cat={:?}", expr_ct.cat);
+ debug!("before adjustments, cat={:?}", expr_ct.cat);
match rcx.fcx.inh.adjustments.find(&expr.id) {
Some(&@ty::AutoAddEnv(*)) => {
}
Some(&@ty::AutoDerefRef(ref adjustment)) => {
- debug2!("adjustment={:?}", adjustment);
+ debug!("adjustment={:?}", adjustment);
expr_ct = apply_autoderefs(
rcx, expr, adjustment.autoderefs, expr_ct);
Some(ty::AutoUnsafe(_)) => {
expr_ct.cat.guarantor = None;
expr_ct.cat.pointer = OtherPointer;
- debug2!("autoref, cat={:?}", expr_ct.cat);
+ debug!("autoref, cat={:?}", expr_ct.cat);
}
Some(ty::AutoPtr(r, _)) |
Some(ty::AutoBorrowVec(r, _)) |
// expression will be some sort of borrowed pointer.
expr_ct.cat.guarantor = None;
expr_ct.cat.pointer = BorrowedPointer(r);
- debug2!("autoref, cat={:?}", expr_ct.cat);
+ debug!("autoref, cat={:?}", expr_ct.cat);
}
}
}
None => {}
}
- debug2!("result={:?}", expr_ct.cat);
+ debug!("result={:?}", expr_ct.cat);
return expr_ct.cat;
}
fn categorize_unadjusted(rcx: &mut Rcx,
expr: @ast::Expr)
-> ExprCategorizationType {
- debug2!("categorize_unadjusted()");
+ debug!("categorize_unadjusted()");
let guarantor = {
if rcx.fcx.inh.method_map.contains_key(&expr.id) {
}
}
- debug2!("autoderef, cat={:?}", ct.cat);
+ debug!("autoderef, cat={:?}", ct.cat);
}
return ct;
}
* other pointers.
*/
- debug2!("link_ref_bindings_in_pat(pat={}, guarantor={:?})",
+ debug!("link_ref_bindings_in_pat(pat={}, guarantor={:?})",
rcx.fcx.pat_to_str(pat), guarantor);
match pat.node {
for &t in opt_self_ty.iter() { all_tys.push(t) }
- debug2!("replace_bound_regions_in_fn_sig(self_ty={:?}, fn_sig={}, \
+ debug!("replace_bound_regions_in_fn_sig(self_ty={:?}, fn_sig={}, \
all_tys={:?})",
opt_self_ty.map(|t| ppaux::ty_to_str(tcx, t)),
ppaux::fn_sig_to_str(tcx, fn_sig),
let _i = indenter();
let isr = do create_bound_region_mapping(tcx, isr, all_tys) |br| {
- debug2!("br={:?}", br);
+ debug!("br={:?}", br);
mapf(br)
};
let new_fn_sig = ty::fold_sig(fn_sig, |t| {
});
let new_self_ty = opt_self_ty.map(|t| replace_bound_regions(tcx, isr, t));
- debug2!("result of replace_bound_regions_in_fn_sig: \
+ debug!("result of replace_bound_regions_in_fn_sig: \
new_self_ty={:?}, \
fn_sig={}",
new_self_ty.map(|t| ppaux::ty_to_str(tcx, t)),
* Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs`
*/
- debug2!("relate_free_regions >>");
+ debug!("relate_free_regions >>");
let mut all_tys = ~[];
for arg in fn_sig.inputs.iter() {
}
for &t in all_tys.iter() {
- debug2!("relate_free_regions(t={})", ppaux::ty_to_str(tcx, t));
+ debug!("relate_free_regions(t={})", ppaux::ty_to_str(tcx, t));
relate_nested_regions(tcx, None, t, |a, b| {
match (&a, &b) {
(&ty::re_free(free_a), &ty::re_free(free_b)) => {
})
}
- debug2!("<< relate_free_regions");
+ debug!("<< relate_free_regions");
}
type_param_defs: &[ty::TypeParameterDef],
substs: &ty::substs,
is_early: bool) -> vtable_res {
- debug2!("lookup_vtables(location_info={:?}, \
+ debug!("lookup_vtables(location_info={:?}, \
type_param_defs={}, \
substs={}",
location_info,
result.reverse();
assert_eq!(substs.tps.len(), result.len());
- debug2!("lookup_vtables result(\
+ debug!("lookup_vtables result(\
location_info={:?}, \
type_param_defs={}, \
substs={}, \
// Substitute the values of the type parameters that may
// appear in the bound.
let trait_ref = substs.as_ref().map_default(trait_ref, |substs| {
- debug2!("about to subst: {}, {}",
+ debug!("about to subst: {}, {}",
trait_ref.repr(tcx), substs.repr(tcx));
trait_ref.subst(tcx, *substs)
});
- debug2!("after subst: {}", trait_ref.repr(tcx));
+ debug!("after subst: {}", trait_ref.repr(tcx));
match lookup_vtable(vcx, location_info, ty, trait_ref, is_early) {
Some(vtable) => param_result.push(vtable),
true
};
- debug2!("lookup_vtables_for_param result(\
+ debug!("lookup_vtables_for_param result(\
location_info={:?}, \
type_param_bounds={}, \
ty={}, \
is_early: bool)
-> Option<vtable_origin>
{
- debug2!("lookup_vtable(ty={}, trait_ref={})",
+ debug!("lookup_vtable(ty={}, trait_ref={})",
vcx.infcx.ty_to_str(ty),
vcx.infcx.trait_ref_to_str(trait_ref));
let _i = indenter();
let mut n_bound = 0;
let mut ret = None;
do ty::each_bound_trait_and_supertraits(tcx, bounds) |bound_trait_ref| {
- debug2!("checking bounds trait {}",
+ debug!("checking bounds trait {}",
bound_trait_ref.repr(vcx.tcx()));
if bound_trait_ref.def_id == trait_ref.def_id {
bound_trait_ref,
trait_ref);
let vtable = vtable_param(param, n_bound);
- debug2!("found param vtable: {:?}",
+ debug!("found param vtable: {:?}",
vtable);
ret = Some(vtable);
false
// Now, in the previous example, for_ty is bound to
// the type self_ty, and substs is bound to [T].
- debug2!("The self ty is {} and its substs are {}",
+ debug!("The self ty is {} and its substs are {}",
vcx.infcx.ty_to_str(for_ty),
vcx.infcx.tys_to_str(substs.tps));
// some value of U) with some_trait<T>. This would fail if T
// and U weren't compatible.
- debug2!("(checking vtable) @2 relating trait \
+ debug!("(checking vtable) @2 relating trait \
ty {} to of_trait_ref {}",
vcx.infcx.trait_ref_to_str(trait_ref),
vcx.infcx.trait_ref_to_str(of_trait_ref));
}
};
- debug2!("The fixed-up substs are {} - \
+ debug!("The fixed-up substs are {} - \
they will be unified with the bounds for \
the target ty, {}",
vcx.infcx.tys_to_str(substs_f.tps),
do fixup_ty(vcx, location_info, t, is_early).map |t_f| {
match ty::get(t_f).sty {
ty::ty_trait(_, ref substs_f, _, _, _) => (*substs_f).clone(),
- _ => fail2!("t_f should be a trait")
+ _ => fail!("t_f should be a trait")
}
}
}
fn insert_vtables(fcx: @mut FnCtxt,
callee_id: ast::NodeId,
vtables: vtable_res) {
- debug2!("insert_vtables(callee_id={}, vtables={:?})",
+ debug!("insert_vtables(callee_id={}, vtables={:?})",
callee_id, vtables.repr(fcx.tcx()));
fcx.inh.vtable_map.insert(callee_id, vtables);
}
pub fn early_resolve_expr(ex: @ast::Expr,
fcx: @mut FnCtxt,
is_early: bool) {
- debug2!("vtable: early_resolve_expr() ex with id {:?} (early: {}): {}",
+ debug!("vtable: early_resolve_expr() ex with id {:?} (early: {}): {}",
ex.id, is_early, expr_to_str(ex, fcx.tcx().sess.intr()));
let _indent = indenter();
match ex.node {
ast::ExprPath(*) => {
do fcx.opt_node_ty_substs(ex.id) |substs| {
- debug2!("vtable resolution on parameter bounds for expr {}",
+ debug!("vtable resolution on parameter bounds for expr {}",
ex.repr(fcx.tcx()));
let def = cx.tcx.def_map.get_copy(&ex.id);
let did = ast_util::def_id_of_def(def);
let item_ty = ty::lookup_item_type(cx.tcx, did);
- debug2!("early resolve expr: def {:?} {:?}, {:?}, {}", ex.id, did, def,
+ debug!("early resolve expr: def {:?} {:?}, {:?}, {}", ex.id, did, def,
fcx.infcx().ty_to_str(item_ty.ty));
if has_trait_bounds(*item_ty.generics.type_param_defs) {
- debug2!("early_resolve_expr: looking up vtables for type params {}",
+ debug!("early_resolve_expr: looking up vtables for type params {}",
item_ty.generics.type_param_defs.repr(fcx.tcx()));
let vcx = VtableContext { ccx: fcx.ccx, infcx: fcx.infcx() };
let vtbls = lookup_vtables(&vcx, &location_info_for_expr(ex),
ast::ExprMethodCall(callee_id, _, _, _, _, _) => {
match ty::method_call_type_param_defs(cx.tcx, fcx.inh.method_map, ex.id) {
Some(type_param_defs) => {
- debug2!("vtable resolution on parameter bounds for method call {}",
+ debug!("vtable resolution on parameter bounds for method call {}",
ex.repr(fcx.tcx()));
if has_trait_bounds(*type_param_defs) {
let substs = fcx.node_ty_substs(callee_id);
}
}
ast::ExprCast(src, _) => {
- debug2!("vtable resolution on expr {}", ex.repr(fcx.tcx()));
+ debug!("vtable resolution on expr {}", ex.repr(fcx.tcx()));
let target_ty = fcx.expr_ty(ex);
match ty::get(target_ty).sty {
// Bounds of type's contents are not checked here, but in kind.rs.
trait_bounds: ~[trait_ref]
};
let t = ty::node_id_to_type(ccx.tcx, impl_item.id);
- debug2!("=== Doing a self lookup now.");
+ debug!("=== Doing a self lookup now.");
// Right now, we don't have any place to store this.
// We will need to make one so we can use this information
// for compiling default methods that refer to supertraits.
for t in r.iter() {
let method_map = fcx.ccx.method_map;
let new_entry = method_map_entry { self_ty: *t, ..*mme };
- debug2!("writeback::resolve_method_map_entry(id={:?}, \
+ debug!("writeback::resolve_method_map_entry(id={:?}, \
new_entry={:?})",
id, new_entry);
method_map.insert(id, new_entry);
let r_origins = resolve_origins(fcx, sp, *origins);
let vtable_map = fcx.ccx.vtable_map;
vtable_map.insert(id, r_origins);
- debug2!("writeback::resolve_vtable_map_entry(id={}, vtables={:?})",
+ debug!("writeback::resolve_vtable_map_entry(id={}, vtables={:?})",
id, r_origins.repr(fcx.tcx()));
}
}
}
Ok(r1) => {
let resolved_adj = @ty::AutoAddEnv(r1, s);
- debug2!("Adjustments for node {}: {:?}", id, resolved_adj);
+ debug!("Adjustments for node {}: {:?}", id, resolved_adj);
fcx.tcx().adjustments.insert(id, resolved_adj);
}
}
autoderefs: adj.autoderefs,
autoref: resolved_autoref,
});
- debug2!("Adjustments for node {}: {:?}", id, resolved_adj);
+ debug!("Adjustments for node {}: {:?}", id, resolved_adj);
fcx.tcx().adjustments.insert(id, resolved_adj);
}
}
}
Some(t) => {
- debug2!("resolve_type_vars_for_node(id={}, n_ty={}, t={})",
+ debug!("resolve_type_vars_for_node(id={}, n_ty={}, t={})",
id, ppaux::ty_to_str(tcx, n_ty), ppaux::ty_to_str(tcx, t));
write_ty_to_tcx(tcx, id, t);
let mut ret = Some(t);
}
resolve_type_vars_for_node(wbcx, p.span, p.id);
- debug2!("Type for pattern binding {} (id {}) resolved to {}",
+ debug!("Type for pattern binding {} (id {}) resolved to {}",
pat_to_str(p, wbcx.fcx.ccx.tcx.sess.intr()), p.id,
wbcx.fcx.infcx().ty_to_str(
ty::node_id_to_type(wbcx.fcx.ccx.tcx,
let var_ty = wbcx.fcx.local_ty(l.span, l.id);
match resolve_type(wbcx.fcx.infcx(), var_ty, resolve_all | force_all) {
Ok(lty) => {
- debug2!("Type for local {} (id {}) resolved to {}",
+ debug!("Type for local {} (id {}) resolved to {}",
pat_to_str(l.pat, wbcx.fcx.tcx().sess.intr()),
l.id,
wbcx.fcx.infcx().ty_to_str(lty));
match get(resolved_type).sty {
ty_enum(*) | ty_trait(*) | ty_struct(*) => {
- debug2!("(getting base type) found base type");
+ debug!("(getting base type) found base type");
Some(resolved_type)
}
ty_infer(*) | ty_param(*) | ty_self(*) | ty_type | ty_opaque_box |
ty_opaque_closure_ptr(*) | ty_unboxed_vec(*) | ty_err | ty_box(_) |
ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => {
- debug2!("(getting base type) no base type; found {:?}",
+ debug!("(getting base type) no base type; found {:?}",
get(original_type).sty);
None
}
return Some(def_id);
}
_ => {
- fail2!("get_base_type() returned a type that wasn't an \
+ fail!("get_base_type() returned a type that wasn't an \
enum, struct, or trait");
}
}
impl visit::Visitor<()> for CoherenceCheckVisitor {
fn visit_item(&mut self, item:@item, _:()) {
-// debug2!("(checking coherence) item '{}'",
+// debug!("(checking coherence) item '{}'",
// self.cc.crate_context.tcx.sess.str_of(item.ident));
match item.node {
// base type.
if associated_traits.len() == 0 {
- debug2!("(checking implementation) no associated traits for item \
+ debug!("(checking implementation) no associated traits for item \
'{}'",
self.crate_context.tcx.sess.str_of(item.ident));
for associated_trait in associated_traits.iter() {
let trait_ref = ty::node_id_to_trait_ref(
self.crate_context.tcx, associated_trait.ref_id);
- debug2!("(checking implementation) adding impl for trait '{}', item '{}'",
+ debug!("(checking implementation) adding impl for trait '{}', item '{}'",
trait_ref.repr(self.crate_context.tcx),
self.crate_context.tcx.sess.str_of(item.ident));
trait_ref: &ty::TraitRef,
all_methods: &mut ~[@Method]) {
let tcx = self.crate_context.tcx;
- debug2!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
+ debug!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
impl_id, trait_ref.repr(tcx));
let impl_poly_type = ty::lookup_item_type(tcx, impl_id);
let new_id = tcx.sess.next_node_id();
let new_did = local_def(new_id);
- debug2!("new_did={:?} trait_method={}", new_did, trait_method.repr(tcx));
+ debug!("new_did={:?} trait_method={}", new_did, trait_method.repr(tcx));
// Create substitutions for the various trait parameters.
let new_method_ty =
*trait_method,
Some(trait_method.def_id));
- debug2!("new_method_ty={}", new_method_ty.repr(tcx));
+ debug!("new_method_ty={}", new_method_ty.repr(tcx));
all_methods.push(new_method_ty);
// construct the polytype for the method based on the method_ty
generics: new_generics,
ty: ty::mk_bare_fn(tcx, new_method_ty.fty.clone())
};
- debug2!("new_polytype={}", new_polytype.repr(tcx));
+ debug!("new_polytype={}", new_polytype.repr(tcx));
tcx.tcache.insert(new_did, new_polytype);
tcx.methods.insert(new_did, new_method_ty);
let r = ty::trait_methods(tcx, trait_did);
for method in r.iter() {
- debug2!("checking for {}", method.ident.repr(tcx));
+ debug!("checking for {}", method.ident.repr(tcx));
if provided_names.contains(&method.ident.name) { continue; }
tcx.sess.span_err(trait_ref_span,
let substd_type_param_defs = m.generics.type_param_defs.subst(tcx, &substs);
new_type_param_defs.push_all(*substd_type_param_defs);
- debug2!("static method {} type_param_defs={} ty={}, substs={}",
+ debug!("static method {} type_param_defs={} ty={}, substs={}",
m.def_id.repr(tcx),
new_type_param_defs.repr(tcx),
ty.repr(tcx),
trait_m: &ty::Method,
trait_substs: &ty::substs,
self_ty: ty::t) {
- debug2!("compare_impl_method()");
+ debug!("compare_impl_method()");
let infcx = infer::new_infer_ctxt(tcx);
let impl_m = &cm.mty;
// that correspond to the parameters we will find on the impl
// - replace self region with a fresh, dummy region
let impl_fty = {
- debug2!("impl_fty (pre-subst): {}", ppaux::ty_to_str(tcx, impl_fty));
+ debug!("impl_fty (pre-subst): {}", ppaux::ty_to_str(tcx, impl_fty));
replace_bound_self(tcx, impl_fty, dummy_self_r)
};
- debug2!("impl_fty (post-subst): {}", ppaux::ty_to_str(tcx, impl_fty));
+ debug!("impl_fty (post-subst): {}", ppaux::ty_to_str(tcx, impl_fty));
let trait_fty = {
let num_trait_m_type_params = trait_m.generics.type_param_defs.len();
let dummy_tps = do vec::from_fn(num_trait_m_type_params) |i| {
self_ty: Some(self_ty),
tps: vec::append(trait_tps, dummy_tps)
};
- debug2!("trait_fty (pre-subst): {} substs={}",
+ debug!("trait_fty (pre-subst): {} substs={}",
trait_fty.repr(tcx), substs.repr(tcx));
ty::subst(tcx, &substs, trait_fty)
};
- debug2!("trait_fty (post-subst): {}", trait_fty.repr(tcx));
+ debug!("trait_fty (post-subst): {}", trait_fty.repr(tcx));
match infer::mk_subty(infcx, false, infer::MethodCompatCheck(cm.span),
impl_fty, trait_fty) {
pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
let tcx = ccx.tcx;
let rp = tcx.region_paramd_items.find(&it.id).map(|x| *x);
- debug2!("convert: item {} with id {} rp {:?}",
+ debug!("convert: item {} with id {} rp {:?}",
tcx.sess.str_of(it.ident), it.id, rp);
match it.node {
// These don't define types.
},
ty: ty::mk_bare_fn(ccx.tcx, tofd)
};
- debug2!("type of {} (id {}) is {}",
+ debug!("type of {} (id {}) is {}",
tcx.sess.str_of(it.ident),
it.id,
ppaux::ty_to_str(tcx, tpt.ty));
return tpt;
}
ast::item_impl(*) | ast::item_mod(_) |
- ast::item_foreign_mod(_) => fail2!(),
- ast::item_mac(*) => fail2!("item macros unimplemented")
+ ast::item_foreign_mod(_) => fail!(),
+ ast::item_mac(*) => fail!("item macros unimplemented")
}
}
def_id: local_def(param.id),
bounds: bounds
};
- debug2!("def for param: {}", def.repr(ccx.tcx));
+ debug!("def for param: {}", def.repr(ccx.tcx));
ccx.tcx.ty_param_defs.insert(param.id, def);
def
}
impl Coerce {
pub fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
- debug2!("Coerce.tys({} => {})",
+ debug!("Coerce.tys({} => {})",
a.inf_str(self.infcx),
b.inf_str(self.infcx));
let _indent = indenter();
b: ty::t,
mt_b: ty::mt)
-> CoerceResult {
- debug2!("coerce_borrowed_pointer(a={}, sty_a={:?}, b={}, mt_b={:?})",
+ debug!("coerce_borrowed_pointer(a={}, sty_a={:?}, b={}, mt_b={:?})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx), mt_b);
sty_a: &ty::sty,
b: ty::t)
-> CoerceResult {
- debug2!("coerce_borrowed_string(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_string(a={}, sty_a={:?}, b={})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx));
b: ty::t,
mt_b: ty::mt)
-> CoerceResult {
- debug2!("coerce_borrowed_vector(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_vector(a={}, sty_a={:?}, b={})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx));
b: ty::t,
b_mutbl: ast::Mutability) -> CoerceResult
{
- debug2!("coerce_borrowed_object(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_object(a={}, sty_a={:?}, b={})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx));
sty_a: &ty::sty,
b: ty::t)
-> CoerceResult {
- debug2!("coerce_borrowed_fn(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_fn(a={}, sty_a={:?}, b={})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx));
* "rust" fn`) into a closure.
*/
- debug2!("coerce_from_bare_fn(a={}, b={})",
+ debug!("coerce_from_bare_fn(a={}, b={})",
a.inf_str(self.infcx), b.inf_str(self.infcx));
if !fn_ty_a.abis.is_rust() {
b: ty::t,
mt_b: ty::mt)
-> CoerceResult {
- debug2!("coerce_unsafe_ptr(a={}, sty_a={:?}, b={})",
+ debug!("coerce_unsafe_ptr(a={}, sty_a={:?}, b={})",
a.inf_str(self.infcx), sty_a,
b.inf_str(self.infcx));
fn vstores(&self, vk: ty::terr_vstore_kind,
a: ty::vstore, b: ty::vstore) -> cres<ty::vstore> {
- debug2!("{}.vstores(a={:?}, b={:?})", self.tag(), a, b);
+ debug!("{}.vstores(a={:?}, b={:?})", self.tag(), a, b);
match (a, b) {
(ty::vstore_slice(a_r), ty::vstore_slice(b_r)) => {
b: ty::TraitStore)
-> cres<ty::TraitStore> {
- debug2!("{}.trait_stores(a={:?}, b={:?})", self.tag(), a, b);
+ debug!("{}.trait_stores(a={:?}, b={:?})", self.tag(), a, b);
match (a, b) {
(ty::RegionTraitStore(a_r), ty::RegionTraitStore(b_r)) => {
pub fn eq_regions<C:Combine>(this: &C, a: ty::Region, b: ty::Region)
-> ures {
- debug2!("eq_regions({}, {})",
+ debug!("eq_regions({}, {})",
a.inf_str(this.infcx()),
b.inf_str(this.infcx()));
let sub = this.sub();
fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
let tcx = self.infcx.tcx;
- debug2!("{}.mts({}, {})",
+ debug!("{}.mts({}, {})",
self.tag(),
mt_to_str(tcx, a),
mt_to_str(tcx, b));
}
fn regions(&self, a: ty::Region, b: ty::Region) -> cres<ty::Region> {
- debug2!("{}.regions({:?}, {:?})",
+ debug!("{}.regions({:?}, {:?})",
self.tag(),
a.inf_str(self.infcx),
b.inf_str(self.infcx));
// Note: this is a subtle algorithm. For a full explanation,
// please see the large comment in `region_inference.rs`.
- debug2!("{}.fn_sigs({:?}, {:?})",
+ debug!("{}.fn_sigs({:?}, {:?})",
self.tag(), a.inf_str(self.infcx), b.inf_str(self.infcx));
let _indenter = indenter();
// Collect constraints.
let sig0 = if_ok!(super_fn_sigs(self, &a_with_fresh, &b_with_fresh));
- debug2!("sig0 = {}", sig0.inf_str(self.infcx));
+ debug!("sig0 = {}", sig0.inf_str(self.infcx));
// Generalize the regions appearing in fn_ty0 if possible
let new_vars =
|r, _in_fn| generalize_region(self, snapshot,
new_vars, a_isr, a_vars, b_vars,
r));
- debug2!("sig1 = {}", sig1.inf_str(self.infcx));
+ debug!("sig1 = {}", sig1.inf_str(self.infcx));
return Ok(sig1);
fn generalize_region(this: &Glb,
let a_bounds = node_a.possible_types.clone();
let b_bounds = node_b.possible_types.clone();
- debug2!("vars({}={} <: {}={})",
+ debug!("vars({}={} <: {}={})",
a_id.to_str(), a_bounds.inf_str(self.infcx),
b_id.to_str(), b_bounds.inf_str(self.infcx));
let a_bounds = &node_a.possible_types;
let b_bounds = &Bounds { lb: None, ub: Some(b.clone()) };
- debug2!("var_sub_t({}={} <: {})",
+ debug!("var_sub_t({}={} <: {})",
a_id.to_str(),
a_bounds.inf_str(self.infcx),
b.inf_str(self.infcx));
let b_id = node_b.root.clone();
let b_bounds = &node_b.possible_types;
- debug2!("t_sub_var({} <: {}={})",
+ debug!("t_sub_var({} <: {}={})",
a.inf_str(self.infcx),
b_id.to_str(),
b_bounds.inf_str(self.infcx));
*
* Combines two bounds into a more general bound. */
- debug2!("merge_bnd({},{})",
+ debug!("merge_bnd({},{})",
a.inf_str(self.infcx),
b.inf_str(self.infcx));
let _r = indenter();
// A \ / A
// B
- debug2!("merge({},{},{})",
+ debug!("merge({},{},{})",
v_id.to_str(),
a.inf_str(self.infcx),
b.inf_str(self.infcx));
let ub = if_ok!(self.merge_bnd(&a.ub, &b.ub, LatticeValue::glb));
let lb = if_ok!(self.merge_bnd(&a.lb, &b.lb, LatticeValue::lub));
let bounds = Bounds { lb: lb, ub: ub };
- debug2!("merge({}): bounds={}",
+ debug!("merge({}): bounds={}",
v_id.to_str(),
bounds.inf_str(self.infcx));
a: &Bound<T>,
b: &Bound<T>)
-> ures {
- debug2!("bnds({} <: {})", a.inf_str(self.infcx),
+ debug!("bnds({} <: {})", a.inf_str(self.infcx),
b.inf_str(self.infcx));
let _r = indenter();
this: &L,
a: ty::t,
b: ty::t) -> cres<ty::t> {
- debug2!("{}.lattice_tys({}, {})", this.tag(),
+ debug!("{}.lattice_tys({}, {})", this.tag(),
a.inf_str(this.infcx()),
b.inf_str(this.infcx()));
let _r = indenter();
let a_bounds = &nde_a.possible_types;
let b_bounds = &nde_b.possible_types;
- debug2!("{}.lattice_vars({}={} <: {}={})",
+ debug!("{}.lattice_vars({}={} <: {}={})",
this.tag(),
a_vid.to_str(), a_bounds.inf_str(this.infcx()),
b_vid.to_str(), b_bounds.inf_str(this.infcx()));
// The comments in this function are written for LUB, but they
// apply equally well to GLB if you inverse upper/lower/sub/super/etc.
- debug2!("{}.lattice_var_and_t({}={} <: {})",
+ debug!("{}.lattice_var_and_t({}={} <: {})",
this.tag(),
a_id.to_str(),
a_bounds.inf_str(this.infcx()),
match this.bnd(a_bounds) {
Some(ref a_bnd) => {
// If a has an upper bound, return the LUB(a.ub, b)
- debug2!("bnd=Some({})", a_bnd.inf_str(this.infcx()));
+ debug!("bnd=Some({})", a_bnd.inf_str(this.infcx()));
lattice_dir_op(a_bnd, b)
}
None => {
// If a does not have an upper bound, make b the upper bound of a
// and then return b.
- debug2!("bnd=None");
+ debug!("bnd=None");
let a_bounds = this.with_bnd(a_bounds, (*b).clone());
do this.combine_fields().bnds(&a_bounds.lb, &a_bounds.ub).then {
this.infcx().set(a_id.clone(),
fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
let tcx = self.infcx.tcx;
- debug2!("{}.mts({}, {})",
+ debug!("{}.mts({}, {})",
self.tag(),
mt_to_str(tcx, a),
mt_to_str(tcx, b));
}
fn regions(&self, a: ty::Region, b: ty::Region) -> cres<ty::Region> {
- debug2!("{}.regions({:?}, {:?})",
+ debug!("{}.regions({:?}, {:?})",
self.tag(),
a.inf_str(self.infcx),
b.inf_str(self.infcx));
// Collect constraints.
let sig0 = if_ok!(super_fn_sigs(self, &a_with_fresh, &b_with_fresh));
- debug2!("sig0 = {}", sig0.inf_str(self.infcx));
+ debug!("sig0 = {}", sig0.inf_str(self.infcx));
// Generalize the regions appearing in sig0 if possible
let new_vars =
r0: ty::Region) -> ty::Region {
// Regions that pre-dated the LUB computation stay as they are.
if !is_var_in_set(new_vars, r0) {
- debug2!("generalize_region(r0={:?}): not new variable", r0);
+ debug!("generalize_region(r0={:?}): not new variable", r0);
return r0;
}
// *related* to regions that pre-date the LUB computation
// stay as they are.
if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) {
- debug2!("generalize_region(r0={:?}): \
+ debug!("generalize_region(r0={:?}): \
non-new-variables found in {:?}",
r0, tainted);
return r0;
do list::each(a_isr) |pair| {
let (a_br, a_r) = *pair;
if tainted.iter().any(|x| x == &a_r) {
- debug2!("generalize_region(r0={:?}): \
+ debug!("generalize_region(r0={:?}): \
replacing with {:?}, tainted={:?}",
r0, a_br, tainted);
ret = Some(ty::re_bound(a_br));
* not possible, reports an error and returns ty::err.
*/
- debug2!("common_supertype({}, {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("common_supertype({}, {})", a.inf_str(cx), b.inf_str(cx));
let trace = TypeTrace {
origin: origin,
a: ty::t,
b: ty::t)
-> ures {
- debug2!("mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.commit {
let trace = TypeTrace {
}
pub fn can_mk_subty(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures {
- debug2!("can_mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("can_mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.probe {
let trace = TypeTrace {
origin: SubregionOrigin,
a: ty::Region,
b: ty::Region) {
- debug2!("mk_subr({} <: {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("mk_subr({} <: {})", a.inf_str(cx), b.inf_str(cx));
cx.region_vars.start_snapshot();
cx.region_vars.make_subregion(origin, a, b);
cx.region_vars.commit();
a: ty::t,
b: ty::t)
-> ures {
- debug2!("mk_eqty({} <: {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("mk_eqty({} <: {})", a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.commit {
let trace = TypeTrace {
b: @ty::TraitRef)
-> ures
{
- debug2!("mk_sub_trait_refs({} <: {})",
+ debug!("mk_sub_trait_refs({} <: {})",
a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.commit {
a: ty::t,
b: ty::t)
-> CoerceResult {
- debug2!("mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.commit {
let trace = TypeTrace {
}
pub fn can_mk_coercety(cx: @mut InferCtxt, a: ty::t, b: ty::t) -> ures {
- debug2!("can_mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
+ debug!("can_mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
do indent {
do cx.probe {
let trace = TypeTrace {
}
pub fn rollback_to(&mut self, snapshot: &Snapshot) {
- debug2!("rollback!");
+ debug!("rollback!");
rollback_to(&mut self.ty_var_bindings, snapshot.ty_var_bindings_len);
rollback_to(&mut self.int_var_bindings,
pub fn commit<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
assert!(!self.in_snapshot());
- debug2!("commit()");
+ debug!("commit()");
do indent {
let r = self.try(|| f());
/// Execute `f`, unroll bindings on failure
pub fn try<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
- debug2!("try()");
+ debug!("try()");
do indent {
let snapshot = self.start_snapshot();
let r = f();
/// Execute `f` then unroll any bindings it creates
pub fn probe<T,E>(@mut self, f: &fn() -> Result<T,E>) -> Result<T,E> {
- debug2!("probe()");
+ debug!("probe()");
do indent {
let snapshot = self.start_snapshot();
let r = f();
expected_ty: Option<ty::t>,
actual_ty: ~str,
err: Option<&ty::type_err>) {
- debug2!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty);
+ debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty);
let error_str = do err.map_default(~"") |t_err| {
format!(" ({})", ty::type_err_to_str(self.tcx, t_err))
replace_bound_regions_in_fn_sig(self.tcx, @Nil, None, fsig, |br| {
let rvar = self.next_region_var(
BoundRegionInFnType(trace.origin.span(), br));
- debug2!("Bound region {} maps to {:?}",
+ debug!("Bound region {} maps to {:?}",
bound_region_to_str(self.tcx, "", false, br),
rvar);
rvar
}
pub fn start_snapshot(&mut self) -> uint {
- debug2!("RegionVarBindings: snapshot()={}", self.undo_log.len());
+ debug!("RegionVarBindings: snapshot()={}", self.undo_log.len());
if self.in_snapshot() {
self.undo_log.len()
} else {
}
pub fn commit(&mut self) {
- debug2!("RegionVarBindings: commit()");
+ debug!("RegionVarBindings: commit()");
while self.undo_log.len() > 0 {
self.undo_log.pop();
}
}
pub fn rollback_to(&mut self, snapshot: uint) {
- debug2!("RegionVarBindings: rollback_to({})", snapshot);
+ debug!("RegionVarBindings: rollback_to({})", snapshot);
while self.undo_log.len() > snapshot {
let undo_item = self.undo_log.pop();
- debug2!("undo_item={:?}", undo_item);
+ debug!("undo_item={:?}", undo_item);
match undo_item {
Snapshot => {}
AddVar(vid) => {
if self.in_snapshot() {
self.undo_log.push(AddVar(vid));
}
- debug2!("created new region variable {:?} with origin {:?}",
+ debug!("created new region variable {:?} with origin {:?}",
vid, origin.repr(self.tcx));
return vid;
}
// cannot add constraints once regions are resolved
assert!(self.values.is_empty());
- debug2!("RegionVarBindings: add_constraint({:?})", constraint);
+ debug!("RegionVarBindings: add_constraint({:?})", constraint);
if self.constraints.insert(constraint, origin) {
if self.in_snapshot() {
// cannot add constraints once regions are resolved
assert!(self.values.is_empty());
- debug2!("RegionVarBindings: make_subregion({:?}, {:?})", sub, sup);
+ debug!("RegionVarBindings: make_subregion({:?}, {:?})", sub, sup);
match (sub, sup) {
(re_infer(ReVar(sub_id)), re_infer(ReVar(sup_id))) => {
self.add_constraint(ConstrainVarSubVar(sub_id, sup_id), origin);
// cannot add constraints once regions are resolved
assert!(self.values.is_empty());
- debug2!("RegionVarBindings: lub_regions({:?}, {:?})", a, b);
+ debug!("RegionVarBindings: lub_regions({:?}, {:?})", a, b);
match (a, b) {
(re_static, _) | (_, re_static) => {
re_static // nothing lives longer than static
// cannot add constraints once regions are resolved
assert!(self.values.is_empty());
- debug2!("RegionVarBindings: glb_regions({:?}, {:?})", a, b);
+ debug!("RegionVarBindings: glb_regions({:?}, {:?})", a, b);
match (a, b) {
(re_static, r) | (r, re_static) => {
// static lives longer than everything else
}
let v = self.values.with_ref(|values| values[rid.to_uint()]);
- debug2!("RegionVarBindings: resolve_var({:?}={})={:?}",
+ debug!("RegionVarBindings: resolve_var({:?}={})={:?}",
rid, rid.to_uint(), v);
match v {
Value(r) => r,
}
relate(self, a, re_infer(ReVar(c)));
relate(self, b, re_infer(ReVar(c)));
- debug2!("combine_vars() c={:?}", c);
+ debug!("combine_vars() c={:?}", c);
re_infer(ReVar(c))
}
* regions.
*/
- debug2!("tainted(snapshot={}, r0={:?})", snapshot, r0);
+ debug!("tainted(snapshot={}, r0={:?})", snapshot, r0);
let _indenter = indenter();
let undo_len = self.undo_log.len();
// nb: can't use uint::range() here because result_set grows
let r = result_set[result_index];
- debug2!("result_index={}, r={:?}", result_index, r);
+ debug!("result_index={}, r={:?}", result_index, r);
let mut undo_index = snapshot;
while undo_index < undo_len {
errors are reported.
*/
pub fn resolve_regions(&mut self) -> OptVec<RegionResolutionError> {
- debug2!("RegionVarBindings: resolve_regions()");
+ debug!("RegionVarBindings: resolve_regions()");
let mut errors = opt_vec::Empty;
let v = self.infer_variable_values(&mut errors);
self.values.put_back(v);
a: Region,
b: Region)
-> cres<Region> {
- debug2!("glb_concrete_regions({:?}, {:?})", a, b);
+ debug!("glb_concrete_regions({:?}, {:?})", a, b);
match (a, b) {
(re_static, r) | (r, re_static) => {
// static lives longer than everything else
// scopes or two free regions. So, if one of
// these scopes is a subscope of the other, return
// it. Otherwise fail.
- debug2!("intersect_scopes(scope_a={:?}, scope_b={:?}, region_a={:?}, region_b={:?})",
+ debug!("intersect_scopes(scope_a={:?}, scope_b={:?}, region_a={:?}, region_b={:?})",
scope_a, scope_b, region_a, region_b);
let rm = self.tcx.region_maps;
match rm.nearest_common_ancestor(scope_a, scope_b) {
b_vid: RegionVid,
b_data: &mut VarData)
-> bool {
- debug2!("expand_node({:?}, {:?} == {:?})",
+ debug!("expand_node({:?}, {:?} == {:?})",
a_region, b_vid, b_data.value);
b_data.classification = Expanding;
match b_data.value {
NoValue => {
- debug2!("Setting initial value of {:?} to {:?}", b_vid, a_region);
+ debug!("Setting initial value of {:?} to {:?}", b_vid, a_region);
b_data.value = Value(a_region);
return true;
return false;
}
- debug2!("Expanding value of {:?} from {:?} to {:?}",
+ debug!("Expanding value of {:?} from {:?} to {:?}",
b_vid, cur_region, lub);
b_data.value = Value(lub);
a_data: &mut VarData,
b_region: Region)
-> bool {
- debug2!("contract_node({:?} == {:?}/{:?}, {:?})",
+ debug!("contract_node({:?} == {:?}/{:?}, {:?})",
a_vid, a_data.value, a_data.classification, b_region);
return match a_data.value {
b_region: Region)
-> bool {
if !this.is_subregion_of(a_region, b_region) {
- debug2!("Setting {:?} to ErrorValue: {:?} not subregion of {:?}",
+ debug!("Setting {:?} to ErrorValue: {:?} not subregion of {:?}",
a_vid, a_region, b_region);
a_data.value = ErrorValue;
}
if glb == a_region {
false
} else {
- debug2!("Contracting value of {:?} from {:?} to {:?}",
+ debug!("Contracting value of {:?} from {:?} to {:?}",
a_vid, a_region, glb);
a_data.value = Value(glb);
true
}
}
Err(_) => {
- debug2!("Setting {:?} to ErrorValue: no glb of {:?}, {:?}",
+ debug!("Setting {:?} to ErrorValue: no glb of {:?}, {:?}",
a_vid, a_region, b_region);
a_data.value = ErrorValue;
false
continue;
}
- debug2!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}",
+ debug!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}",
sub, sup);
let origin = self.constraints.get_copy(constraint);
errors.push(ConcreteFailure(origin, sub, sup));
errors: &mut OptVec<RegionResolutionError>)
-> ~[VarValue]
{
- debug2!("extract_values_and_collect_conflicts()");
+ debug!("extract_values_and_collect_conflicts()");
// This is the best way that I have found to suppress
// duplicate and related errors. Basically we keep a set of
state.dup_found = true;
}
- debug2!("collect_concrete_regions(orig_node_idx={:?}, node_idx={:?}, \
+ debug!("collect_concrete_regions(orig_node_idx={:?}, node_idx={:?}, \
classification={:?})",
orig_node_idx, node_idx, classification);
graph: &RegionGraph,
source_vid: RegionVid,
dir: Direction) {
- debug2!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
+ debug!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
let source_node_index = NodeIndex(source_vid.to_uint());
do graph.each_adjacent_edge(source_node_index, dir) |_, edge| {
while changed {
changed = false;
iteration += 1;
- debug2!("---- {} Iteration \\#{}", tag, iteration);
+ debug!("---- {} Iteration \\#{}", tag, iteration);
for (constraint, _) in self.constraints.iter() {
let edge_changed = body(constraint);
if edge_changed {
- debug2!("Updated due to constraint {}",
+ debug!("Updated due to constraint {}",
constraint.repr(self.tcx));
changed = true;
}
}
}
- debug2!("---- {} Complete after {} iteration(s)", tag, iteration);
+ debug!("---- {} Complete after {} iteration(s)", tag, iteration);
}
}
pub fn resolve_type_chk(&mut self, typ: ty::t) -> fres<ty::t> {
self.err = None;
- debug2!("Resolving {} (modes={:x})",
+ debug!("Resolving {} (modes={:x})",
ty_to_str(self.infcx.tcx, typ),
self.modes);
assert!(self.v_seen.is_empty());
match self.err {
None => {
- debug2!("Resolved to {} + {} (modes={:x})",
+ debug!("Resolved to {} + {} (modes={:x})",
ty_to_str(self.infcx.tcx, rty),
ty_to_str(self.infcx.tcx, rty),
self.modes);
}
pub fn resolve_type(&mut self, typ: ty::t) -> ty::t {
- debug2!("resolve_type({})", typ.inf_str(self.infcx));
+ debug!("resolve_type({})", typ.inf_str(self.infcx));
let _i = indenter();
if !ty::type_needs_infer(typ) {
}
pub fn resolve_region(&mut self, orig: ty::Region) -> ty::Region {
- debug2!("Resolve_region({})", orig.inf_str(self.infcx));
+ debug!("Resolve_region({})", orig.inf_str(self.infcx));
match orig {
ty::re_infer(ty::ReVar(rid)) => self.resolve_region_var(rid),
_ => orig
}
fn regions(&self, a: ty::Region, b: ty::Region) -> cres<ty::Region> {
- debug2!("{}.regions({}, {})",
+ debug!("{}.regions({}, {})",
self.tag(),
a.inf_str(self.infcx),
b.inf_str(self.infcx));
}
fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
- debug2!("mts({} <: {})", a.inf_str(self.infcx), b.inf_str(self.infcx));
+ debug!("mts({} <: {})", a.inf_str(self.infcx), b.inf_str(self.infcx));
if a.mutbl != b.mutbl {
return Err(ty::terr_mutability);
}
fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
- debug2!("{}.tys({}, {})", self.tag(),
+ debug!("{}.tys({}, {})", self.tag(),
a.inf_str(self.infcx), b.inf_str(self.infcx));
if a == b { return Ok(a); }
let _indenter = indenter();
}
fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
- debug2!("fn_sigs(a={}, b={})",
+ debug!("fn_sigs(a={}, b={})",
a.inf_str(self.infcx), b.inf_str(self.infcx));
let _indenter = indenter();
do replace_bound_regions_in_fn_sig(self.infcx.tcx, @Nil,
None, b) |br| {
let skol = self.infcx.region_vars.new_skolemized(br);
- debug2!("Bound region {} skolemized to {:?}",
+ debug!("Bound region {} skolemized to {:?}",
bound_region_to_str(self.infcx.tcx, "", false, br),
skol);
skol
}
};
- debug2!("a_sig={}", a_sig.inf_str(self.infcx));
- debug2!("b_sig={}", b_sig.inf_str(self.infcx));
+ debug!("a_sig={}", a_sig.inf_str(self.infcx));
+ debug!("b_sig={}", b_sig.inf_str(self.infcx));
// Compare types now that bound regions have been replaced.
let sig = if_ok!(super_fn_sigs(self, &a_sig, &b_sig));
return match search_mod(self, &self.crate.node.module, 0, names) {
Some(id) => id,
None => {
- fail2!("No item found: `%s`", names.connect("::"));
+ fail!("No item found: `%s`", names.connect("::"));
}
};
pub fn assert_subtype(&self, a: ty::t, b: ty::t) {
if !self.is_subtype(a, b) {
- fail2!("%s is not a subtype of %s, but it should be",
+ fail!("%s is not a subtype of %s, but it should be",
self.ty_to_str(a),
self.ty_to_str(b));
}
pub fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
if self.is_subtype(a, b) {
- fail2!("%s is a subtype of %s, but it shouldn't be",
+ fail!("%s is a subtype of %s, but it shouldn't be",
self.ty_to_str(a),
self.ty_to_str(b));
}
pub fn glb() -> Glb { Glb(self.infcx.combine_fields(true, dummy_sp())) }
pub fn resolve_regions(exp_count: uint) {
- debug2!("resolve_regions(%u)", exp_count);
+ debug!("resolve_regions(%u)", exp_count);
self.infcx.resolve_regions();
if self.err_messages.len() != exp_count {
for msg in self.err_messages.iter() {
- debug2!("Error encountered: %s", *msg);
+ debug!("Error encountered: %s", *msg);
}
format!("Resolving regions encountered %u errors but expected %u!",
self.err_messages.len(),
pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
match self.lub().tys(t1, t2) {
Err(e) => {
- fail2!("Unexpected error computing LUB: %?", e)
+ fail!("Unexpected error computing LUB: %?", e)
}
Ok(t) => {
self.assert_eq(t, t_lub);
/// Checks that `GLB(t1,t2) == t_glb`
pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
- debug2!("check_glb(t1=%s, t2=%s, t_glb=%s)",
+ debug!("check_glb(t1=%s, t2=%s, t_glb=%s)",
self.ty_to_str(t1),
self.ty_to_str(t2),
self.ty_to_str(t_glb));
match self.glb().tys(t1, t2) {
Err(e) => {
- fail2!("Unexpected error computing LUB: %?", e)
+ fail!("Unexpected error computing LUB: %?", e)
}
Ok(t) => {
self.assert_eq(t, t_glb);
match self.lub().tys(t1, t2) {
Err(_) => {}
Ok(t) => {
- fail2!("Unexpected success computing LUB: %?", self.ty_to_str(t))
+ fail!("Unexpected success computing LUB: %?", self.ty_to_str(t))
}
}
}
match self.glb().tys(t1, t2) {
Err(_) => {}
Ok(t) => {
- fail2!("Unexpected success computing GLB: %?", self.ty_to_str(t))
+ fail!("Unexpected success computing GLB: %?", self.ty_to_str(t))
}
}
}
* Sets the value for `vid` to `new_v`. `vid` MUST be a root node!
*/
- debug2!("Updating variable {} to {}",
+ debug!("Updating variable {} to {}",
vid.to_str(), new_v.inf_str(self));
let vb = UnifyVid::appropriate_vals_and_bindings(self);
// Rank optimization: if you don't know what it is, check
// out <http://en.wikipedia.org/wiki/Disjoint-set_data_structure>
- debug2!("unify(node_a(id={:?}, rank={:?}), \
+ debug!("unify(node_a(id={:?}, rank={:?}), \
node_b(id={:?}, rank={:?}))",
node_a.root, node_a.rank,
node_b.root, node_b.rank);
// Functions that write types into the node type table
pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::NodeId, ty: ty::t) {
- debug2!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_str(tcx, ty));
+ debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_str(tcx, ty));
assert!(!ty::type_needs_infer(ty));
tcx.node_types.insert(node_id as uint, ty);
}
node_id: ast::NodeId,
substs: ~[ty::t]) {
if substs.len() > 0u {
- debug2!("write_substs_to_tcx({}, {:?})", node_id,
+ debug!("write_substs_to_tcx({}, {:?})", node_id,
substs.map(|t| ppaux::ty_to_str(tcx, *t)));
assert!(substs.iter().all(|t| !ty::type_needs_infer(*t)));
tcx.node_type_substs.insert(node_id, substs);
None => {
// if the self region is used, region parameterization should
// have inferred that this type is RP
- fail2!("region parameterization should have inferred that \
+ fail!("region parameterization should have inferred that \
this type is RP");
}
Some(ref region_parameterization) => {
}
}
// Fail so the process returns a failure code
- fail2!();
+ fail!();
}
}
}
pub fn indent<R>(op: &fn() -> R) -> R {
// Use in conjunction with the log post-processor like `src/etc/indenter`
// to make debug output more readable.
- debug2!(">>");
+ debug!(">>");
let r = op();
- debug2!("<< (Result = {:?})", r);
+ debug!("<< (Result = {:?})", r);
r
}
}
impl Drop for _indenter {
- fn drop(&mut self) { debug2!("<<"); }
+ fn drop(&mut self) { debug!("<<"); }
}
pub fn _indenter(_i: ()) -> _indenter {
}
pub fn indenter() -> _indenter {
- debug2!(">>");
+ debug!(">>");
_indenter(())
}
Crate {
name: match maybe_meta {
Some(x) => x.to_owned(),
- None => fail2!("rustdoc requires a \\#[link(name=\"foo\")] \
+ None => fail!("rustdoc requires a \\#[link(name=\"foo\")] \
crate attribute"),
},
module: Some(self.module.clean()),
impl Clean<Type> for ast::Ty {
fn clean(&self) -> Type {
use syntax::ast::*;
- debug2!("cleaning type `{:?}`", self);
+ debug!("cleaning type `{:?}`", self);
let codemap = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap;
- debug2!("span corresponds to `{}`", codemap.span_to_str(self.span));
+ debug!("span corresponds to `{}`", codemap.span_to_str(self.span));
match self.node {
ty_nil => Unit,
ty_ptr(ref m) => RawPointer(m.mutbl.clean(), ~m.ty.clean()),
ty_closure(ref c) => Closure(~c.clean()),
ty_bare_fn(ref barefn) => BareFunction(~barefn.clean()),
ty_bot => Bottom,
- ref x => fail2!("Unimplemented type {:?}", x),
+ ref x => fail!("Unimplemented type {:?}", x),
}
}
}
impl Clean<Item> for doctree::Static {
fn clean(&self) -> Item {
- debug2!("claning static {}: {:?}", self.name.clean(), self);
+ debug!("claning static {}: {:?}", self.name.clean(), self);
Item {
name: Some(self.name.clean()),
attrs: self.attrs.clean(),
impl ToSource for syntax::codemap::Span {
fn to_src(&self) -> ~str {
- debug2!("converting span {:?} to snippet", self.clean());
+ debug!("converting span {:?} to snippet", self.clean());
let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap.clone();
let sn = match cm.span_to_snippet(*self) {
Some(x) => x,
None => ~""
};
- debug2!("got snippet {}", sn);
+ debug!("got snippet {}", sn);
sn
}
}
PatWild => ~"_",
PatIdent(_, ref p, _) => path_to_str(p),
PatEnum(ref p, _) => path_to_str(p),
- PatStruct(*) => fail2!("tried to get argument name from pat_struct, \
+ PatStruct(*) => fail!("tried to get argument name from pat_struct, \
which is not allowed in function arguments"),
PatTup(*) => ~"(tuple arg NYI)",
PatBox(p) => name_from_pat(p),
PatUniq(p) => name_from_pat(p),
PatRegion(p) => name_from_pat(p),
- PatLit(*) => fail2!("tried to get argument name from pat_lit, \
+ PatLit(*) => fail!("tried to get argument name from pat_lit, \
which is not allowed in function arguments"),
- PatRange(*) => fail2!("tried to get argument name from pat_range, \
+ PatRange(*) => fail!("tried to get argument name from pat_range, \
which is not allowed in function arguments"),
- PatVec(*) => fail2!("tried to get argument name from pat_vec, \
+ PatVec(*) => fail!("tried to get argument name from pat_vec, \
which is not allowed in function arguments")
}
}
fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
id: ast::NodeId) -> Type {
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
- debug2!("searching for {:?} in defmap", id);
+ debug!("searching for {:?} in defmap", id);
let d = match cx.tycx.def_map.find(&id) {
Some(k) => k,
None => {
let ctxt = local_data::get(super::ctxtkey, |x| *x.unwrap());
- debug2!("could not find {:?} in defmap (`{}`)", id,
+ debug!("could not find {:?} in defmap (`{}`)", id,
syntax::ast_map::node_id_to_str(ctxt.tycx.items, id, ctxt.sess.intr()));
- fail2!("Unexpected failure: unresolved id not in defmap (this is a bug!)")
+ fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)")
}
};
ast::DefSelf(i) | ast::DefSelfTy(i) => return Self(i),
ast::DefTy(i) => (i, TypeEnum),
ast::DefTrait(i) => {
- debug2!("saw DefTrait in def_to_id");
+ debug!("saw DefTrait in def_to_id");
(i, TypeTrait)
},
ast::DefPrimTy(p) => match p {
ast::DefTyParam(i, _) => return Generic(i.node),
ast::DefStruct(i) => (i, TypeStruct),
ast::DefTyParamBinder(i) => {
- debug2!("found a typaram_binder, what is it? {}", i);
+ debug!("found a typaram_binder, what is it? {}", i);
return TyParamBinder(i);
},
- x => fail2!("resolved type maps to a weird def {:?}", x),
+ x => fail!("resolved type maps to a weird def {:?}", x),
};
if ast_util::is_local(def_id) {
ResolvedPath{ path: path, typarams: tpbs, id: def_id.node }
.to_owned_vec());
}
- debug2!("crate: {:?}", crate);
+ debug!("crate: {:?}", crate);
return (DocContext { crate: crate, tycx: ty_cx, sess: sess },
CrateAnalysis { reexports: reexports, exported_items: exported_items });
}
pub fn run_core (libs: ~[Path], path: &Path) -> (clean::Crate, CrateAnalysis) {
let (ctxt, analysis) = get_ast_and_resolve(path, libs);
let ctxt = @ctxt;
- debug2!("defmap:");
+ debug!("defmap:");
for (k, v) in ctxt.tycx.def_map.iter() {
- debug2!("{:?}: {:?}", k, v);
+ debug!("{:?}: {:?}", k, v);
}
local_data::set(super::ctxtkey, ctxt);
// Render all source files (this may turn into a giant no-op)
{
- info2!("emitting source files");
+ info!("emitting source files");
let dst = cx.dst.join("src");
mkdir(&dst);
let dst = dst.join(crate.name.as_slice());
/// skipping if the directory already exists.
fn mkdir(path: &Path) {
do io::io_error::cond.trap(|err| {
- error2!("Couldn't create directory `{}`: {}",
+ error!("Couldn't create directory `{}`: {}",
path.display(), err.desc);
- fail2!()
+ fail!()
}).inside {
if !path.is_dir() {
file::mkdir(path);
/// sure it always points to the top (relatively)
fn recurse<T>(&mut self, s: ~str, f: &fn(&mut Context) -> T) -> T {
if s.len() == 0 {
- fail2!("what {:?}", self);
+ fail!("what {:?}", self);
}
let prev = self.dst.clone();
self.dst.push(s.as_slice());
let workers = match os::getenv("RUSTDOC_WORKERS") {
Some(s) => {
match from_str::<uint>(s) {
- Some(n) => n, None => fail2!("{} not a number", s)
+ Some(n) => n, None => fail!("{} not a number", s)
}
}
None => 10,
fn item_module(w: &mut io::Writer, cx: &Context,
item: &clean::Item, items: &[clean::Item]) {
document(w, item);
- debug2!("{:?}", items);
+ debug!("{:?}", items);
let mut indices = vec::from_fn(items.len(), |i| i);
fn lt(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> bool {
}
}
- debug2!("{:?}", indices);
+ debug!("{:?}", indices);
do sort::quick_sort(indices) |&i1, &i2| {
lt(&items[i1], &items[i2], i1, i2)
}
- debug2!("{:?}", indices);
+ debug!("{:?}", indices);
let mut curty = "";
for &idx in indices.iter() {
let myitem = &items[idx];
for innerattr in l.iter() {
match innerattr {
&clean::Word(ref s) if "hidden" == *s => {
- debug2!("found one in strip_hidden; removing");
+ debug!("found one in strip_hidden; removing");
return None;
},
_ => (),
}
};
- info2!("going to format");
+ info!("going to format");
let started = time::precise_time_ns();
let output = matches.opt_str("o").map(|s| Path::new(s));
match matches.opt_str("w") {
}
}
let ended = time::precise_time_ns();
- info2!("Took {:.03f}s", (ended as f64 - started as f64) / 1e9f64);
+ info!("Took {:.03f}s", (ended as f64 - started as f64) / 1e9f64);
return 0;
}
// First, parse the crate and extract all relevant information.
let libs = Cell::new(matches.opt_strs("L").map(|s| Path::new(s.as_slice())));
let cr = Cell::new(Path::new(cratefile));
- info2!("starting to run rustc");
+ info!("starting to run rustc");
let (crate, analysis) = do std::task::try {
let cr = cr.take();
core::run_core(libs.take(), &cr)
}.unwrap();
- info2!("finished with rustc");
+ info!("finished with rustc");
local_data::set(analysiskey, analysis);
// Process all of the crate attributes, extracting plugin metadata along
let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {
Some(i) => PASSES[i].n1(),
None => {
- error2!("unknown pass {}, skipping", *pass);
+ error!("unknown pass {}, skipping", *pass);
continue
},
};
pm.add_plugin(plugin);
}
- info2!("loading plugins...");
+ info!("loading plugins...");
for pname in plugins.move_iter() {
pm.load_plugin(pname);
}
// Run everything!
- info2!("Executing passes/plugins");
+ info!("Executing passes/plugins");
return pm.run_plugins(crate);
}
};
let crate_json = match json::from_str(crate_json_str) {
Ok(j) => j,
- Err(_) => fail2!("Rust generated JSON is invalid??")
+ Err(_) => fail!("Rust generated JSON is invalid??")
};
json.insert(~"crate", crate_json);
self.attrs = crate.attrs.clone();
fn visit_struct_def(item: &ast::item, sd: @ast::struct_def, generics:
&ast::Generics) -> Struct {
- debug2!("Visiting struct");
+ debug!("Visiting struct");
let struct_type = struct_type_from_def(sd);
Struct {
id: item.id,
}
fn visit_enum_def(it: &ast::item, def: &ast::enum_def, params: &ast::Generics) -> Enum {
- debug2!("Visiting enum");
+ debug!("Visiting enum");
let mut vars: ~[Variant] = ~[];
for x in def.variants.iter() {
vars.push(Variant {
fn visit_fn(item: &ast::item, fd: &ast::fn_decl, purity: &ast::purity,
_abi: &AbiSet, gen: &ast::Generics) -> Function {
- debug2!("Visiting fn");
+ debug!("Visiting fn");
Function {
id: item.id,
vis: item.vis,
let name = match am.find(&id) {
Some(m) => match m {
&ast_map::node_item(ref it, _) => Some(it.ident),
- _ => fail2!("mod id mapped to non-item in the ast map")
+ _ => fail!("mod id mapped to non-item in the ast map")
},
None => None
};
}
fn visit_item(item: &ast::item, om: &mut Module) {
- debug2!("Visiting item {:?}", item);
+ debug!("Visiting item {:?}", item);
match item.node {
ast::item_mod(ref m) => {
om.mods.push(visit_mod_contents(item.span, item.attrs.clone(),
pub fn new_workcache_context(p: &Path) -> workcache::Context {
let db_file = p.join("rustpkg_db.json"); // ??? probably wrong
- debug2!("Workcache database file: {}", db_file.display());
+ debug!("Workcache database file: {}", db_file.display());
let db = RWArc::new(Database::new(db_file));
let lg = RWArc::new(Logger::new());
let cfg = Arc::new(TreeMap::new());
/// rustpkg from a Rust target directory. This is part of a
/// kludgy hack used to adjust the sysroot.
pub fn in_target(sysroot: &Path) -> bool {
- debug2!("Checking whether {} is in target", sysroot.display());
+ debug!("Checking whether {} is in target", sysroot.display());
let mut p = sysroot.dir_path();
p.set_filename("rustc");
os::path_is_dir(&p)
}
let libfiles = os::list_dir(&p.join("lib"));
for lib in libfiles.iter() {
- debug2!("Full name: {}", lib.display());
+ debug!("Full name: {}", lib.display());
match has_library(lib) {
Some(basename) => {
let parent = p.join("lib");
- debug2!("parent = {}, child = {}",
+ debug!("parent = {}, child = {}",
parent.display(), lib.display());
let rel_p = lib.path_relative_from(&parent).unwrap();
- debug2!("Rel: {}", rel_p.display());
+ debug!("Rel: {}", rel_p.display());
let rel_path = rel_p.join(basename);
do rel_path.display().with_str |s| {
- debug2!("Rel name: {}", s);
+ debug!("Rel name: {}", s);
f(&PkgId::new(s));
}
}
id: PkgId) -> PkgSrc {
use conditions::nonexistent_package::cond;
- debug2!("Checking package source for package ID {}, \
+ debug!("Checking package source for package ID {}, \
workspace = {} -> {}, use_rust_path_hack = {:?}",
id.to_str(),
source_workspace.display(),
}
- debug2!("Checking dirs: {:?}", to_try.map(|p| p.display().to_str()).connect(":"));
+ debug!("Checking dirs: {:?}", to_try.map(|p| p.display().to_str()).connect(":"));
let path = to_try.iter().find(|&d| os::path_exists(d));
// See the comments on the definition of PkgSrc
let mut build_in_destination = use_rust_path_hack;
- debug2!("1. build_in_destination = {:?}", build_in_destination);
+ debug!("1. build_in_destination = {:?}", build_in_destination);
let dir: Path = match path {
Some(d) => (*d).clone(),
for (prefix, suffix) in id.prefixes_iter() {
let package_id = PkgId::new(prefix.as_str().unwrap());
let path = build_dir.join(&package_id.path);
- debug2!("in loop: checking if {} is a directory", path.display());
+ debug!("in loop: checking if {} is a directory", path.display());
if os::path_is_dir(&path) {
let ps = PkgSrc::new(source_workspace,
destination_workspace,
tests: ~[],
benchs: ~[]
};
- debug2!("pkgsrc: Returning {}", result.to_str());
+ debug!("pkgsrc: Returning {}", result.to_str());
return result;
}
}
// Ok, no prefixes work, so try fetching from git
let mut ok_d = None;
for w in output_names.iter() {
- debug2!("Calling fetch_git on {}", w.display());
+ debug!("Calling fetch_git on {}", w.display());
let target_dir_opt = PkgSrc::fetch_git(w, &id);
for p in target_dir_opt.iter() {
ok_d = Some(p.clone());
build_in_destination = true;
- debug2!("2. build_in_destination = {:?}", build_in_destination);
+ debug!("2. build_in_destination = {:?}", build_in_destination);
break;
}
match ok_d {
}
}
};
- debug2!("3. build_in_destination = {:?}", build_in_destination);
- debug2!("source: {} dest: {}", source_workspace.display(), destination_workspace.display());
+ debug!("3. build_in_destination = {:?}", build_in_destination);
+ debug!("source: {} dest: {}", source_workspace.display(), destination_workspace.display());
- debug2!("For package id {}, returning {}", id.to_str(), dir.display());
+ debug!("For package id {}, returning {}", id.to_str(), dir.display());
if !os::path_is_dir(&dir) {
cond.raise((id.clone(), ~"supplied path for package dir is a \
use conditions::git_checkout_failed::cond;
let cwd = os::getcwd();
- debug2!("Checking whether {} (path = {}) exists locally. Cwd = {}, does it? {:?}",
+ debug!("Checking whether {} (path = {}) exists locally. Cwd = {}, does it? {:?}",
pkgid.to_str(), pkgid.path.display(),
cwd.display(),
os::path_exists(&pkgid.path));
// FIXME (#9639): This needs to handle non-utf8 paths
let url = format!("https://{}", pkgid.path.as_str().unwrap());
- debug2!("Fetching package: git clone {} {} [version={}]",
+ debug!("Fetching package: git clone {} {} [version={}]",
url, clone_target.display(), pkgid.version.to_str());
let mut failed = false;
// return the path for it. Otherwise, None
pub fn package_script_option(&self) -> Option<Path> {
let maybe_path = self.start_dir.join("pkg.rs");
- debug2!("package_script_option: checking whether {} exists", maybe_path.display());
+ debug!("package_script_option: checking whether {} exists", maybe_path.display());
if os::path_exists(&maybe_path) {
Some(maybe_path)
} else {
for c in it {
sub.push(c);
}
- debug2!("Will compile crate {}", sub.display());
+ debug!("Will compile crate {}", sub.display());
cs.push(Crate::new(&sub));
}
use conditions::missing_pkg_files::cond;
let prefix = self.start_dir.component_iter().len();
- debug2!("Matching against {}", self.id.short_name);
+ debug!("Matching against {}", self.id.short_name);
do os::walk_dir(&self.start_dir) |pth| {
let maybe_known_crate_set = match pth.filename_str() {
Some(filename) if filter(filename) => match filename {
cond.raise(self.id.clone());
}
- debug2!("In {}, found {} libs, {} mains, {} tests, {} benchs",
+ debug!("In {}, found {} libs, {} mains, {} tests, {} benchs",
self.start_dir.display(),
self.libs.len(),
self.mains.len(),
what: OutputType) {
for crate in crates.iter() {
let path = self.start_dir.join(&crate.file);
- debug2!("build_crates: compiling {}", path.display());
+ debug!("build_crates: compiling {}", path.display());
let cfgs = crate.cfgs + cfgs;
do ctx.workcache_context.with_prep(crate_tag(&path)) |prep| {
- debug2!("Building crate {}, declaring it as an input", path.display());
+ debug!("Building crate {}, declaring it as an input", path.display());
// FIXME (#9639): This needs to handle non-utf8 paths
prep.declare_input("file", path.as_str().unwrap(),
workcache_support::digest_file_with_date(&path));
// output as "Some(\"path\")". But I don't know what to do about it.
// FIXME (#9639): This needs to handle non-utf8 paths
let result = result.as_ref().map(|p|p.as_str().unwrap());
- debug2!("Result of compiling {} was {}", subpath.display(), result.to_str());
+ debug!("Result of compiling {} was {}", subpath.display(), result.to_str());
result.to_str()
}
};
pub fn declare_inputs(&self, prep: &mut workcache::Prep) {
let to_do = ~[self.libs.clone(), self.mains.clone(),
self.tests.clone(), self.benchs.clone()];
- debug2!("In declare inputs, self = {}", self.to_str());
+ debug!("In declare inputs, self = {}", self.to_str());
for cs in to_do.iter() {
for c in cs.iter() {
let path = self.start_dir.join(&c.file);
- debug2!("Declaring input: {}", path.display());
+ debug!("Declaring input: {}", path.display());
// FIXME (#9639): This needs to handle non-utf8 paths
prep.declare_input("file", path.as_str().unwrap(),
workcache_support::digest_file_with_date(&path.clone()));
let mains = self.mains.clone();
let tests = self.tests.clone();
let benchs = self.benchs.clone();
- debug2!("Building libs in {}, destination = {}",
+ debug!("Building libs in {}, destination = {}",
self.source_workspace.display(), self.build_workspace().display());
self.build_crates(build_context, &mut deps, libs, cfgs, Lib);
- debug2!("Building mains");
+ debug!("Building mains");
self.build_crates(build_context, &mut deps, mains, cfgs, Main);
- debug2!("Building tests");
+ debug!("Building tests");
self.build_crates(build_context, &mut deps, tests, cfgs, Test);
- debug2!("Building benches");
+ debug!("Building benches");
self.build_crates(build_context, &mut deps, benchs, cfgs, Bench);
deps
}
let crate_sets = [&self.libs, &self.mains, &self.tests, &self.benchs];
for crate_set in crate_sets.iter() {
for c in crate_set.iter() {
- debug2!("Built crate: {}", c.file.display())
+ debug!("Built crate: {}", c.file.display())
}
}
}
pub fn default_workspace() -> Path {
let p = rust_path();
if p.is_empty() {
- fail2!("Empty RUST_PATH");
+ fail!("Empty RUST_PATH");
}
let result = p[0];
if !os::path_is_dir(&result) {
};
if found.is_some() {
- debug2!("Found {} in {}", pkgid.to_str(), workspace.display());
+ debug!("Found {} in {}", pkgid.to_str(), workspace.display());
} else {
- debug2!("Didn't find {} in {}", pkgid.to_str(), workspace.display());
+ debug!("Didn't find {} in {}", pkgid.to_str(), workspace.display());
}
found
}
pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
let mut result = target_build_dir(workspace);
result = mk_output_path(Main, Build, pkgid, result);
- debug2!("built_executable_in_workspace: checking whether {} exists",
+ debug!("built_executable_in_workspace: checking whether {} exists",
result.display());
if os::path_exists(&result) {
Some(result)
}
else {
- debug2!("built_executable_in_workspace: {} does not exist", result.display());
+ debug!("built_executable_in_workspace: {} does not exist", result.display());
None
}
}
let mut result = target_build_dir(workspace);
// should use a target-specific subdirectory
result = mk_output_path(what, Build, pkgid, result);
- debug2!("output_in_workspace: checking whether {} exists",
+ debug!("output_in_workspace: checking whether {} exists",
result.display());
if os::path_exists(&result) {
Some(result)
}
else {
- error2!("output_in_workspace: {} does not exist", result.display());
+ error!("output_in_workspace: {} does not exist", result.display());
None
}
}
/// `short_name` is taken as the link name of the library.
pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
workspace: &Path, prefix: &str, version: &Version) -> Option<Path> {
- debug2!("library_in_workspace: checking whether a library named {} exists",
+ debug!("library_in_workspace: checking whether a library named {} exists",
short_name);
// We don't know what the hash is, so we have to search through the directory
// contents
- debug2!("short_name = {} where = {:?} workspace = {} \
+ debug!("short_name = {} where = {:?} workspace = {} \
prefix = {}", short_name, where, workspace.display(), prefix);
let dir_to_search = match where {
}
fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {
- debug2!("Listing directory {}", dir_to_search.display());
+ debug!("Listing directory {}", dir_to_search.display());
let dir_contents = os::list_dir(dir_to_search);
- debug2!("dir has {:?} entries", dir_contents.len());
+ debug!("dir has {:?} entries", dir_contents.len());
let lib_prefix = format!("{}{}", os::consts::DLL_PREFIX, short_name);
let lib_filetype = os::consts::DLL_EXTENSION;
- debug2!("lib_prefix = {} and lib_filetype = {}", lib_prefix, lib_filetype);
+ debug!("lib_prefix = {} and lib_filetype = {}", lib_prefix, lib_filetype);
// Find a filename that matches the pattern:
// (lib_prefix)-hash-(version)(lib_suffix)
let mut libraries = do dir_contents.iter().filter |p| {
let extension = p.extension_str();
- debug2!("p = {}, p's extension is {:?}", p.display(), extension);
+ debug!("p = {}, p's extension is {:?}", p.display(), extension);
match extension {
None => false,
Some(ref s) => lib_filetype == *s
if f_name.is_empty() { break; }
match f_name.rfind('-') {
Some(i) => {
- debug2!("Maybe {} is a version", f_name.slice(i + 1, f_name.len()));
+ debug!("Maybe {} is a version", f_name.slice(i + 1, f_name.len()));
match try_parsing_version(f_name.slice(i + 1, f_name.len())) {
Some(ref found_vers) if version == found_vers => {
match f_name.slice(0, i).rfind('-') {
Some(j) => {
- debug2!("Maybe {} equals {}", f_name.slice(0, j), lib_prefix);
+ debug!("Maybe {} equals {}", f_name.slice(0, j), lib_prefix);
if f_name.slice(0, j) == lib_prefix {
result_filename = Some(p_path.clone());
}
} // for
if result_filename.is_none() {
- debug2!("warning: library_in_workspace didn't find a library in {} for {}",
+ debug!("warning: library_in_workspace didn't find a library in {} for {}",
dir_to_search.display(), short_name);
}
// (if result_filename != None)
let abs_path = do result_filename.map |result_filename| {
let absolute_path = dir_to_search.join(&result_filename);
- debug2!("result_filename = {}", absolute_path.display());
+ debug!("result_filename = {}", absolute_path.display());
absolute_path
};
let mut result = target_build_dir(workspace);
result.push(&pkgid.path);
- debug2!("Creating build dir {} for package id {}", result.display(),
+ debug!("Creating build dir {} for package id {}", result.display(),
pkgid.to_str());
if os::path_exists(&result) || os::mkdir_recursive(&result, U_RWX) {
result
// and if we're just building, it goes in a package-specific subdir
Build => workspace.join(&pkg_id.path)
};
- debug2!("[{:?}:{:?}] mk_output_path: short_name = {}, path = {}", what, where,
+ debug!("[{:?}:{:?}] mk_output_path: short_name = {}, path = {}", what, where,
if what == Lib { short_name_with_version.clone() } else { pkg_id.short_name.clone() },
dir.display());
let mut output_path = match what {
if !output_path.is_absolute() {
output_path = os::getcwd().join(&output_path);
}
- debug2!("mk_output_path: returning {}", output_path.display());
+ debug!("mk_output_path: returning {}", output_path.display());
output_path
}
// Note that this only matches if the package ID being searched for
// has a name that's a single component
if dir.ends_with_path(&p.path) || dir.ends_with_path(&versionize(&p.path, &p.version)) {
- debug2!("In find_dir_using_rust_path_hack: checking dir {}", dir.display());
+ debug!("In find_dir_using_rust_path_hack: checking dir {}", dir.display());
if dir_has_crate_file(dir) {
- debug2!("Did find id {} in dir {}", p.to_str(), dir.display());
+ debug!("Did find id {} in dir {}", p.to_str(), dir.display());
return Some(dir.clone());
}
}
- debug2!("Didn't find id {} in dir {}", p.to_str(), dir.display())
+ debug!("Didn't find id {} in dir {}", p.to_str(), dir.display())
}
None
}
let binary = os::args()[0].to_managed();
// Build the rustc session data structures to pass
// to the compiler
- debug2!("pkgscript parse: {}", sysroot.display());
+ debug!("pkgscript parse: {}", sysroot.display());
let options = @session::options {
binary: binary,
maybe_sysroot: Some(sysroot),
let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);
let work_dir = build_pkg_id_in_workspace(id, workspace);
- debug2!("Returning package script with id {}", id.to_str());
+ debug!("Returning package script with id {}", id.to_str());
PkgScript {
id: id,
sysroot: &Path) -> (~[~str], ExitCode) {
let sess = self.sess;
- debug2!("Working directory = {}", self.build_dir.display());
+ debug!("Working directory = {}", self.build_dir.display());
// Collect together any user-defined commands in the package script
let crate = util::ready_crate(sess, self.crate.take_unwrap());
- debug2!("Building output filenames with script name {}",
+ debug!("Building output filenames with script name {}",
driver::source_name(&driver::file_input(self.input.clone())));
let exe = self.build_dir.join("pkg" + util::exe_suffix());
util::compile_crate_from_input(&self.input,
&self.build_dir,
sess,
crate);
- debug2!("Running program: {} {} {}", exe.display(),
+ debug!("Running program: {} {} {}", exe.display(),
sysroot.display(), "install");
// Discover the output
// FIXME (#9639): This needs to handle non-utf8 paths
return (~[], status);
}
else {
- debug2!("Running program (configs): {} {} {}",
+ debug!("Running program (configs): {} {} {}",
exe.display(), sysroot.display(), "configs");
// FIXME (#9639): This needs to handle non-utf8 paths
let output = run::process_output(exe.as_str().unwrap(),
let pkgid = PkgId::new(args[0].clone());
let mut dest_ws = default_workspace();
do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| {
- debug2!("found pkg {} in workspace {}, trying to build",
+ debug!("found pkg {} in workspace {}, trying to build",
pkgid.to_str(), workspace.display());
dest_ws = determine_destination(os::getcwd(),
self.context.use_rust_path_hack,
// argument
let pkgid = PkgId::new(args[0]);
let workspaces = pkg_parent_workspaces(&self.context, &pkgid);
- debug2!("package ID = {}, found it in {:?} workspaces",
+ debug!("package ID = {}, found it in {:?} workspaces",
pkgid.to_str(), workspaces.len());
if workspaces.is_empty() {
let d = default_workspace();
self.unprefer(args[0], None);
}
- _ => fail2!("I don't know the command `{}`", cmd)
+ _ => fail!("I don't know the command `{}`", cmd)
}
}
fn do_cmd(&self, _cmd: &str, _pkgname: &str) {
// stub
- fail2!("`do` not yet implemented");
+ fail!("`do` not yet implemented");
}
fn build(&self, pkg_src: &mut PkgSrc, what_to_build: &WhatToBuild) {
let workspace = pkg_src.source_workspace.clone();
let pkgid = pkg_src.id.clone();
- debug2!("build: workspace = {} (in Rust path? {:?} is git dir? {:?} \
+ debug!("build: workspace = {} (in Rust path? {:?} is git dir? {:?} \
pkgid = {} pkgsrc start_dir = {}", workspace.display(),
in_rust_path(&workspace), is_git_dir(&workspace.join(&pkgid.path)),
pkgid.to_str(), pkg_src.start_dir.display());
_ => cond.raise((pkgid.path.as_str().unwrap().to_owned(), out_dir.clone()))
};
let default_ws = default_workspace();
- debug2!("Calling build recursively with {:?} and {:?}", default_ws.display(),
+ debug!("Calling build recursively with {:?} and {:?}", default_ws.display(),
pkgid.to_str());
return self.build(&mut PkgSrc::new(default_ws.clone(),
default_ws,
// Is there custom build logic? If so, use it
let mut custom = false;
- debug2!("Package source directory = {}", pkg_src.to_str());
+ debug!("Package source directory = {}", pkg_src.to_str());
let opt = pkg_src.package_script_option();
- debug2!("Calling pkg_script_option on {:?}", opt);
+ debug!("Calling pkg_script_option on {:?}", opt);
let cfgs = match pkg_src.package_script_option() {
Some(package_script_path) => {
let sysroot = self.sysroot_to_use();
pscript.run_custom(exec, &sub_sysroot)
}
};
- debug2!("Command return code = {:?}", hook_result);
+ debug!("Command return code = {:?}", hook_result);
if hook_result != 0 {
- fail2!("Error running custom build command")
+ fail!("Error running custom build command")
}
custom = true;
// otherwise, the package script succeeded
cfgs
}
None => {
- debug2!("No package script, continuing");
+ debug!("No package script, continuing");
~[]
}
} + self.context.cfgs;
&JustOne(ref p) => {
// We expect that p is relative to the package source's start directory,
// so check that assumption
- debug2!("JustOne: p = {}", p.display());
+ debug!("JustOne: p = {}", p.display());
assert!(os::path_exists(&pkg_src.start_dir.join(p)));
if is_lib(p) {
PkgSrc::push_crate(&mut pkg_src.libs, 0, p);
fn info(&self) {
// stub
- fail2!("info not yet implemented");
+ fail!("info not yet implemented");
}
fn install(&self, mut pkg_src: PkgSrc, what: &WhatToBuild) -> (~[Path], ~[(~str, ~str)]) {
let mut inputs = ~[];
let mut build_inputs = ~[];
- debug2!("Installing package source: {}", pkg_src.to_str());
+ debug!("Installing package source: {}", pkg_src.to_str());
// workcache only knows about *crates*. Building a package
// just means inferring all the crates in it, then building each one.
let to_do = ~[pkg_src.libs.clone(), pkg_src.mains.clone(),
pkg_src.tests.clone(), pkg_src.benchs.clone()];
- debug2!("In declare inputs for {}", id.to_str());
+ debug!("In declare inputs for {}", id.to_str());
for cs in to_do.iter() {
for c in cs.iter() {
let path = pkg_src.start_dir.join(&c.file);
- debug2!("Recording input: {}", path.display());
+ debug!("Recording input: {}", path.display());
// FIXME (#9639): This needs to handle non-utf8 paths
inputs.push((~"file", path.as_str().unwrap().to_owned()));
build_inputs.push(path);
build_inputs,
&pkg_src.destination_workspace,
&id).map(|s| Path::new(s.as_slice()));
- debug2!("install: id = {}, about to call discover_outputs, {:?}",
+ debug!("install: id = {}, about to call discover_outputs, {:?}",
id.to_str(), result.map(|p| p.display().to_str()));
installed_files = installed_files + result;
note(format!("Installed package {} to {}",
id: &PkgId) -> ~[~str] {
use conditions::copy_failed::cond;
- debug2!("install_no_build: assuming {} comes from {} with target {}",
+ debug!("install_no_build: assuming {} comes from {} with target {}",
id.to_str(), build_workspace.display(), target_workspace.display());
// Now copy stuff into the install dirs
let target_lib = maybe_library.as_ref()
.map(|_| target_library_in_workspace(id, target_workspace));
- debug2!("target_exec = {} target_lib = {:?} \
+ debug!("target_exec = {} target_lib = {:?} \
maybe_executable = {:?} maybe_library = {:?}",
target_exec.display(), target_lib,
maybe_executable, maybe_library);
for exec in subex.iter() {
- debug2!("Copying: {} -> {}", exec.display(), sub_target_ex.display());
+ debug!("Copying: {} -> {}", exec.display(), sub_target_ex.display());
if !(os::mkdir_recursive(&sub_target_ex.dir_path(), U_RWX) &&
os::copy_file(exec, &sub_target_ex)) {
cond.raise(((*exec).clone(), sub_target_ex.clone()));
os::copy_file(lib, &target_lib)) {
cond.raise(((*lib).clone(), target_lib.clone()));
}
- debug2!("3. discovering output {}", target_lib.display());
+ debug!("3. discovering output {}", target_lib.display());
exe_thing.discover_output("binary",
target_lib.as_str().unwrap(),
workcache_support::digest_only_date(&target_lib));
}
fn prefer(&self, _id: &str, _vers: Option<~str>) {
- fail2!("prefer not yet implemented");
+ fail!("prefer not yet implemented");
}
fn test(&self, pkgid: &PkgId, workspace: &Path) {
match built_test_in_workspace(pkgid, workspace) {
Some(test_exec) => {
- debug2!("test: test_exec = {}", test_exec.display());
+ debug!("test: test_exec = {}", test_exec.display());
// FIXME (#9639): This needs to handle non-utf8 paths
let status = run::process_status(test_exec.as_str().unwrap(), [~"--test"]);
os::set_exit_status(status);
}
fn uninstall(&self, _id: &str, _vers: Option<~str>) {
- fail2!("uninstall not yet implemented");
+ fail!("uninstall not yet implemented");
}
fn unprefer(&self, _id: &str, _vers: Option<~str>) {
- fail2!("unprefer not yet implemented");
+ fail!("unprefer not yet implemented");
}
}
_ => filesearch::get_or_default_sysroot()
};
- debug2!("Using sysroot: {}", sroot.display());
+ debug!("Using sysroot: {}", sroot.display());
let ws = default_workspace();
- debug2!("Will store workcache in {}", ws.display());
+ debug!("Will store workcache in {}", ws.display());
let rm_args = remaining_args.clone();
let sub_cmd = cmd.clone();
/// FIXME #8711: This ignores the desired version.
pub fn find_installed_library_in_rust_path(pkg_path: &Path, _version: &Version) -> Option<Path> {
let rp = rust_path();
- debug2!("find_installed_library_in_rust_path: looking for path {}",
+ debug!("find_installed_library_in_rust_path: looking for path {}",
pkg_path.display());
for p in rp.iter() {
match installed_library_in_workspace(pkg_path, p) {
/// Returns `CheckedOutSources` if the clone succeeded.
pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult {
if os::path_exists(source) {
- debug2!("{} exists locally! Cloning it into {}",
+ debug!("{} exists locally! Cloning it into {}",
source.display(), target.display());
// Ok to use target here; we know it will succeed
assert!(os::path_is_dir(source));
assert!(is_git_dir(source));
if !os::path_exists(target) {
- debug2!("Running: git clone {} {}", source.display(), target.display());
+ debug!("Running: git clone {} {}", source.display(), target.display());
// FIXME (#9639): This needs to handle non-utf8 paths
let outp = run::process_output("git", [~"clone",
source.as_str().unwrap().to_owned(),
match v {
&ExactRevision(ref s) => {
let git_dir = target.join(".git");
- debug2!("`Running: git --work-tree={} --git-dir={} checkout {}",
+ debug!("`Running: git --work-tree={} --git-dir={} checkout {}",
*s, target.display(), git_dir.display());
// FIXME (#9639: This needs to handle non-utf8 paths
let outp = run::process_output("git",
// case where a version was requested, but I haven't implemented it.
assert!(*v == NoVersion);
let git_dir = target.join(".git");
- debug2!("Running: git --work-tree={} --git-dir={} pull --no-edit {}",
+ debug!("Running: git --work-tree={} --git-dir={} pull --no-edit {}",
target.display(), git_dir.display(), source.display());
// FIXME (#9639: This needs to handle non-utf8 paths
let args = [format!("--work-tree={}", target.as_str().unwrap().to_owned()),
let outp = run::process_output("git", [~"clone", source.to_owned(),
target.as_str().unwrap().to_owned()]);
if outp.status != 0 {
- debug2!("{}", str::from_utf8_owned(outp.output.clone()));
- debug2!("{}", str::from_utf8_owned(outp.error));
+ debug!("{}", str::from_utf8_owned(outp.output.clone()));
+ debug!("{}", str::from_utf8_owned(outp.error));
cond.raise((source.to_owned(), target.clone()))
}
else {
let outp = process_output_in_cwd("git", [~"checkout", s.to_owned()],
target);
if outp.status != 0 {
- debug2!("{}", str::from_utf8_owned(outp.output.clone()));
- debug2!("{}", str::from_utf8_owned(outp.error));
+ debug!("{}", str::from_utf8_owned(outp.output.clone()));
+ debug!("{}", str::from_utf8_owned(outp.error));
cond.raise((source.to_owned(), target.clone()))
}
}
short_name.as_str().unwrap(),
version.to_str())]);
- debug2!("Created {} and does it exist? {:?}", package_dir.display(),
+ debug!("Created {} and does it exist? {:?}", package_dir.display(),
os::path_is_dir(&package_dir));
// Create main, lib, test, and bench files
- debug2!("mk_workspace: creating {}", package_dir.display());
+ debug!("mk_workspace: creating {}", package_dir.display());
assert!(os::mkdir_recursive(&package_dir, U_RWX));
- debug2!("Created {} and does it exist? {:?}", package_dir.display(),
+ debug!("Created {} and does it exist? {:?}", package_dir.display(),
os::path_is_dir(&package_dir));
// Create main, lib, test, and bench files
});
let rslt = prog.finish_with_output();
if rslt.status != 0 {
- fail2!("{} [git returned {:?}, output = {}, error = {}]", err_msg,
+ fail!("{} [git returned {:?}, output = {}, error = {}]", err_msg,
rslt.status, str::from_utf8(rslt.output), str::from_utf8(rslt.error));
}
}
let work_dir = tmp.path().join(p);
let work_dir_for_opts = work_dir.clone();
assert!(os::mkdir_recursive(&work_dir, U_RWX));
- debug2!("Running: git init in {}", work_dir.display());
+ debug!("Running: git init in {}", work_dir.display());
run_git([~"init"], None, &work_dir_for_opts,
format!("Couldn't initialize git repository in {}", work_dir.display()));
// Add stuff to the dir so that git tag succeeds
second_try
}
else {
- fail2!("in rustpkg test, can't find an installed rustpkg");
+ fail!("in rustpkg test, can't find an installed rustpkg");
}
}
}
fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput {
match command_line_test_with_env(args, cwd, None) {
Success(r) => r,
- Fail(error) => fail2!("Command line test failed with error {}", error)
+ Fail(error) => fail!("Command line test failed with error {}", error)
}
}
env: Option<~[(~str, ~str)]>,
expected_exitcode: int) {
match command_line_test_with_env(args, cwd, env) {
- Success(_) => fail2!("Should have failed with {}, but it succeeded", expected_exitcode),
+ Success(_) => fail!("Should have failed with {}, but it succeeded", expected_exitcode),
Fail(error) if error == expected_exitcode => (), // ok
- Fail(other) => fail2!("Expected to fail with {}, but failed with {} instead",
+ Fail(other) => fail!("Expected to fail with {}, but failed with {} instead",
expected_exitcode, other)
}
}
Some(ref pairs) => pairs.map(|&(ref k, ref v)| { format!("{}={}", *k, *v) }).connect(","),
None => ~""
};
- debug2!("{} cd {}; {} {}", env_str, cwd.display(), cmd, args.connect(" "));
+ debug!("{} cd {}; {} {}", env_str, cwd.display(), cmd, args.connect(" "));
assert!(os::path_is_dir(&*cwd));
let cwd = (*cwd).clone();
let mut prog = run::Process::new(cmd, args, run::ProcessOptions {
err_fd: None
});
let output = prog.finish_with_output();
- debug2!("Output from command {} with args {:?} was {} \\{{}\\}[{:?}]",
+ debug!("Output from command {} with args {:?} was {} \\{{}\\}[{:?}]",
cmd, args, str::from_utf8(output.output),
str::from_utf8(output.error),
output.status);
to make sure the command succeeded
*/
if output.status != 0 {
- debug2!("Command {} {:?} failed with exit code {:?}; its output was --- {} ---",
+ debug!("Command {} {:?} failed with exit code {:?}; its output was --- {} ---",
cmd, args, output.status,
str::from_utf8(output.output) + str::from_utf8(output.error));
Fail(output.status)
fn create_local_package(pkgid: &PkgId) -> TempDir {
let (workspace, parent_dir) = mk_temp_workspace(&pkgid.path, &pkgid.version);
- debug2!("Created empty package dir for {}, returning {}", pkgid.to_str(), parent_dir.display());
+ debug!("Created empty package dir for {}, returning {}", pkgid.to_str(), parent_dir.display());
workspace
}
// Create main, lib, test, and bench files
assert!(os::mkdir_recursive(&package_dir, U_RWX));
- debug2!("Created {} and does it exist? {:?}", package_dir.display(),
+ debug!("Created {} and does it exist? {:?}", package_dir.display(),
os::path_is_dir(&package_dir));
// Create main, lib, test, and bench files
}
fn create_local_package_with_test(pkgid: &PkgId) -> TempDir {
- debug2!("Dry run -- would create package {:?} with test", pkgid);
+ debug!("Dry run -- would create package {:?} with test", pkgid);
create_local_package(pkgid) // Already has tests???
}
fn create_local_package_with_custom_build_hook(pkgid: &PkgId,
custom_build_hook: &str) -> TempDir {
- debug2!("Dry run -- would create package {} with custom build hook {}",
+ debug!("Dry run -- would create package {} with custom build hook {}",
pkgid.to_str(), custom_build_hook);
create_local_package(pkgid)
// actually write the pkg.rs with the custom build hook
}
fn lib_exists(repo: &Path, pkg_path: &Path, _v: Version) -> bool { // ??? version?
- debug2!("assert_lib_exists: repo = {}, pkg_path = {}", repo.display(), pkg_path.display());
+ debug!("assert_lib_exists: repo = {}, pkg_path = {}", repo.display(), pkg_path.display());
let lib = installed_library_in_workspace(pkg_path, repo);
- debug2!("assert_lib_exists: checking whether {:?} exists", lib);
+ debug!("assert_lib_exists: checking whether {:?} exists", lib);
lib.is_some() && {
let libname = lib.get_ref();
os::path_exists(libname) && is_rwx(libname)
}
fn executable_exists(repo: &Path, short_name: &str) -> bool {
- debug2!("executable_exists: repo = {}, short_name = {}", repo.display(), short_name);
+ debug!("executable_exists: repo = {}, short_name = {}", repo.display(), short_name);
let exec = target_executable_in_workspace(&PkgId::new(short_name), repo);
os::path_exists(&exec) && is_rwx(&exec)
}
fn test_executable_exists(repo: &Path, short_name: &str) -> bool {
- debug2!("test_executable_exists: repo = {}, short_name = {}", repo.display(), short_name);
+ debug!("test_executable_exists: repo = {}, short_name = {}", repo.display(), short_name);
let exec = built_test_in_workspace(&PkgId::new(short_name), repo);
do exec.map_default(false) |exec| {
os::path_exists(&exec) && is_rwx(&exec)
}
fn built_executable_exists(repo: &Path, short_name: &str) -> bool {
- debug2!("assert_built_executable_exists: repo = {}, short_name = {}",
+ debug!("assert_built_executable_exists: repo = {}, short_name = {}",
repo.display(), short_name);
let exec = built_executable_in_workspace(&PkgId::new(short_name), repo);
exec.is_some() && {
}
fn built_library_exists(repo: &Path, short_name: &str) -> bool {
- debug2!("assert_built_library_exists: repo = {}, short_name = {}", repo.display(), short_name);
+ debug!("assert_built_library_exists: repo = {}, short_name = {}", repo.display(), short_name);
let lib = built_library_in_workspace(&PkgId::new(short_name), repo);
lib.is_some() && {
let libname = lib.get_ref();
let mut result = ~[];
let p_output = match command_line_test_with_env(args,
&os::getcwd(), Some(env)) {
- Fail(_) => fail2!("Command-line test failed"),
+ Fail(_) => fail!("Command-line test failed"),
Success(r) => r
};
let test_output = str::from_utf8(p_output.output);
// assumes short_name and path are one and the same -- I should fix
fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path {
- debug2!("lib_output_file_name: given {} and short name {}",
+ debug!("lib_output_file_name: given {} and short name {}",
workspace.display(), short_name);
library_in_workspace(&Path::new(short_name),
short_name,
let pkg_src_dir = workspace.join_many([~"src", pkgid.to_str()]);
let mut maybe_p = None;
let maybe_file = pkg_src_dir.join(filename);
- debug2!("Trying to frob {} -- {}", pkg_src_dir.display(), filename);
+ debug!("Trying to frob {} -- {}", pkg_src_dir.display(), filename);
if os::path_exists(&maybe_file) {
maybe_p = Some(maybe_file);
}
- debug2!("Frobbed? {:?}", maybe_p);
+ debug!("Frobbed? {:?}", maybe_p);
match maybe_p {
Some(ref p) => {
let w = io::file_writer(p, &[io::Append]);
Ok(w) => w.write_line("/* hi */")
}
}
- None => fail2!("frob_source_file failed to find a source file in {}",
+ None => fail!("frob_source_file failed to find a source file in {}",
pkg_src_dir.display())
}
}
let dir = temp.join("quux");
assert!(!os::path_exists(&dir) ||
os::remove_dir_recursive(&dir));
- debug2!("Trying to make {}", dir.display());
+ debug!("Trying to make {}", dir.display());
assert!(make_dir_rwx(&dir));
assert!(os::path_is_dir(&dir));
assert!(is_rwx(&dir));
use path_util::installed_library_in_workspace;
let sysroot = test_sysroot();
- debug2!("sysroot = {}", sysroot.display());
+ debug!("sysroot = {}", sysroot.display());
let temp_pkg_id = fake_pkg();
let (temp_workspace, _pkg_dir) = mk_temp_workspace(&temp_pkg_id.path, &NoVersion);
let temp_workspace = temp_workspace.path();
let ctxt = fake_ctxt(sysroot, temp_workspace);
- debug2!("temp_workspace = {}", temp_workspace.display());
+ debug!("temp_workspace = {}", temp_workspace.display());
// should have test, bench, lib, and main
let src = PkgSrc::new(temp_workspace.clone(),
temp_workspace.clone(),
ctxt.install(src, &Everything);
// Check that all files exist
let exec = target_executable_in_workspace(&temp_pkg_id, temp_workspace);
- debug2!("exec = {}", exec.display());
+ debug!("exec = {}", exec.display());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let lib = installed_library_in_workspace(&temp_pkg_id.path, temp_workspace);
- debug2!("lib = {:?}", lib);
+ debug!("lib = {:?}", lib);
assert!(lib.as_ref().map_default(false, |l| os::path_exists(l)));
assert!(lib.as_ref().map_default(false, |l| is_rwx(l)));
// And that the test and bench executables aren't installed
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, temp_workspace)));
let bench = target_bench_in_workspace(&temp_pkg_id, temp_workspace);
- debug2!("bench = {}", bench.display());
+ debug!("bench = {}", bench.display());
assert!(!os::path_exists(&bench));
// Make sure the db isn't dirty, so that it doesn't try to save()
// Check that all files exist
let exec = target_executable_in_workspace(&temp_pkg_id, temp_workspace);
- debug2!("exec = {}", exec.display());
+ debug!("exec = {}", exec.display());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let lib = installed_library_in_workspace(&temp_pkg_id.path, temp_workspace);
- debug2!("lib = {:?}", lib);
+ debug!("lib = {:?}", lib);
assert!(lib.as_ref().map_default(false, |l| os::path_exists(l)));
assert!(lib.as_ref().map_default(false, |l| is_rwx(l)));
// And that the test and bench executables aren't installed
assert!(!os::path_exists(&target_test_in_workspace(&temp_pkg_id, temp_workspace)));
let bench = target_bench_in_workspace(&temp_pkg_id, temp_workspace);
- debug2!("bench = {}", bench.display());
+ debug!("bench = {}", bench.display());
assert!(!os::path_exists(&bench));
}
let temp_pkg_id = git_repo_pkg();
let repo = init_git_repo(&temp_pkg_id.path);
let repo = repo.path();
- debug2!("repo = {}", repo.display());
+ debug!("repo = {}", repo.display());
let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]);
- debug2!("repo_subdir = {}", repo_subdir.display());
+ debug!("repo_subdir = {}", repo_subdir.display());
writeFile(&repo_subdir.join("main.rs"),
"fn main() { let _x = (); }");
"#[bench] pub fn f() { (); }");
add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files
- debug2!("test_install_git: calling rustpkg install {} in {}",
+ debug!("test_install_git: calling rustpkg install {} in {}",
temp_pkg_id.path.display(), repo.display());
// should have test, bench, lib, and main
// FIXME (#9639): This needs to handle non-utf8 paths
command_line_test([~"install", temp_pkg_id.path.as_str().unwrap().to_owned()], repo);
let ws = repo.join(".rust");
// Check that all files exist
- debug2!("Checking for files in {}", ws.display());
+ debug!("Checking for files in {}", ws.display());
let exec = target_executable_in_workspace(&temp_pkg_id, &ws);
- debug2!("exec = {}", exec.display());
+ debug!("exec = {}", exec.display());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let _built_lib =
// And that the test and bench executables aren't installed
let test = target_test_in_workspace(&temp_pkg_id, &ws);
assert!(!os::path_exists(&test));
- debug2!("test = {}", test.display());
+ debug!("test = {}", test.display());
let bench = target_bench_in_workspace(&temp_pkg_id, &ws);
- debug2!("bench = {}", bench.display());
+ debug!("bench = {}", bench.display());
assert!(!os::path_exists(&bench));
}
let repo = init_git_repo(&Path::new(local_path));
let repo = repo.path();
let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]);
- debug2!("Writing files in: {}", repo_subdir.display());
+ debug!("Writing files in: {}", repo_subdir.display());
writeFile(&repo_subdir.join("main.rs"),
"fn main() { let _x = (); }");
writeFile(&repo_subdir.join("lib.rs"),
let repo = init_git_repo(&Path::new(local_path));
let repo = repo.path();
let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]);
- debug2!("Writing files in: {}", repo_subdir.display());
+ debug!("Writing files in: {}", repo_subdir.display());
writeFile(&repo_subdir.join("main.rs"),
"fn main() { let _x = (); }");
writeFile(&repo_subdir.join("lib.rs"),
assert!(match installed_library_in_workspace(&Path::new("test_pkg_version"),
&repo.join(".rust")) {
Some(p) => {
- debug2!("installed: {}", p.display());
+ debug!("installed: {}", p.display());
let suffix = format!("0.3{}", os::consts::DLL_SUFFIX);
p.as_vec().ends_with(suffix.as_bytes())
}
let mut dir = target_build_dir(&repo.join(".rust"));
dir.push(&Path::new("src/mockgithub.com/catamorphism/test_pkg_version-0.3"));
- debug2!("dir = {}", dir.display());
+ debug!("dir = {}", dir.display());
assert!(os::path_is_dir(&dir));
assert!(os::path_exists(&dir.join("version-0.3-file.txt")));
assert!(!os::path_exists(&dir.join("version-0.4-file.txt")));
let foo_repo = foo_repo.path();
let package_dir = foo_repo.join("foo");
- debug2!("Writing files in: {}", package_dir.display());
+ debug!("Writing files in: {}", package_dir.display());
writeFile(&package_dir.join("main.rs"),
"fn main() { let _x = (); }");
writeFile(&package_dir.join("lib.rs"),
fn package_script_with_default_build() {
let dir = create_local_package(&PkgId::new("fancy-lib"));
let dir = dir.path();
- debug2!("dir = {}", dir.display());
+ debug!("dir = {}", dir.display());
let mut source = test_sysroot().dir_path();
source.pop(); source.pop();
source.push_many(["src", "librustpkg", "testsuite", "pass", "src", "fancy-lib", "pkg.rs"]);
- debug2!("package_script_with_default_build: {}", source.display());
+ debug!("package_script_with_default_build: {}", source.display());
if !os::copy_file(&source,
&dir.join_many(["src", "fancy-lib-0.1", "pkg.rs"])) {
- fail2!("Couldn't copy file");
+ fail!("Couldn't copy file");
}
command_line_test([~"install", ~"fancy-lib"], dir);
assert_lib_exists(dir, &Path::new("fancy-lib"), NoVersion);
writeFile(&package_dir.join("main.rs"),
"fn main() { let _x = (); }");
- debug2!("build_no_arg: dir = {}", package_dir.display());
+ debug!("build_no_arg: dir = {}", package_dir.display());
command_line_test([~"build"], &package_dir);
assert_built_executable_exists(&tmp, "foo");
}
assert!(os::mkdir_recursive(&package_dir, U_RWX));
writeFile(&package_dir.join("lib.rs"),
"fn main() { let _x = (); }");
- debug2!("install_no_arg: dir = {}", package_dir.display());
+ debug!("install_no_arg: dir = {}", package_dir.display());
command_line_test([~"install"], &package_dir);
assert_lib_exists(&tmp, &Path::new("foo"), NoVersion);
}
writeFile(&package_dir.join("main.rs"),
"fn main() { let _x = (); }");
- debug2!("clean_no_arg: dir = {}", package_dir.display());
+ debug!("clean_no_arg: dir = {}", package_dir.display());
command_line_test([~"build"], &package_dir);
assert_built_executable_exists(&tmp, "foo");
command_line_test([~"clean"], &package_dir);
fn rust_path_test() {
let dir_for_path = TempDir::new("more_rust").expect("rust_path_test failed");
let dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion);
- debug2!("dir = {}", dir.display());
+ debug!("dir = {}", dir.display());
writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }");
let cwd = os::getcwd();
- debug2!("cwd = {}", cwd.display());
+ debug!("cwd = {}", cwd.display());
// use command_line_test_with_env
// FIXME (#9639): This needs to handle non-utf8 paths
command_line_test_with_env([~"install", ~"foo"],
let mut contents = ~[];
let check_dups = |p: &PkgId| {
if contents.contains(p) {
- fail2!("package {} appears in `list` output more than once", p.path.display());
+ fail!("package {} appears in `list` output more than once", p.path.display());
}
else {
contents.push((*p).clone());
match command_line_test_partial([~"build", ~"foo"], workspace) {
Success(*) => (), // ok
- Fail(status) if status == 65 => fail2!("no_rebuilding failed: it tried to rebuild bar"),
- Fail(_) => fail2!("no_rebuilding failed for some other reason")
+ Fail(status) if status == 65 => fail!("no_rebuilding failed: it tried to rebuild bar"),
+ Fail(_) => fail!("no_rebuilding failed for some other reason")
}
}
assert!(chmod_read_only(&bar_lib));
match command_line_test_partial([~"build", ~"foo"], workspace) {
Success(*) => (), // ok
- Fail(status) if status == 65 => fail2!("no_rebuilding_dep failed: it tried to rebuild bar"),
- Fail(_) => fail2!("no_rebuilding_dep failed for some other reason")
+ Fail(status) if status == 65 => fail!("no_rebuilding_dep failed: it tried to rebuild bar"),
+ Fail(_) => fail!("no_rebuilding_dep failed for some other reason")
}
}
assert!(chmod_read_only(&bar_lib_name));
match command_line_test_partial([~"build", ~"foo"], workspace) {
- Success(*) => fail2!("do_rebuild_dep_dates_change failed: it didn't rebuild bar"),
+ Success(*) => fail!("do_rebuild_dep_dates_change failed: it didn't rebuild bar"),
Fail(status) if status == 65 => (), // ok
- Fail(_) => fail2!("do_rebuild_dep_dates_change failed for some other reason")
+ Fail(_) => fail!("do_rebuild_dep_dates_change failed for some other reason")
}
}
// should adjust the datestamp
match command_line_test_partial([~"build", ~"foo"], workspace) {
- Success(*) => fail2!("do_rebuild_dep_only_contents_change failed: it didn't rebuild bar"),
+ Success(*) => fail!("do_rebuild_dep_only_contents_change failed: it didn't rebuild bar"),
Fail(status) if status == 65 => (), // ok
- Fail(_) => fail2!("do_rebuild_dep_only_contents_change failed for some other reason")
+ Fail(_) => fail!("do_rebuild_dep_only_contents_change failed for some other reason")
}
}
});
let outp = prog.finish_with_output();
if outp.status != 0 {
- fail2!("output was {}, error was {}",
+ fail!("output was {}, error was {}",
str::from_utf8(outp.output),
str::from_utf8(outp.error));
}
let rustpkg_exec = rustpkg_exec();
let rustc = rustpkg_exec.with_filename("rustc");
let test_sys = test_sysroot();
- debug2!("RUST_PATH={} {} {} \n --sysroot {} -o {}",
+ debug!("RUST_PATH={} {} {} \n --sysroot {} -o {}",
lib_depend_dir.display(),
rustc.display(),
main_file.display(),
});
let outp = prog.finish_with_output();
if outp.status != 0 {
- fail2!("output was {}, error was {}",
+ fail!("output was {}, error was {}",
str::from_utf8(outp.output),
str::from_utf8(outp.error));
}
writeFile(&workspace.join_many(["src", "foo-0.1", "pkg.rs"]),
"extern mod rustpkg; fn main() {}");
command_line_test([~"build", ~"foo"], workspace);
- debug2!("workspace = {}", workspace.display());
+ debug!("workspace = {}", workspace.display());
assert!(os::path_exists(&target_build_dir(workspace).join("foo").join(format!("pkg{}",
os::EXE_SUFFIX))));
}
let workspace = create_local_package(&p_id);
let workspace = workspace.path();
writeFile(&workspace.join_many(["src", "foo-0.1", "pkg.rs"]),
- "extern mod rustpkg; fn main() { debug2!(\"Hi\"); }");
+ "extern mod rustpkg; fn main() { debug!(\"Hi\"); }");
command_line_test([~"build", ~"foo"], workspace);
- debug2!("workspace = {}", workspace.display());
+ debug!("workspace = {}", workspace.display());
assert!(os::path_exists(&target_build_dir(workspace).join("foo").join(format!("pkg{}",
os::EXE_SUFFIX))));
}
let (a_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion);
let (b_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion);
let (a_loc, b_loc) = (a_loc.path(), b_loc.path());
- debug2!("Trying to install foo in {}", a_loc.display());
+ debug!("Trying to install foo in {}", a_loc.display());
command_line_test([~"install", ~"foo"], a_loc);
- debug2!("Trying to install foo in {}", b_loc.display());
+ debug!("Trying to install foo in {}", b_loc.display());
command_line_test([~"install", ~"foo"], b_loc);
// FIXME (#9639): This needs to handle non-utf8 paths
let env = Some(~[(~"RUST_PATH", format!("{}:{}", a_loc.as_str().unwrap(),
// FIXME (#9639): This needs to handle non-utf8 paths
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
command_line_test_with_env([~"install", ~"--rust-path-hack", ~"foo"], &cwd, rust_path);
- debug2!("Checking that foo exists in {}", dest_workspace.display());
+ debug!("Checking that foo exists in {}", dest_workspace.display());
assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion);
assert_built_library_exists(dest_workspace, "foo");
assert!(!lib_exists(&cwd, &Path::new("foo"), NoVersion));
// FIXME (#9639): This needs to handle non-utf8 paths
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
command_line_test_with_env([~"install", ~"--rust-path-hack", name.clone()], &subdir, rust_path);
- debug2!("Checking that {} exists in {}", name, dest_workspace.display());
+ debug!("Checking that {} exists in {}", name, dest_workspace.display());
assert_lib_exists(dest_workspace, &Path::new("quux"), NoVersion);
assert_built_library_exists(dest_workspace, name);
assert!(!lib_exists(&subdir, &Path::new("quux"), NoVersion));
// FIXME (#9639): This needs to handle non-utf8 paths
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path);
- debug2!("Checking that foo exists in {}", dest_workspace.display());
+ debug!("Checking that foo exists in {}", dest_workspace.display());
assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion);
assert_built_library_exists(dest_workspace, "foo");
assert!(!lib_exists(&source_dir, &Path::new("foo"), NoVersion));
// FIXME (#9639): This needs to handle non-utf8 paths
let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]);
command_line_test_with_env([~"build", ~"--rust-path-hack"], &source_dir, rust_path);
- debug2!("Checking that foo exists in {}", dest_workspace.display());
+ debug!("Checking that foo exists in {}", dest_workspace.display());
assert_built_library_exists(dest_workspace, "foo");
assert!(!built_library_exists(&source_dir, "foo"));
}
let dir_for_path = TempDir::new(
"source_workspace").expect("rust_path_install_target failed");
let mut dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion);
- debug2!("dir = {}", dir.display());
+ debug!("dir = {}", dir.display());
writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }");
let dir_to_install_to = TempDir::new(
"dest_workspace").expect("rust_path_install_target failed");
~"build",
~"foo"],
workspace) {
- Success(*) => fail2!("test_cfg_fail failed"),
+ Success(*) => fail!("test_cfg_fail failed"),
_ => ()
}
}
writeFile(&foo_dir.join("lib.rs"), "pub fn f() {}");
writeFile(&bar_dir.join("lib.rs"), "pub fn g() {}");
- debug2!("Creating a file in {}", workspace.display());
+ debug!("Creating a file in {}", workspace.display());
let testpkg_dir = workspace.join_many(["src", "testpkg-0.1"]);
assert!(os::mkdir_recursive(&testpkg_dir, U_RWX));
"extern mod c; use c::g; pub fn f() { g(); }");
// FIXME (#9639): This needs to handle non-utf8 paths
let environment = Some(~[(~"RUST_PATH", b_workspace.as_str().unwrap().to_owned())]);
- debug2!("RUST_PATH={}", b_workspace.display());
+ debug!("RUST_PATH={}", b_workspace.display());
command_line_test_with_env([~"install", ~"a"],
a_workspace,
environment);
let rust_path = Some(~[(~"RUST_PATH",
format!("{}:{}", first_workspace.as_str().unwrap(),
second_workspace.as_str().unwrap()))]);
- debug2!("RUST_PATH={}:{}", first_workspace.display(), second_workspace.display());
+ debug!("RUST_PATH={}:{}", first_workspace.display(), second_workspace.display());
let test_sys = test_sysroot();
// FIXME (#9639): This needs to handle non-utf8 paths
command_line_test_with_env([test_sys.as_str().unwrap().to_owned(),
frob_source_file(foo_workspace, &foo_id, "test.rs");
chmod_read_only(&test_executable);
match command_line_test_partial([~"test", ~"foo"], foo_workspace) {
- Success(*) => fail2!("test_rebuild_when_needed didn't rebuild"),
+ Success(*) => fail!("test_rebuild_when_needed didn't rebuild"),
Fail(status) if status == 65 => (), // ok
- Fail(_) => fail2!("test_rebuild_when_needed failed for some other reason")
+ Fail(_) => fail!("test_rebuild_when_needed failed for some other reason")
}
}
chmod_read_only(&test_executable);
match command_line_test_partial([~"test", ~"foo"], foo_workspace) {
Success(*) => (), // ok
- Fail(status) if status == 65 => fail2!("test_no_rebuilding failed: it rebuilt the tests"),
- Fail(_) => fail2!("test_no_rebuilding failed for some other reason")
+ Fail(status) if status == 65 => fail!("test_no_rebuilding failed: it rebuilt the tests"),
+ Fail(_) => fail!("test_no_rebuilding failed for some other reason")
}
}
let temp_pkg_id = git_repo_pkg();
let repo = init_git_repo(&temp_pkg_id.path);
let repo = repo.path();
- debug2!("repo = {}", repo.display());
+ debug!("repo = {}", repo.display());
let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]);
- debug2!("repo_subdir = {}", repo_subdir.display());
+ debug!("repo_subdir = {}", repo_subdir.display());
writeFile(&repo_subdir.join("main.rs"),
"fn main() { let _x = (); }");
let ws = repo.join(".rust");
// Check that all files exist
- debug2!("Checking for files in {}", ws.display());
+ debug!("Checking for files in {}", ws.display());
let exec = target_executable_in_workspace(&temp_pkg_id, &ws);
- debug2!("exec = {}", exec.display());
+ debug!("exec = {}", exec.display());
assert!(os::path_exists(&exec));
assert!(is_rwx(&exec));
let built_lib =
let temp_pkg_id = git_repo_pkg();
let repo = init_git_repo(&temp_pkg_id.path);
let repo = repo.path();
- debug2!("repo = {}", repo.display());
+ debug!("repo = {}", repo.display());
let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]);
- debug2!("repo_subdir = {}", repo_subdir.display());
+ debug!("repo_subdir = {}", repo_subdir.display());
assert!(os::mkdir_recursive(&repo.join_many([".rust", "src"]), U_RWX));
writeFile(&repo_subdir.join("main.rs"),
"mockgithub.com",
"catamorphism",
"test-pkg-0.1"]);
- debug2!("---- git clone {} {}", repo_subdir.display(), target_dir.display());
+ debug!("---- git clone {} {}", repo_subdir.display(), target_dir.display());
let c_res = safe_git_clone(&repo_subdir, &NoVersion, &target_dir);
match c_res {
- DirToUse(_) => fail2!("test_installed_local_changes failed"),
+ DirToUse(_) => fail!("test_installed_local_changes failed"),
CheckedOutSources => ()
};
writeFile(&main_crate, "pub fn main() { if 42 != ~\"the answer\" { fail!(); } }");
let result = command_line_test_partial([~"build", ~"foo"], foo_workspace);
match result {
- Success(*) => fail2!("Failed by succeeding!"), // should be a compile error
+ Success(*) => fail!("Failed by succeeding!"), // should be a compile error
Fail(status) => {
- debug2!("Failed with status {:?}... that's good, right?", status);
+ debug!("Failed with status {:?}... that's good, right?", status);
}
}
}
what: OutputType) -> Option<Path> {
assert!(in_file.component_iter().nth(1).is_some());
let input = driver::file_input(in_file.clone());
- debug2!("compile_input: {} / {:?}", in_file.display(), what);
+ debug!("compile_input: {} / {:?}", in_file.display(), what);
// tjc: by default, use the package ID name as the link name
// not sure if we should support anything else
let binary = os::args()[0].to_managed();
- debug2!("flags: {}", flags.connect(" "));
- debug2!("cfgs: {}", cfgs.connect(" "));
+ debug!("flags: {}", flags.connect(" "));
+ debug!("cfgs: {}", cfgs.connect(" "));
let csysroot = context.sysroot();
- debug2!("compile_input's sysroot = {}", csysroot.display());
+ debug!("compile_input's sysroot = {}", csysroot.display());
let crate_type = match what {
Lib => lib_crate,
+ context.flag_strs()
+ cfgs.flat_map(|c| { ~[~"--cfg", (*c).clone()] }),
driver::optgroups()).unwrap();
- debug2!("rustc flags: {:?}", matches);
+ debug!("rustc flags: {:?}", matches);
// Hack so that rustpkg can run either out of a rustc target dir,
// or the host dir
p
};
let csysroot = context.sysroot();
- debug2!("compile_input's sysroot = {}", csysroot.display());
- debug2!("sysroot_to_use = {}", sysroot_to_use.display());
+ debug!("compile_input's sysroot = {}", csysroot.display());
+ debug!("sysroot_to_use = {}", sysroot_to_use.display());
let output_type = match context.compile_upto() {
Assemble => link::output_type_assembly,
find_and_install_dependencies(context, pkg_id, in_file, sess, exec, &crate, deps,
|p| {
- debug2!("a dependency: {}", p.display());
+ debug!("a dependency: {}", p.display());
// Pass the directory containing a dependency
// as an additional lib search path
if !addl_lib_search_paths.contains(&p) {
Bench => format!("{}bench", pkg_id.short_name).to_managed(),
_ => pkg_id.short_name.to_managed()
};
- debug2!("Injecting link name: {}", name_to_use);
+ debug!("Injecting link name: {}", name_to_use);
// FIXME (#9639): This needs to handle non-utf8 paths
let link_options =
~[attr::mk_name_value_item_str(@"name", name_to_use),
~[attr::mk_name_value_item_str(@"package_id",
pkg_id.path.as_str().unwrap().to_managed())];
- debug2!("link options: {:?}", link_options);
+ debug!("link options: {:?}", link_options);
crate.attrs = ~[attr::mk_attr(attr::mk_list_item(@"link", link_options))];
}
- debug2!("calling compile_crate_from_input, workspace = {},
+ debug!("calling compile_crate_from_input, workspace = {},
building_library = {:?}", out_dir.display(), sess.building_library);
let result = compile_crate_from_input(in_file,
exec,
result
};
for p in discovered_output.iter() {
- debug2!("About to discover output {}", p.display());
+ debug!("About to discover output {}", p.display());
if os::path_exists(p) {
- debug2!("4. discovering output {}", p.display());
+ debug!("4. discovering output {}", p.display());
// FIXME (#9639): This needs to handle non-utf8 paths
exec.discover_output("binary", p.as_str().unwrap(), digest_only_date(p));
}
// Returns None if one of the flags that suppresses compilation output was
// given
crate: ast::Crate) -> Option<Path> {
- debug2!("Calling build_output_filenames with {}, building library? {:?}",
+ debug!("Calling build_output_filenames with {}, building library? {:?}",
out_dir.display(), sess.building_library);
// bad copy
- debug2!("out_dir = {}", out_dir.display());
+ debug!("out_dir = {}", out_dir.display());
let outputs = driver::build_output_filenames(&driver::file_input(input.clone()),
&Some(out_dir.clone()), &None,
crate.attrs, sess);
- debug2!("Outputs are out_filename: {} and obj_filename: {} and output type = {:?}",
+ debug!("Outputs are out_filename: {} and obj_filename: {} and output type = {:?}",
outputs.out_filename.display(),
outputs.obj_filename.display(),
sess.opts.output_type);
- debug2!("additional libraries:");
+ debug!("additional libraries:");
for lib in sess.opts.addl_lib_search_paths.iter() {
- debug2!("an additional library: {}", lib.display());
+ debug!("an additional library: {}", lib.display());
}
let analysis = driver::phase_3_run_analysis_passes(sess, &crate);
if driver::stop_after_phase_3(sess) { return None; }
// FIXME (#9639): This needs to handle non-utf8 paths
exec.discover_input("file", input.as_str().unwrap(), digest_file_with_date(input));
- debug2!("Built {}, date = {:?}", outputs.out_filename.display(),
+ debug!("Built {}, date = {:?}", outputs.out_filename.display(),
datestamp(&outputs.out_filename));
Some(outputs.out_filename)
cfgs: &[~str],
opt: bool,
what: OutputType) -> Option<Path> {
- debug2!("compile_crate: crate={}, workspace={}", crate.display(), workspace.display());
- debug2!("compile_crate: short_name = {}, flags =...", pkg_id.to_str());
+ debug!("compile_crate: crate={}, workspace={}", crate.display(), workspace.display());
+ debug!("compile_crate: short_name = {}, flags =...", pkg_id.to_str());
for fl in flags.iter() {
- debug2!("+++ {}", *fl);
+ debug!("+++ {}", *fl);
}
compile_input(ctxt, exec, pkg_id, crate, workspace, deps, flags, cfgs, opt, what)
}
Some((p, _)) => p,
None => self.sess.str_of(lib_ident)
};
- debug2!("Finding and installing... {}", lib_name);
+ debug!("Finding and installing... {}", lib_name);
// Check standard Rust library path first
match system_library(&self.context.sysroot(), lib_name) {
Some(ref installed_path) => {
- debug2!("It exists: {}", installed_path.display());
+ debug!("It exists: {}", installed_path.display());
// Say that [path for c] has a discovered dependency on
// installed_path
// For binary files, we only hash the datestamp, not the contents.
}
None => {
// FIXME #8711: need to parse version out of path_opt
- debug2!("Trying to install library {}, rebuilding it",
+ debug!("Trying to install library {}, rebuilding it",
lib_name.to_str());
// Try to install it
let pkg_id = PkgId::new(lib_name);
pkg_id.clone());
let (outputs_disc, inputs_disc) =
self.context.install(pkg_src, &JustOne(Path::new(lib_crate_filename)));
- debug2!("Installed {}, returned {:?} dependencies and \
+ debug!("Installed {}, returned {:?} dependencies and \
{:?} transitive dependencies",
lib_name, outputs_disc.len(), inputs_disc.len());
- debug2!("discovered outputs = {:?} discovered_inputs = {:?}",
+ debug!("discovered outputs = {:?} discovered_inputs = {:?}",
outputs_disc, inputs_disc);
// It must have installed *something*...
assert!(!outputs_disc.is_empty());
for dep in outputs_disc.iter() {
- debug2!("Discovering a binary input: {}", dep.display());
+ debug!("Discovering a binary input: {}", dep.display());
// FIXME (#9639): This needs to handle non-utf8 paths
self.exec.discover_input("binary",
dep.as_str().unwrap(),
// Also, add an additional search path
let dep_dir = dep.dir_path();
- debug2!("Installed {} into {}", dep.display(), dep_dir.display());
+ debug!("Installed {} into {}", dep.display(), dep_dir.display());
(self.save)(dep_dir);
}
- debug2!("Installed {}, returned {} dependencies and \
+ debug!("Installed {}, returned {} dependencies and \
{} transitive dependencies",
lib_name, outputs_disc.len(), inputs_disc.len());
// It must have installed *something*...
digest_only_date(
&Path::new(dep.as_slice())));
} else {
- fail2!("Bad kind: {}", *what);
+ fail!("Bad kind: {}", *what);
}
// Also, add an additional search path
- debug2!("Installed {} into {}",
+ debug!("Installed {} into {}",
lib_name, target_workspace.as_str().unwrap().to_owned());
(self.save)(target_workspace.clone());
}
c: &ast::Crate,
deps: &mut DepMap,
save: &fn(Path)) {
- debug2!("In find_and_install_dependencies...");
+ debug!("In find_and_install_dependencies...");
let mut visitor = ViewItemVisitor {
context: context,
parent: parent,
/// Returns the last-modified date as an Option
pub fn datestamp(p: &Path) -> Option<libc::time_t> {
- debug2!("Scrutinizing datestamp for {} - does it exist? {:?}", p.display(), os::path_exists(p));
+ debug!("Scrutinizing datestamp for {} - does it exist? {:?}", p.display(), os::path_exists(p));
let out = p.stat().map(|stat| stat.st_mtime);
- debug2!("Date = {:?}", out);
+ debug!("Date = {:?}", out);
out.map(|t| { t as libc::time_t })
}
let outp = run::process_output("git",
["--git-dir=" + git_dir.as_str().unwrap(), ~"tag", ~"-l"]);
- debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.display(), outp.status);
+ debug!("git --git-dir={} tag -l ~~~> {:?}", git_dir.display(), outp.status);
if outp.status != 0 {
continue;
let tmp_dir = TempDir::new("test");
let tmp_dir = tmp_dir.expect("try_getting_version: couldn't create temp dir");
let tmp_dir = tmp_dir.path();
- debug2!("(to get version) executing \\{git clone https://{} {}\\}",
+ debug!("(to get version) executing \\{git clone https://{} {}\\}",
remote_path.display(),
tmp_dir.display());
// FIXME (#9639): This needs to handle non-utf8 paths
remote_path.as_str().unwrap()),
tmp_dir.as_str().unwrap().to_owned()]);
if outp.status == 0 {
- debug2!("Cloned it... ( {}, {} )",
+ debug!("Cloned it... ( {}, {} )",
str::from_utf8(outp.output),
str::from_utf8(outp.error));
let mut output = None;
let git_dir = tmp_dir.join(".git");
- debug2!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}",
+ debug!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}",
git_dir.display());
// FIXME (#9639): This needs to handle non-utf8 paths
let outp = run::process_output("git",
["--git-dir=" + git_dir.as_str().unwrap(),
~"tag", ~"-l"]);
let output_text = str::from_utf8(outp.output);
- debug2!("Full output: ( {} ) [{:?}]", output_text, outp.status);
+ debug!("Full output: ( {} ) [{:?}]", output_text, outp.status);
for l in output_text.line_iter() {
- debug2!("A line of output: {}", l);
+ debug!("A line of output: {}", l);
if !l.is_whitespace() {
output = Some(l);
}
pub fn try_parsing_version(s: &str) -> Option<Version> {
let s = s.trim();
- debug2!("Attempting to parse: {}", s);
+ debug!("Attempting to parse: {}", s);
let mut parse_state = Start;
for c in s.iter() {
if char::is_digit(c) {
#[test]
fn test_split_version() {
let s = "a/b/c#0.1";
- debug2!("== {:?} ==", split_version(s));
+ debug!("== {:?} ==", split_version(s));
assert!(split_version(s) == Some((s.slice(0, 5), ExactRevision(~"0.1"))));
assert!(split_version("a/b/c") == None);
let s = "a#1.2";
/// Adds multiple discovered outputs
pub fn discover_outputs(e: &mut workcache::Exec, outputs: ~[Path]) {
- debug2!("Discovering {:?} outputs", outputs.len());
+ debug!("Discovering {:?} outputs", outputs.len());
for p in outputs.iter() {
- debug2!("Discovering output! {}", p.display());
+ debug!("Discovering output! {}", p.display());
// For now, assume that all discovered outputs are binaries
// FIXME (#9639): This needs to handle non-utf8 paths
e.discover_output("binary", p.as_str().unwrap(), digest_only_date(p));
let workspaces = pkg_parent_workspaces(cx, pkgid);
if workspaces.is_empty() {
// tjc: make this a condition
- fail2!("Package {} not found in any of \
+ fail!("Package {} not found in any of \
the following workspaces: {}",
pkgid.path.display(),
rust_path().map(|p| p.display().to_str()).to_str());
let alloc = n * (*ty).size;
let total_size = alloc + mem::size_of::<Vec<()>>();
if alloc / (*ty).size != n || total_size < alloc {
- fail2!("vector size is too large: {}", n);
+ fail!("vector size is too large: {}", n);
}
(*ptr) = local_realloc(*ptr as *(), total_size) as *mut Box<Vec<()>>;
(**ptr).data.alloc = alloc;
///
/// Fails if the CString is null.
pub fn with_ref<T>(&self, f: &fn(*libc::c_char) -> T) -> T {
- if self.buf.is_null() { fail2!("CString is null!"); }
+ if self.buf.is_null() { fail!("CString is null!"); }
f(self.buf)
}
///
/// Fails if the CString is null.
pub fn with_mut_ref<T>(&mut self, f: &fn(*mut libc::c_char) -> T) -> T {
- if self.buf.is_null() { fail2!("CString is null!"); }
+ if self.buf.is_null() { fail!("CString is null!"); }
f(unsafe { cast::transmute_mut_unsafe(self.buf) })
}
/// Fails if the CString is null.
#[inline]
pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
- if self.buf.is_null() { fail2!("CString is null!"); }
+ if self.buf.is_null() { fail!("CString is null!"); }
unsafe {
cast::transmute((self.buf, self.len() + 1))
}
do self.as_imm_buf |self_buf, self_len| {
let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8;
if buf.is_null() {
- fail2!("failed to allocate memory!");
+ fail!("failed to allocate memory!");
}
ptr::copy_memory(buf, self_buf, self_len);
pub fn take(&self) -> T {
let this = unsafe { transmute_mut(self) };
if this.is_empty() {
- fail2!("attempt to take an empty cell");
+ fail!("attempt to take an empty cell");
}
this.value.take_unwrap()
pub fn put_back(&self, value: T) {
let this = unsafe { transmute_mut(self) };
if !this.is_empty() {
- fail2!("attempt to put a value back into a full cell");
+ fail!("attempt to put a value back into a full cell");
}
this.value = Some(value);
}
#[inline]
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
if radix > 36 {
- fail2!("to_digit: radix {} is to high (maximum 36)", radix);
+ fail!("to_digit: radix {} is to high (maximum 36)", radix);
}
let val = match c {
'0' .. '9' => c as uint - ('0' as uint),
#[inline]
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
if radix > 36 {
- fail2!("from_digit: radix {} is to high (maximum 36)", num);
+ fail!("from_digit: radix {} is to high (maximum 36)", num);
}
if num < radix {
unsafe {
_ if code < MAX_TWO_B => 2u,
_ if code < MAX_THREE_B => 3u,
_ if code < MAX_FOUR_B => 4u,
- _ => fail2!("invalid character!"),
+ _ => fail!("invalid character!"),
}
}
if debug_mem() {
// We do logging here w/o allocation.
- debug2!("annihilator stats:\n \
+ debug!("annihilator stats:\n \
total boxes: {}\n \
unique boxes: {}\n \
bytes freed: {}",
Condition handling is useful in cases where propagating errors is either to
cumbersome or just not necessary in the first place. It should also be noted,
though, that if there is not handler installed when a condition is raised, then
-the task invokes `fail2!()` and will terminate.
+the task invokes `fail!()` and will terminate.
## More Info
/// function will not return.
pub fn raise(&self, t: T) -> U {
let msg = format!("Unhandled condition: {}: {:?}", self.name, t);
- self.raise_default(t, || fail2!("{}", msg.clone()))
+ self.raise_default(t, || fail!("{}", msg.clone()))
}
/// Performs the same functionality as `raise`, except that when no handler
pub fn raise_default(&self, t: T, default: &fn() -> U) -> U {
match local_data::pop(self.key) {
None => {
- debug2!("Condition.raise: found no handler");
+ debug!("Condition.raise: found no handler");
default()
}
Some(handler) => {
- debug2!("Condition.raise: found handler");
+ debug!("Condition.raise: found handler");
match handler.prev {
None => {}
Some(hp) => local_data::set(self.key, hp)
/// ```
pub fn inside<V>(&self, inner: &'self fn() -> V) -> V {
let _g = Guard { cond: self.cond };
- debug2!("Trap: pushing handler to TLS");
+ debug!("Trap: pushing handler to TLS");
local_data::set(self.cond.key, self.handler);
inner()
}
#[unsafe_destructor]
impl<'self, T, U> Drop for Guard<'self, T, U> {
fn drop(&mut self) {
- debug2!("Guard: popping handler from TLS");
+ debug!("Guard: popping handler from TLS");
let curr = local_data::pop(self.cond.key);
match curr {
None => {}
}
fn trouble(i: int) {
- debug2!("trouble: raising condition");
+ debug!("trouble: raising condition");
let j = sadness::cond.raise(i);
- debug2!("trouble: handler recovered with {}", j);
+ debug!("trouble: handler recovered with {}", j);
}
fn nested_trap_test_inner() {
let mut inner_trapped = false;
do sadness::cond.trap(|_j| {
- debug2!("nested_trap_test_inner: in handler");
+ debug!("nested_trap_test_inner: in handler");
inner_trapped = true;
0
}).inside {
- debug2!("nested_trap_test_inner: in protected block");
+ debug!("nested_trap_test_inner: in protected block");
trouble(1);
}
let mut outer_trapped = false;
do sadness::cond.trap(|_j| {
- debug2!("nested_trap_test_outer: in handler");
+ debug!("nested_trap_test_outer: in handler");
outer_trapped = true; 0
}).inside {
- debug2!("nested_guard_test_outer: in protected block");
+ debug!("nested_guard_test_outer: in protected block");
nested_trap_test_inner();
trouble(1);
}
let mut inner_trapped = false;
do sadness::cond.trap(|_j| {
- debug2!("nested_reraise_trap_test_inner: in handler");
+ debug!("nested_reraise_trap_test_inner: in handler");
inner_trapped = true;
let i = 10;
- debug2!("nested_reraise_trap_test_inner: handler re-raising");
+ debug!("nested_reraise_trap_test_inner: handler re-raising");
sadness::cond.raise(i)
}).inside {
- debug2!("nested_reraise_trap_test_inner: in protected block");
+ debug!("nested_reraise_trap_test_inner: in protected block");
trouble(1);
}
let mut outer_trapped = false;
do sadness::cond.trap(|_j| {
- debug2!("nested_reraise_trap_test_outer: in handler");
+ debug!("nested_reraise_trap_test_outer: in handler");
outer_trapped = true; 0
}).inside {
- debug2!("nested_reraise_trap_test_outer: in protected block");
+ debug!("nested_reraise_trap_test_outer: in protected block");
nested_reraise_trap_test_inner();
}
let mut trapped = false;
do sadness::cond.trap(|j| {
- debug2!("test_default: in handler");
+ debug!("test_default: in handler");
sadness::cond.raise_default(j, || { trapped=true; 5 })
}).inside {
- debug2!("test_default: in protected block");
+ debug!("test_default: in protected block");
trouble(1);
}
pub fn expect_left(self, reason: &str) -> L {
match self {
Left(x) => x,
- Right(_) => fail2!("{}", reason.to_owned())
+ Right(_) => fail!("{}", reason.to_owned())
}
}
pub fn expect_right(self, reason: &str) -> R {
match self {
Right(x) => x,
- Left(_) => fail2!("{}", reason.to_owned())
+ Left(_) => fail!("{}", reason.to_owned())
}
}
}
while t < 64 {
- debug2!("siphash test {}", t);
+ debug!("siphash test {}", t);
let vec = u8to64_le!(vecs[t], 0);
let out = Bytes(buf.as_slice()).hash_keyed(k0, k1);
- debug2!("got {:?}, expected {:?}", out, vec);
+ debug!("got {:?}, expected {:?}", out, vec);
assert_eq!(vec, out);
stream_full.reset();
let f = stream_full.result_str();
let i = stream_inc.result_str();
let v = to_hex_str(&vecs[t]);
- debug2!("{}: ({}) => inc={} full={}", t, v, i, f);
+ debug!("{}: ({}) => inc={} full={}", t, v, i, f);
assert!(f == i && f == v);
fn value_for_bucket<'a>(&'a self, idx: uint) -> &'a V {
match self.buckets[idx] {
Some(ref bkt) => &bkt.value,
- None => fail2!("HashMap::find: internal logic error"),
+ None => fail!("HashMap::find: internal logic error"),
}
}
/// True if there was no previous entry with that key
fn insert_internal(&mut self, hash: uint, k: K, v: V) -> Option<V> {
match self.bucket_for_key_with_hash(hash, &k) {
- TableFull => { fail2!("Internal logic error"); }
+ TableFull => { fail!("Internal logic error"); }
FoundHole(idx) => {
self.buckets[idx] = Some(Bucket{hash: hash, key: k,
value: v});
}
FoundEntry(idx) => {
match self.buckets[idx] {
- None => { fail2!("insert_internal: Internal logic error") }
+ None => { fail!("insert_internal: Internal logic error") }
Some(ref mut b) => {
b.hash = hash;
b.key = k;
let hash = k.hash_keyed(self.k0, self.k1) as uint;
let idx = match self.bucket_for_key_with_hash(hash, &k) {
- TableFull => fail2!("Internal logic error"),
+ TableFull => fail!("Internal logic error"),
FoundEntry(idx) => { found(&k, self.mut_value_for_bucket(idx), a); idx }
FoundHole(idx) => {
let v = not_found(&k, a);
pub fn get<'a>(&'a self, k: &K) -> &'a V {
match self.find(k) {
Some(v) => v,
- None => fail2!("No entry found for key: {:?}", k),
+ None => fail!("No entry found for key: {:?}", k),
}
}
pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
match self.find_mut(k) {
Some(v) => v,
- None => fail2!("No entry found for key: {:?}", k),
+ None => fail!("No entry found for key: {:?}", k),
}
}
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));
}
assert!(m.find(&1).is_none());
m.insert(1, 2);
match m.find(&1) {
- None => fail2!(),
+ None => fail!(),
Some(v) => assert!(*v == 2)
}
}
match libc::ferror(*self) {
0 => (),
_ => {
- error2!("error reading buffer: {}", os::last_os_error());
- fail2!();
+ error!("error reading buffer: {}", os::last_os_error());
+ fail!();
}
}
}
len as size_t,
*self);
if nout != len as size_t {
- error2!("error writing buffer: {}", os::last_os_error());
- fail2!();
+ error!("error writing buffer: {}", os::last_os_error());
+ fail!();
}
}
}
let vb = ptr::offset(vbuf, count as int) as *c_void;
let nout = libc::write(*self, vb, len as IoSize);
if nout < 0 as IoRet {
- error2!("error writing buffer: {}", os::last_os_error());
- fail2!();
+ error!("error writing buffer: {}", os::last_os_error());
+ fail!();
}
count += nout as uint;
}
}
}
fn seek(&self, _offset: int, _whence: SeekStyle) {
- error2!("need 64-bit foreign calls for seek, sorry");
- fail2!();
+ error!("need 64-bit foreign calls for seek, sorry");
+ fail!();
}
fn tell(&self) -> uint {
- error2!("need 64-bit foreign calls for tell, sorry");
- fail2!();
+ error!("need 64-bit foreign calls for tell, sorry");
+ fail!();
}
fn flush(&self) -> int { 0 }
fn get_type(&self) -> WriterType {
#[test]
fn test_simple() {
let tmpfile = &Path::new("tmp/lib-io-test-simple.tmp");
- debug2!("{}", tmpfile.display());
+ debug!("{}", tmpfile.display());
let frood: ~str =
~"A hoopy frood who really knows where his towel is.";
- debug2!("{}", frood.clone());
+ debug!("{}", frood.clone());
{
let out = io::file_writer(tmpfile, [io::Create, io::Truncate]).unwrap();
out.write_str(frood);
}
let inp = io::file_reader(tmpfile).unwrap();
let frood2: ~str = inp.read_c_str();
- debug2!("{}", frood2.clone());
+ debug!("{}", frood2.clone());
assert_eq!(frood, frood2);
}
{
let file = io::file_reader(&path).unwrap();
do file.each_byte() |_| {
- fail2!("must be empty")
+ fail!("must be empty")
};
}
{
let file = io::file_reader(&path).unwrap();
do file.each_char() |_| {
- fail2!("must be empty")
+ fail!("must be empty")
};
}
}
Err(e) => {
assert_eq!(e, ~"error opening not a file");
}
- Ok(_) => fail2!()
+ Ok(_) => fail!()
}
}
Err(e) => {
assert!(e.starts_with("error opening"));
}
- Ok(_) => fail2!()
+ Ok(_) => fail!()
}
}
Some(x) => {
i = match i.checked_sub(&1) {
Some(x) => x,
- None => fail2!("rposition: incorrect ExactSize")
+ None => fail!("rposition: incorrect ExactSize")
};
if predicate(x) {
return Some(i)
assert!(v.iter().all(|&x| x < 10));
assert!(!v.iter().all(|&x| x.is_even()));
assert!(!v.iter().all(|&x| x > 100));
- assert!(v.slice(0, 0).iter().all(|_| fail2!()));
+ assert!(v.slice(0, 0).iter().all(|_| fail!()));
}
#[test]
assert!(v.iter().any(|&x| x < 10));
assert!(v.iter().any(|&x| x.is_even()));
assert!(!v.iter().any(|&x| x > 100));
- assert!(!v.slice(0, 0).iter().any(|_| fail2!()));
+ assert!(!v.slice(0, 0).iter().any(|_| fail!()));
}
#[test]
let mut i = 0;
do v.iter().rposition |_elt| {
if i == 2 {
- fail2!()
+ fail!()
}
i += 1;
false
fn test_double_ended_range() {
assert_eq!(range(11i, 14).invert().collect::<~[int]>(), ~[13i, 12, 11]);
for _ in range(10i, 0).invert() {
- fail2!("unreachable");
+ fail!("unreachable");
}
assert_eq!(range(11u, 14).invert().collect::<~[uint]>(), ~[13u, 12, 11]);
for _ in range(10u, 0).invert() {
- fail2!("unreachable");
+ fail!("unreachable");
}
}
match *entry {
Some((k, _, loan)) if k == key_value => {
if loan != NoLoan {
- fail2!("TLS value cannot be removed because it is currently \
+ fail!("TLS value cannot be removed because it is currently \
borrowed as {}", loan.describe());
}
// Move the data out of the `entry` slot via util::replace.
}
(ImmLoan, ImmLoan) => {}
(want, cur) => {
- fail2!("TLS slot cannot be borrowed as {} because \
+ fail!("TLS slot cannot be borrowed as {} because \
it is already borrowed as {}",
want.describe(), cur.describe());
}
match *entry {
Some((ekey, _, loan)) if key == ekey => {
if loan != NoLoan {
- fail2!("TLS value cannot be overwritten because it is
+ fail!("TLS value cannot be overwritten because it is
already borrowed as {}", loan.describe())
}
true
static my_key: Key<@~str> = &Key;
modify(my_key, |data| {
match data {
- Some(@ref val) => fail2!("unwelcome value: {}", *val),
+ Some(@ref val) => fail!("unwelcome value: {}", *val),
None => Some(@~"first data")
}
});
modify(my_key, |data| {
match data {
Some(@~"first data") => Some(@~"next data"),
- Some(@ref val) => fail2!("wrong value: {}", *val),
- None => fail2!("missing value")
+ Some(@ref val) => fail!("wrong value: {}", *val),
+ None => fail!("missing value")
}
});
assert!(*(pop(my_key).unwrap()) == ~"next data");
set(str_key, @~"string data");
set(box_key, @@());
set(int_key, @42);
- fail2!();
+ fail!();
}
// Not quite nondeterministic.
set(int_key, @31337);
- fail2!();
+ fail!();
}
#[test]
fn to_str_radix(&self, rdx: uint) -> ~str {
let (r, special) = strconv::float_to_str_common(
*self, rdx, true, strconv::SignNeg, strconv::DigAll);
- if special { fail2!("number has a special value, \
+ if special { fail!("number has a special value, \
try to_str_radix_special() if those are expected") }
r
}
fn to_str_radix(&self, rdx: uint) -> ~str {
let (r, special) = strconv::float_to_str_common(
*self, rdx, true, strconv::SignNeg, strconv::DigAll);
- if special { fail2!("number has a special value, \
+ if special { fail!("number has a special value, \
try to_str_radix_special() if those are expected") }
r
}
) -> Option<T> {
match exponent {
ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e'
- => fail2!("from_str_bytes_common: radix {:?} incompatible with \
+ => fail!("from_str_bytes_common: radix {:?} incompatible with \
use of 'e' as decimal exponent", radix),
ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p'
- => fail2!("from_str_bytes_common: radix {:?} incompatible with \
+ => fail!("from_str_bytes_common: radix {:?} incompatible with \
use of 'p' as binary exponent", radix),
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
- => fail2!("from_str_bytes_common: radix {:?} incompatible with \
+ => fail!("from_str_bytes_common: radix {:?} incompatible with \
special values 'inf' and 'NaN'", radix),
_ if (radix as int) < 2
- => fail2!("from_str_bytes_common: radix {:?} to low, \
+ => fail!("from_str_bytes_common: radix {:?} to low, \
must lie in the range [2, 36]", radix),
_ if (radix as int) > 36
- => fail2!("from_str_bytes_common: radix {:?} to high, \
+ => fail!("from_str_bytes_common: radix {:?} to high, \
must lie in the range [2, 36]", radix),
_ => ()
}
pub fn get_ref<'a>(&'a self) -> &'a T {
match *self {
Some(ref x) => x,
- None => fail2!("called `Option::get_ref()` on a `None` value"),
+ None => fail!("called `Option::get_ref()` on a `None` value"),
}
}
pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
match *self {
Some(ref mut x) => x,
- None => fail2!("called `Option::get_mut_ref()` on a `None` value"),
+ None => fail!("called `Option::get_mut_ref()` on a `None` value"),
}
}
pub fn unwrap(self) -> T {
match self {
Some(x) => x,
- None => fail2!("called `Option::unwrap()` on a `None` value"),
+ None => fail!("called `Option::unwrap()` on a `None` value"),
}
}
#[inline]
pub fn take_unwrap(&mut self) -> T {
if self.is_none() {
- fail2!("called `Option::take_unwrap()` on a `None` value")
+ fail!("called `Option::take_unwrap()` on a `None` value")
}
self.take().unwrap()
}
pub fn expect(self, reason: &str) -> T {
match self {
Some(val) => val,
- None => fail2!("{}", reason.to_owned()),
+ None => fail!("{}", reason.to_owned()),
}
}
#[test]
#[should_fail]
- fn test_unwrap_fail2() {
+ fn test_unwrap_fail() {
let x: Option<~str> = None;
x.unwrap();
}
do buf.as_mut_buf |buf, len| {
unsafe {
if libc::getcwd(buf, len as size_t).is_null() {
- fail2!()
+ fail!()
}
Path::new(CString::new(buf as *c_char, false))
do buf.as_mut_buf |buf, len| {
unsafe {
if libc::GetCurrentDirectoryW(len as DWORD, buf) == 0 as DWORD {
- fail2!();
+ fail!();
}
}
}
};
let ch = GetEnvironmentStringsA();
if (ch as uint == 0) {
- fail2!("os::env() failure getting env string from OS: {}",
+ fail!("os::env() failure getting env string from OS: {}",
os::last_os_error());
}
let result = str::raw::from_c_multistring(ch as *libc::c_char, None);
}
let environ = rust_env_pairs();
if (environ as uint == 0) {
- fail2!("os::env() failure getting env string from OS: {}",
+ fail!("os::env() failure getting env string from OS: {}",
os::last_os_error());
}
let mut result = ~[];
ptr::array_each(environ, |e| {
let env_pair = str::raw::from_c_str(e);
- debug2!("get_env_pairs: {}", env_pair);
+ debug!("get_env_pairs: {}", env_pair);
result.push(env_pair);
});
result
let mut pairs = ~[];
for p in input.iter() {
let vs: ~[&str] = p.splitn_iter('=', 1).collect();
- debug2!("splitting: len: {}", vs.len());
+ debug!("splitting: len: {}", vs.len());
assert_eq!(vs.len(), 2);
pairs.push((vs[0].to_owned(), vs[1].to_owned()));
}
fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char;
}
let mut paths = ~[];
- debug2!("os::list_dir -- BEFORE OPENDIR");
+ debug!("os::list_dir -- BEFORE OPENDIR");
let dir_ptr = do p.with_c_str |buf| {
opendir(buf)
};
if (dir_ptr as uint != 0) {
- debug2!("os::list_dir -- opendir() SUCCESS");
+ debug!("os::list_dir -- opendir() SUCCESS");
let mut entry_ptr = readdir(dir_ptr);
while (entry_ptr as uint != 0) {
let cstr = CString::new(rust_list_dir_val(entry_ptr), false);
closedir(dir_ptr);
}
else {
- debug2!("os::list_dir -- opendir() FAILURE");
+ debug!("os::list_dir -- opendir() FAILURE");
}
- debug2!("os::list_dir -- AFTER -- \\#: {}", paths.len());
+ debug!("os::list_dir -- AFTER -- \\#: {}", paths.len());
paths
}
#[cfg(windows)]
while more_files != 0 {
let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr);
if fp_buf as uint == 0 {
- fail2!("os::list_dir() failure: got null ptr from wfd");
+ fail!("os::list_dir() failure: got null ptr from wfd");
}
else {
let fp_vec = vec::from_buf(
do buf.as_mut_buf |buf, len| {
unsafe {
if strerror_r(errno() as c_int, buf, len as size_t) < 0 {
- fail2!("strerror_r failure");
+ fail!("strerror_r failure");
}
str::raw::from_c_str(buf as *c_char)
len as DWORD,
ptr::null());
if res == 0 {
- fail2!("[{}] FormatMessage failure", errno());
+ fail!("[{}] FormatMessage failure", errno());
}
}
match rt::args::clone() {
Some(args) => args,
- None => fail2!("process arguments not initialized")
+ None => fail!("process arguments not initialized")
}
}
match libc::munmap(self.data as *c_void, self.len) {
0 => (),
-1 => match errno() as c_int {
- libc::EINVAL => error2!("invalid addr or len"),
- e => error2!("unknown errno={}", e)
+ libc::EINVAL => error!("invalid addr or len"),
+ e => error!("unknown errno={}", e)
},
- r => error2!("Unexpected result {}", r)
+ r => error!("Unexpected result {}", r)
}
}
}
if libc::VirtualFree(self.data as *mut c_void,
self.len,
libc::MEM_RELEASE) == FALSE {
- error2!("VirtualFree failed: {}", errno());
+ error!("VirtualFree failed: {}", errno());
}
},
MapFile(mapping) => {
if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE {
- error2!("UnmapViewOfFile failed: {}", errno());
+ error!("UnmapViewOfFile failed: {}", errno());
}
if libc::CloseHandle(mapping as HANDLE) == FALSE {
- error2!("CloseHandle failed: {}", errno());
+ error!("CloseHandle failed: {}", errno());
}
}
}
#[test]
pub fn last_os_error() {
- debug2!("{}", os::last_os_error());
+ debug!("{}", os::last_os_error());
}
#[test]
}
let n = make_rand_name();
setenv(n, s);
- debug2!("{}", s.clone());
+ debug!("{}", s.clone());
assert_eq!(getenv(n), option::Some(s));
}
let path = os::self_exe_path();
assert!(path.is_some());
let path = path.unwrap();
- debug2!("{:?}", path.clone());
+ debug!("{:?}", path.clone());
// Hard to test this function
assert!(path.is_absolute());
assert!(e.len() > 0u);
for p in e.iter() {
let (n, v) = (*p).clone();
- debug2!("{:?}", n.clone());
+ debug!("{:?}", n.clone());
let v2 = getenv(n);
// MingW seems to set some funky environment variables like
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
assert!((!Path::new("test-path").is_absolute()));
let cwd = getcwd();
- debug2!("Current working directory: {}", cwd.display());
+ debug!("Current working directory: {}", cwd.display());
- debug2!("{:?}", make_absolute(&Path::new("test-path")));
- debug2!("{:?}", make_absolute(&Path::new("/usr/bin")));
+ debug!("{:?}", make_absolute(&Path::new("test-path")));
+ debug!("{:?}", make_absolute(&Path::new("/usr/bin")));
}
#[test]
assert!(dirs.len() > 0u);
for dir in dirs.iter() {
- debug2!("{:?}", (*dir).clone());
+ debug!("{:?}", (*dir).clone());
}
}
let mut dirpath = os::tmpdir();
dirpath.push(format!("rust-test-{}/test-\uac00\u4e00\u30fc\u4f60\u597d",
rand::random::<u32>())); // ê°€ä¸€ãƒ¼ä½ å¥½
- debug2!("path_is_dir dirpath: {}", dirpath.display());
+ debug!("path_is_dir dirpath: {}", dirpath.display());
let mkdir_result = os::mkdir_recursive(&dirpath, (S_IRUSR | S_IWUSR | S_IXUSR) as i32);
- debug2!("path_is_dir mkdir_result: {}", mkdir_result);
+ debug!("path_is_dir mkdir_result: {}", mkdir_result);
assert!((os::path_is_dir(&dirpath)));
let mut filepath = dirpath;
filepath.push("unicode-file-\uac00\u4e00\u30fc\u4f60\u597d.rs");
- debug2!("path_is_dir filepath: {}", filepath.display());
+ debug!("path_is_dir filepath: {}", filepath.display());
open(&filepath, OpenOrCreate, Read); // ignore return; touch only
assert!((!os::path_is_dir(&filepath)));
let in_mode = input.get_mode();
let rs = os::copy_file(&input, &out);
if (!os::path_exists(&input)) {
- fail2!("{} doesn't exist", input.display());
+ fail!("{} doesn't exist", input.display());
}
assert!((rs));
// FIXME (#9639): This needs to handle non-utf8 paths
os::MapWritable
]) {
Ok(chunk) => chunk,
- Err(msg) => fail2!(msg.to_str())
+ Err(msg) => fail!(msg.to_str())
};
assert!(chunk.len >= 16);
MapOffset(size / 2)
]) {
Ok(chunk) => chunk,
- Err(msg) => fail2!(msg.to_str())
+ Err(msg) => fail!(msg.to_str())
};
assert!(chunk.len > 0);
```rust
let mut path = Path::new("/tmp/path");
-debug2!("path: {}", path.display());
+debug!("path: {}", path.display());
path.set_filename("foo");
path.push("bar");
-debug2!("new path: {}", path.display());
+debug!("new path: {}", path.display());
let b = std::os::path_exists(&path);
-debug2!("path exists: {}", b);
+debug!("path exists: {}", b);
```
*/
SAFETY NOTE: Pointer-arithmetic. Dragons be here.
*/
pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
- debug2!("array_each_with_len: before iterate");
+ debug!("array_each_with_len: before iterate");
if (arr as uint == 0) {
- fail2!("ptr::array_each_with_len failure: arr input is null pointer");
+ fail!("ptr::array_each_with_len failure: arr input is null pointer");
}
//let start_ptr = *arr;
for e in range(0, len) {
let n = offset(arr, e as int);
cb(*n);
}
- debug2!("array_each_with_len: after iterate");
+ debug!("array_each_with_len: after iterate");
}
/**
*/
pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
if (arr as uint == 0) {
- fail2!("ptr::array_each_with_len failure: arr input is null pointer");
+ fail!("ptr::array_each_with_len failure: arr input is null pointer");
}
let len = buf_len(arr);
- debug2!("array_each inferred len: {}", len);
+ debug!("array_each inferred len: {}", len);
array_each_with_len(arr, len, cb);
}
let expected = do expected_arr[ctr].with_ref |buf| {
str::raw::from_c_str(buf)
};
- debug2!(
+ debug!(
"test_ptr_array_each_with_len e: {}, a: {}",
expected, actual);
assert_eq!(actual, expected);
let expected = do expected_arr[ctr].with_ref |buf| {
str::raw::from_c_str(buf)
};
- debug2!(
+ debug!(
"test_ptr_array_each e: {}, a: {}",
expected, actual);
assert_eq!(actual, expected);
*b = (rand >> 8) as u8;
*c = (rand >> 16) as u8;
}
- _ => fail2!("Rng.fill_bytes: the impossible occurred: remaining != 1, 2 or 3")
+ _ => fail!("Rng.fill_bytes: the impossible occurred: remaining != 1, 2 or 3")
}
}
let mut r = rng();
let a = r.gen::<f64>();
let b = r.gen::<f64>();
- debug2!("{:?}", (a, b));
+ debug!("{:?}", (a, b));
}
#[test]
#[test]
fn test_gen_ascii_str() {
let mut r = rng();
- debug2!("{}", r.gen_ascii_str(10u));
- debug2!("{}", r.gen_ascii_str(10u));
- debug2!("{}", r.gen_ascii_str(10u));
+ debug!("{}", r.gen_ascii_str(10u));
+ debug!("{}", r.gen_ascii_str(10u));
+ debug!("{}", r.gen_ascii_str(10u));
assert_eq!(r.gen_ascii_str(0u).len(), 0u);
assert_eq!(r.gen_ascii_str(10u).len(), 10u);
assert_eq!(r.gen_ascii_str(16u).len(), 16u);
if v.len() == 0 { return }
match self.reader.read(v) {
Some(n) if n == v.len() => return,
- Some(n) => fail2!("ReaderRng.fill_bytes could not fill buffer: \
+ Some(n) => fail!("ReaderRng.fill_bytes could not fill buffer: \
read {} out of {} bytes.", n, v.len()),
- None => fail2!("ReaderRng.fill_bytes reached eof.")
+ None => fail!("ReaderRng.fill_bytes reached eof.")
}
}
}
} else if mtbl == 1 {
// skip, this is ast::m_imm
} else {
- fail2!("invalid mutability value");
+ fail!("invalid mutability value");
}
}
// Type no longer exists, vestigial function.
fn visit_estr_fixed(&mut self, _n: uint, _sz: uint,
- _align: uint) -> bool { fail2!(); }
+ _align: uint) -> bool { fail!(); }
fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
self.writer.write(['@' as u8]);
}
// Type no longer exists, vestigial function.
- fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail2!(); }
+ fn visit_vec(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { fail!(); }
fn visit_unboxed_vec(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
do self.get::<raw::Vec<()>> |this, b| {
_align: uint)
-> bool {
match self.var_stk.pop() {
- SearchingFor(*) => fail2!("enum value matched no variant"),
+ SearchingFor(*) => fail!("enum value matched no variant"),
_ => true
}
}
pub fn get_ref<'a>(&'a self) -> &'a T {
match *self {
Ok(ref t) => t,
- Err(ref e) => fail2!("called `Result::get_ref()` on `Err` value: {}",
+ Err(ref e) => fail!("called `Result::get_ref()` on `Err` value: {}",
e.to_str()),
}
}
pub fn unwrap(self) -> T {
match self {
Ok(t) => t,
- Err(e) => fail2!("called `Result::unwrap()` on `Err` value: {}",
+ Err(e) => fail!("called `Result::unwrap()` on `Err` value: {}",
e.to_str()),
}
}
pub fn expect(self, reason: &str) -> T {
match self {
Ok(t) => t,
- Err(_) => fail2!("{}", reason.to_owned()),
+ Err(_) => fail!("{}", reason.to_owned()),
}
}
pub fn expect_err(self, reason: &str) -> E {
match self {
Err(e) => e,
- Ok(_) => fail2!("{}", reason.to_owned()),
+ Ok(_) => fail!("{}", reason.to_owned()),
}
}
Err(2));
// test that it does not take more elements than it needs
- let functions = [|| Ok(()), || Err(1), || fail2!()];
+ let functions = [|| Ok(()), || Err(1), || fail!()];
assert_eq!(collect(functions.iter().map(|f| (*f)())),
Err(1));
Err(2));
// test that it does not take more elements than it needs
- let functions = [|| Ok(()), || Err(1), || fail2!()];
+ let functions = [|| Ok(()), || Err(1), || fail!()];
assert_eq!(fold_(functions.iter()
.map(|f| (*f)())),
}
pub fn take() -> Option<~[~str]> {
- fail2!()
+ fail!()
}
pub fn put(_args: ~[~str]) {
- fail2!()
+ fail!()
}
pub fn clone() -> Option<~[~str]> {
- fail2!()
+ fail!()
}
}
match self.try_recv() {
Some(val) => val,
None => {
- fail2!("receiving on closed channel");
+ fail!("receiving on closed channel");
}
}
}
match self.try_recv() {
Some(val) => val,
None => {
- fail2!("receiving on closed channel");
+ fail!("receiving on closed channel");
}
}
}
match self.try_recv() {
Some(val) => val,
None => {
- fail2!("receiving on a closed channel");
+ fail!("receiving on a closed channel");
}
}
}
do_iter_crate_map(*child, |x| f(x), visited);
}
},
- _ => fail2!("invalid crate map version")
+ _ => fail!("invalid crate map version")
}
}
}
struct PortReader<P>;
impl<P: GenericPort<~[u8]>> PortReader<P> {
- pub fn new(_port: P) -> PortReader<P> { fail2!() }
+ pub fn new(_port: P) -> PortReader<P> { fail!() }
}
impl<P: GenericPort<~[u8]>> Reader for PortReader<P> {
- fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail2!() }
+ fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail!() }
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
struct ChanWriter<C>;
impl<C: GenericChan<~[u8]>> ChanWriter<C> {
- pub fn new(_chan: C) -> ChanWriter<C> { fail2!() }
+ pub fn new(_chan: C) -> ChanWriter<C> { fail!() }
}
impl<C: GenericChan<~[u8]>> Writer for ChanWriter<C> {
- fn write(&mut self, _buf: &[u8]) { fail2!() }
+ fn write(&mut self, _buf: &[u8]) { fail!() }
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
struct ReaderPort<R>;
impl<R: Reader> ReaderPort<R> {
- pub fn new(_reader: R) -> ReaderPort<R> { fail2!() }
+ pub fn new(_reader: R) -> ReaderPort<R> { fail!() }
}
impl<R: Reader> GenericPort<~[u8]> for ReaderPort<R> {
- fn recv(&self) -> ~[u8] { fail2!() }
+ fn recv(&self) -> ~[u8] { fail!() }
- fn try_recv(&self) -> Option<~[u8]> { fail2!() }
+ fn try_recv(&self) -> Option<~[u8]> { fail!() }
}
struct WriterChan<W>;
impl<W: Writer> WriterChan<W> {
- pub fn new(_writer: W) -> WriterChan<W> { fail2!() }
+ pub fn new(_writer: W) -> WriterChan<W> { fail!() }
}
impl<W: Writer> GenericChan<~[u8]> for WriterChan<W> {
- fn send(&self, _x: ~[u8]) { fail2!() }
+ fn send(&self, _x: ~[u8]) { fail!() }
}
let mut buf = [0];
match self.read(buf) {
Some(0) => {
- debug2!("read 0 bytes. trying again");
+ debug!("read 0 bytes. trying again");
self.read_byte()
}
Some(1) => Some(buf[0]),
/// }).inside {
/// let stream = match open(p, Create, ReadWrite) {
/// Some(s) => s,
-/// None => fail2!("whoops! I'm sure this raised, anyways..");
+/// None => fail!("whoops! I'm sure this raised, anyways..");
/// }
/// // do some stuff with that stream
///
/// }).inside {
/// let info = match stat(p) {
/// Some(s) => s,
-/// None => fail2!("whoops! I'm sure this raised, anyways..");
+/// None => fail!("whoops! I'm sure this raised, anyways..");
/// }
/// if stat.is_file {
/// // just imagine the possibilities ...
/// else { cb(entry); }
/// }
/// }
-/// else { fail2!("nope"); }
+/// else { fail!("nope"); }
/// }
///
/// # Errors
/// else { cb(entry); }
/// }
/// }
-/// else { fail2!("nope"); }
+/// else { fail!("nope"); }
/// }
/// ```
pub trait DirectoryInfo : FileSystemInfo {
let mut read_stream = open(filename, Open, Read).unwrap();
let mut read_buf = [0, .. 1028];
let read_str = match read_stream.read(read_buf).unwrap() {
- -1|0 => fail2!("shouldn't happen"),
+ -1|0 => fail!("shouldn't happen"),
n => str::from_utf8(read_buf.slice_to(n))
};
assert!(read_str == message.to_owned());
}
let stat_res = match stat(filename) {
Some(s) => s,
- None => fail2!("shouldn't happen")
+ None => fail!("shouldn't happen")
};
assert!(stat_res.is_file);
unlink(filename);
mkdir(filename);
let stat_res = match stat(filename) {
Some(s) => s,
- None => fail2!("shouldn't happen")
+ None => fail!("shouldn't happen")
};
assert!(stat_res.is_dir);
rmdir(filename);
r.read(mem);
let read_str = str::from_utf8(mem);
let expected = match n {
- None|Some("") => fail2!("really shouldn't happen.."),
+ None|Some("") => fail!("really shouldn't happen.."),
Some(n) => prefix+n
};
assert!(expected == read_str);
f.unlink();
}
},
- None => fail2!("shouldn't happen")
+ None => fail!("shouldn't happen")
}
dir.rmdir();
}
}
impl<W: Writer> Writer for DeflateWriter<W> {
- fn write(&mut self, _buf: &[u8]) { fail2!() }
+ fn write(&mut self, _buf: &[u8]) { fail!() }
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
impl<W: Writer> Decorator<W> for DeflateWriter<W> {
}
impl<R: Reader> Reader for InflateReader<R> {
- fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail2!() }
+ fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail!() }
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
impl<R: Reader> Decorator<R> for InflateReader<R> {
impl Seek for MemWriter {
fn tell(&self) -> u64 { self.buf.len() as u64 }
- fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() }
+ fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() }
}
impl Decorator<~[u8]> for MemWriter {
impl Seek for MemReader {
fn tell(&self) -> u64 { self.pos as u64 }
- fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() }
+ fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() }
}
impl Decorator<~[u8]> for MemReader {
}
impl<'self> Writer for BufWriter<'self> {
- fn write(&mut self, _buf: &[u8]) { fail2!() }
+ fn write(&mut self, _buf: &[u8]) { fail!() }
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
impl<'self> Seek for BufWriter<'self> {
- fn tell(&self) -> u64 { fail2!() }
+ fn tell(&self) -> u64 { fail!() }
- fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() }
+ fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() }
}
impl<'self> Seek for BufReader<'self> {
fn tell(&self) -> u64 { self.pos as u64 }
- fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() }
+ fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail!() }
}
///Calls a function with a MemWriter and returns
detail: None
}
}
- _ => fail2!()
+ _ => fail!()
}
}
assert_eq!(buf[2], 's' as u8);
assert_eq!(buf[3], 't' as u8);
}
- r => fail2!("invalid read: {:?}", r)
+ r => fail!("invalid read: {:?}", r)
}
let mut raised = false;
assert_eq!(buf[2], 's' as u8);
assert_eq!(buf[3], 't' as u8);
}
- r => fail2!("invalid read: {:?}", r)
+ r => fail!("invalid read: {:?}", r)
}
}
}
pub fn input<'a>(&'a mut self) -> &'a mut io::Writer {
match self.input {
Some(ref mut fd) => fd as &mut io::Writer,
- None => fail2!("This process has no stdin")
+ None => fail!("This process has no stdin")
}
}
pub fn output<'a>(&'a mut self) -> &'a mut io::Reader {
match self.input {
Some(ref mut fd) => fd as &mut io::Reader,
- None => fail2!("This process has no stdout")
+ None => fail!("This process has no stdout")
}
}
pub fn error<'a>(&'a mut self) -> &'a mut io::Reader {
match self.error {
Some(ref mut fd) => fd as &mut io::Reader,
- None => fail2!("This process has no stderr")
+ None => fail!("This process has no stderr")
}
}
let orig_std_in = get_osfhandle(in_fd) as HANDLE;
if orig_std_in == INVALID_HANDLE_VALUE as HANDLE {
- fail2!("failure in get_osfhandle: {}", os::last_os_error());
+ fail!("failure in get_osfhandle: {}", os::last_os_error());
}
if DuplicateHandle(cur_proc, orig_std_in, cur_proc, &mut si.hStdInput,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE {
- fail2!("failure in DuplicateHandle: {}", os::last_os_error());
+ fail!("failure in DuplicateHandle: {}", os::last_os_error());
}
let orig_std_out = get_osfhandle(out_fd) as HANDLE;
if orig_std_out == INVALID_HANDLE_VALUE as HANDLE {
- fail2!("failure in get_osfhandle: {}", os::last_os_error());
+ fail!("failure in get_osfhandle: {}", os::last_os_error());
}
if DuplicateHandle(cur_proc, orig_std_out, cur_proc, &mut si.hStdOutput,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE {
- fail2!("failure in DuplicateHandle: {}", os::last_os_error());
+ fail!("failure in DuplicateHandle: {}", os::last_os_error());
}
let orig_std_err = get_osfhandle(err_fd) as HANDLE;
if orig_std_err == INVALID_HANDLE_VALUE as HANDLE {
- fail2!("failure in get_osfhandle: {}", os::last_os_error());
+ fail!("failure in get_osfhandle: {}", os::last_os_error());
}
if DuplicateHandle(cur_proc, orig_std_err, cur_proc, &mut si.hStdError,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE {
- fail2!("failure in DuplicateHandle: {}", os::last_os_error());
+ fail!("failure in DuplicateHandle: {}", os::last_os_error());
}
let cmd = make_command_line(prog, args);
CloseHandle(si.hStdError);
for msg in create_err.iter() {
- fail2!("failure in CreateProcess: {}", *msg);
+ fail!("failure in CreateProcess: {}", *msg);
}
// We close the thread handle because we don't care about keeping the
let pid = fork();
if pid < 0 {
- fail2!("failure in fork: {}", os::last_os_error());
+ fail!("failure in fork: {}", os::last_os_error());
} else if pid > 0 {
return SpawnProcessResult {pid: pid, handle: ptr::null()};
}
rustrt::rust_unset_sigprocmask();
if dup2(in_fd, 0) == -1 {
- fail2!("failure in dup2(in_fd, 0): {}", os::last_os_error());
+ fail!("failure in dup2(in_fd, 0): {}", os::last_os_error());
}
if dup2(out_fd, 1) == -1 {
- fail2!("failure in dup2(out_fd, 1): {}", os::last_os_error());
+ fail!("failure in dup2(out_fd, 1): {}", os::last_os_error());
}
if dup2(err_fd, 2) == -1 {
- fail2!("failure in dup3(err_fd, 2): {}", os::last_os_error());
+ fail!("failure in dup3(err_fd, 2): {}", os::last_os_error());
}
// close all other fds
for fd in range(3, getdtablesize()).invert() {
do with_dirp(dir) |dirp| {
if !dirp.is_null() && chdir(dirp) == -1 {
- fail2!("failure in chdir: {}", os::last_os_error());
+ fail!("failure in chdir: {}", os::last_os_error());
}
}
do with_argv(prog, args) |argv| {
execvp(*argv, argv);
// execvp only returns if an error occurred
- fail2!("failure in execvp: {}", os::last_os_error());
+ fail!("failure in execvp: {}", os::last_os_error());
}
}
}
let proc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, pid as DWORD);
if proc.is_null() {
- fail2!("failure in OpenProcess: {}", os::last_os_error());
+ fail!("failure in OpenProcess: {}", os::last_os_error());
}
loop {
let mut status = 0;
if GetExitCodeProcess(proc, &mut status) == FALSE {
CloseHandle(proc);
- fail2!("failure in GetExitCodeProcess: {}", os::last_os_error());
+ fail!("failure in GetExitCodeProcess: {}", os::last_os_error());
}
if status != STILL_ACTIVE {
CloseHandle(proc);
}
if WaitForSingleObject(proc, INFINITE) == WAIT_FAILED {
CloseHandle(proc);
- fail2!("failure in WaitForSingleObject: {}", os::last_os_error());
+ fail!("failure in WaitForSingleObject: {}", os::last_os_error());
}
}
}
let mut status = 0 as c_int;
if unsafe { waitpid(pid, &mut status, 0) } == -1 {
- fail2!("failure in waitpid: {}", os::last_os_error());
+ fail!("failure in waitpid: {}", os::last_os_error());
}
return if WIFEXITED(status) {
}
}
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
impl Writer for TcpStream {
if cfg!(windows) {
assert_eq!(e.kind, NotConnected);
} else {
- fail2!();
+ fail!();
}
}).inside {
let nread = stream.read(buf);
if cfg!(windows) {
assert_eq!(e.kind, NotConnected);
} else {
- fail2!();
+ fail!();
}
}).inside {
let nread = stream.read(buf);
}
}
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
impl Writer for UdpStream {
}
}
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
#[cfg(test)]
assert_eq!(buf[0], 99);
assert_eq!(src, client_ip);
}
- None => fail2!()
+ None => fail!()
}
}
- None => fail2!()
+ None => fail!()
}
}
port.take().recv();
client.sendto([99], server_ip)
}
- None => fail2!()
+ None => fail!()
}
}
}
assert_eq!(buf[0], 99);
assert_eq!(src, client_ip);
}
- None => fail2!()
+ None => fail!()
}
}
- None => fail2!()
+ None => fail!()
}
}
port.take().recv();
client.sendto([99], server_ip)
}
- None => fail2!()
+ None => fail!()
}
}
}
assert_eq!(nread, 1);
assert_eq!(buf[0], 99);
}
- None => fail2!()
+ None => fail!()
}
}
- None => fail2!()
+ None => fail!()
}
}
port.take().recv();
stream.write([99]);
}
- None => fail2!()
+ None => fail!()
}
}
}
assert_eq!(nread, 1);
assert_eq!(buf[0], 99);
}
- None => fail2!()
+ None => fail!()
}
}
- None => fail2!()
+ None => fail!()
}
}
port.take().recv();
stream.write([99]);
}
- None => fail2!()
+ None => fail!()
}
}
}
impl UnixStream {
pub fn connect<P: PathLike>(_path: &P) -> Option<UnixStream> {
- fail2!()
+ fail!()
}
}
impl Reader for UnixStream {
- fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail2!() }
+ fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail!() }
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
impl Writer for UnixStream {
- fn write(&mut self, _v: &[u8]) { fail2!() }
+ fn write(&mut self, _v: &[u8]) { fail!() }
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
pub struct UnixListener;
impl UnixListener {
pub fn bind<P: PathLike>(_path: &P) -> Option<UnixListener> {
- fail2!()
+ fail!()
}
}
impl Listener<UnixStream, UnixAcceptor> for UnixListener {
- fn listen(self) -> Option<UnixAcceptor> { fail2!() }
+ fn listen(self) -> Option<UnixAcceptor> { fail!() }
}
pub struct UnixAcceptor;
impl Acceptor<UnixStream> for UnixAcceptor {
- fn accept(&mut self) -> Option<UnixStream> { fail2!() }
+ fn accept(&mut self) -> Option<UnixStream> { fail!() }
}
}
}
- fn eof(&mut self) -> bool { fail2!() }
+ fn eof(&mut self) -> bool { fail!() }
}
impl Writer for PipeStream {
}
}
- fn flush(&mut self) { fail2!() }
+ fn flush(&mut self) { fail!() }
}
// FIXME(#7544)(bblum): is it really necessary to prohibit double kill?
match inner.unkillable.compare_and_swap(KILL_RUNNING, KILL_UNKILLABLE, Relaxed) {
KILL_RUNNING => { }, // normal case
- KILL_KILLED => if !already_failing { fail2!("{}", KILLED_MSG) },
+ KILL_KILLED => if !already_failing { fail!("{}", KILLED_MSG) },
_ => rtabort!("inhibit_kill: task already unkillable"),
}
}
// FIXME(#7544)(bblum): is it really necessary to prohibit double kill?
match inner.unkillable.compare_and_swap(KILL_UNKILLABLE, KILL_RUNNING, Relaxed) {
KILL_UNKILLABLE => { }, // normal case
- KILL_KILLED => if !already_failing { fail2!("{}", KILLED_MSG) },
+ KILL_KILLED => if !already_failing { fail!("{}", KILLED_MSG) },
_ => rtabort!("allow_kill: task already killable"),
}
}
// synchronization during unwinding or cleanup (for example,
// sending on a notify port). In that case failing won't help.
if self.unkillable == 0 && (!already_failing) && kill_handle.killed() {
- fail2!("{}", KILLED_MSG);
+ fail!("{}", KILLED_MSG);
},
// This may happen during task death (see comments in collect_failure).
None => rtassert!(self.unkillable > 0),
if self.unkillable == 0 {
// we need to decrement the counter before failing.
self.unkillable -= 1;
- fail2!("Cannot enter a rekillable() block without a surrounding unkillable()");
+ fail!("Cannot enter a rekillable() block without a surrounding unkillable()");
}
self.unkillable -= 1;
if self.unkillable == 0 {
while (true) {
match p.recv() {
(1, end_chan) => {
- debug2!("{}\n", id);
+ debug!("{}\n", id);
end_chan.send(());
return;
}
(token, end_chan) => {
- debug2!("thread: {} got token: {}", id, token);
+ debug!("thread: {} got token: {}", id, token);
ch.send((token - 1, end_chan));
if token <= n_tasks {
return;
let result = spawntask_try(||());
rtdebug!("trying first assert");
assert!(result.is_ok());
- let result = spawntask_try(|| fail2!());
+ let result = spawntask_try(|| fail!());
rtdebug!("trying second assert");
assert!(result.is_err());
}
#[test]
fn logging() {
do run_in_newsched_task() {
- info2!("here i am. logging in a newsched task");
+ info!("here i am. logging in a newsched task");
}
}
fn linked_failure() {
do run_in_newsched_task() {
let res = do spawntask_try {
- spawntask_random(|| fail2!());
+ spawntask_random(|| fail!());
};
assert!(res.is_err());
}
to_mut_unsafe_ptr(&mut size),
mut_null(), 0) != 0 {
let err = last_os_error();
- error2!("raise_fd_limit: error calling sysctl: {}", err);
+ error!("raise_fd_limit: error calling sysctl: {}", err);
return;
}
let mut rlim = rlimit{rlim_cur: 0, rlim_max: 0};
if getrlimit(RLIMIT_NOFILE, to_mut_unsafe_ptr(&mut rlim)) != 0 {
let err = last_os_error();
- error2!("raise_fd_limit: error calling getrlimit: {}", err);
+ error!("raise_fd_limit: error calling getrlimit: {}", err);
return;
}
// Set our newly-increased resource limit
if setrlimit(RLIMIT_NOFILE, to_unsafe_ptr(&rlim)) != 0 {
let err = last_os_error();
- error2!("raise_fd_limit: error calling setrlimit: {}", err);
+ error!("raise_fd_limit: error calling setrlimit: {}", err);
return;
}
}
let unlink_req = FsRequest::new();
let result = unlink_req.unlink_sync(&loop_, &Path::new(path_str));
assert!(result.is_ok());
- } else { fail2!("nread was 0.. wudn't expectin' that."); }
+ } else { fail!("nread was 0.. wudn't expectin' that."); }
loop_.close();
}
}
match addr {
_ if is_ip4_addr(addr) => UvIpv4SocketAddr(addr as *uvll::sockaddr_in),
_ if is_ip6_addr(addr) => UvIpv6SocketAddr(addr as *uvll::sockaddr_in6),
- _ => fail2!(),
+ _ => fail!(),
}
}
}
((1, o), (2, e)) => (e, o),
((2, e), (1, o)) => (e, o),
((x, _), (y, _)) => {
- fail2!("unexpected file numbers: {}, {}", x, y);
+ fail!("unexpected file numbers: {}, {}", x, y);
}
};
/// port whose data is ready. (If multiple are ready, returns the lowest index.)
pub fn select<A: Select>(ports: &mut [A]) -> uint {
if ports.is_empty() {
- fail2!("can't select on an empty list");
+ fail!("can't select on an empty list");
}
for (index, port) in ports.mut_iter().enumerate() {
match result {
0 => Left ((a.recv_ready(), b)),
1 => Right((a, b.recv_ready())),
- x => fail2!("impossible case in select2: {:?}", x)
+ x => fail!("impossible case in select2: {:?}", x)
}
}
let _ = dead_cs;
}
do task::spawn {
- fail2!(); // should kill sibling awake
+ fail!(); // should kill sibling awake
}
// wait for killed selector to close (NOT send on) its c.
match ctr {
0 => assert_eq!(x, &~"zero"),
1 => assert_eq!(x, &~"one"),
- _ => fail2!("shouldn't happen!")
+ _ => fail!("shouldn't happen!")
}
ctr += 1;
}
if end_byte.is_none() && count == end { end_byte = Some(self.len()) }
match (begin_byte, end_byte) {
- (None, _) => fail2!("slice_chars: `begin` is beyond end of string"),
- (_, None) => fail2!("slice_chars: `end` is beyond end of string"),
+ (None, _) => fail!("slice_chars: `begin` is beyond end of string"),
+ (_, None) => fail!("slice_chars: `end` is beyond end of string"),
(Some(a), Some(b)) => unsafe { raw::slice_bytes(*self, a, b) }
}
}
// original problem code path anymore.)
let s = ~"";
let _bytes = s.as_bytes();
- fail2!();
+ fail!();
}
#[test]
while i < n1 {
let a: u8 = s1[i];
let b: u8 = s2[i];
- debug2!("{}", a);
- debug2!("{}", b);
+ debug!("{}", a);
+ debug!("{}", b);
assert_eq!(a, b);
i += 1u;
}
impl TaskBuilder {
fn consume(&mut self) -> TaskBuilder {
if self.consumed {
- fail2!("Cannot copy a task_builder"); // Fake move mode on self
+ fail!("Cannot copy a task_builder"); // Fake move mode on self
}
self.consumed = true;
let gen_body = self.gen_body.take();
// sending out messages.
if self.opts.notify_chan.is_some() {
- fail2!("Can't set multiple future_results for one task!");
+ fail!("Can't set multiple future_results for one task!");
}
// Construct the future and give it to the caller.
}
}
} else {
- fail2!("no task name exists in non-green task context")
+ fail!("no task name exists in non-green task context")
}
}
do run_in_newsched_task {
do task::try {
do task::spawn {
- fail2!();
+ fail!();
}
do task::unkillable { }
};
do task::unkillable {
do task::rekillable {
do task::spawn {
- fail2!();
+ fail!();
}
}
}
do unkillable {
do rekillable {
let (port,chan) = comm::stream();
- do task::spawn { chan.send(()); fail2!(); }
+ do task::spawn { chan.send(()); fail!(); }
port.recv(); // wait for child to exist
port.recv(); // block forever, expect to get killed.
}
do 16.times { task::deschedule(); }
ch.send(()); // If killed first, grandparent hangs.
}
- fail2!(); // Shouldn't kill either (grand)parent or (grand)child.
+ fail!(); // Shouldn't kill either (grand)parent or (grand)child.
}
po.recv();
}
fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails
use rt::test::run_in_newsched_task;
do run_in_newsched_task {
- do spawn_unlinked { fail2!(); }
+ do spawn_unlinked { fail!(); }
}
}
#[ignore(reason = "linked failure")]
fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails
use rt::test::run_in_newsched_task;
do run_in_newsched_task {
- do spawn_supervised { fail2!(); }
+ do spawn_supervised { fail!(); }
// Give child a chance to fail-but-not-kill-us.
do 16.times { task::deschedule(); }
}
do run_in_newsched_task {
let result: Result<(),()> = do try {
do spawn_supervised { block_forever(); }
- fail2!(); // Shouldn't leave a child hanging around.
+ fail!(); // Shouldn't leave a child hanging around.
};
assert!(result.is_err());
}
b0.opts.supervised = true;
do b0.spawn {
- fail2!();
+ fail!();
}
block_forever(); // We should get punted awake
};
b0.opts.linked = true;
b0.opts.supervised = true;
do b0.spawn { block_forever(); }
- fail2!(); // *both* mechanisms would be wrong if this didn't kill the child
+ fail!(); // *both* mechanisms would be wrong if this didn't kill the child
};
assert!(result.is_err());
}
do run_in_newsched_task {
let result: Result<(),()> = do try {
// Default options are to spawn linked & unsupervised.
- do spawn { fail2!(); }
+ do spawn { fail!(); }
block_forever(); // We should get punted awake
};
assert!(result.is_err());
let result: Result<(),()> = do try {
// Default options are to spawn linked & unsupervised.
do spawn { block_forever(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
let mut builder = task();
builder.linked();
do builder.spawn { block_forever(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
do spawn_supervised { block_forever(); }
}
do 16.times { task::deschedule(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
do spawn { block_forever(); } // linked
}
do 16.times { task::deschedule(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
do spawn_supervised { block_forever(); }
}
do 16.times { task::deschedule(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
do spawn { block_forever(); } // linked
}
do 16.times { task::deschedule(); }
- fail2!();
+ fail!();
};
assert!(result.is_err());
}
let result = builder.future_result();
builder.unlinked();
do builder.spawn {
- fail2!();
+ fail!();
}
assert_eq!(result.recv(), Failure);
}
~"Success!"
} {
result::Ok(~"Success!") => (),
- _ => fail2!()
+ _ => fail!()
}
}
#[test]
fn test_try_fail() {
match do try {
- fail2!()
+ fail!()
} {
result::Err(()) => (),
- result::Ok(()) => fail2!()
+ result::Ok(()) => fail!()
}
}
deschedule();
// We want to fail after the unkillable task
// blocks on recv
- fail2!();
+ fail!();
}
unsafe {
deschedule();
// We want to fail after the unkillable task
// blocks on recv
- fail2!();
+ fail!();
}
unsafe {
t.watched();
do t.spawn {
task::deschedule();
- fail2!();
+ fail!();
}
}
};
do t.spawn {
p3.recv();
task::deschedule();
- fail2!();
+ fail!();
}
c3.send(());
p2.recv();
let (thread_port, thread_chan) = oneshot();
let thread_port_cell = Cell::new(thread_port);
let join_task = do Task::build_child(None) {
- debug2!("running join task");
+ debug!("running join task");
let thread_port = thread_port_cell.take();
let thread: Thread = thread_port.recv();
thread.join();
let join_task = join_task_cell.take();
let bootstrap_task = ~do Task::new_root(&mut new_sched.stack_pool, None) || {
- debug2!("boostrapping a 1:1 scheduler");
+ debug!("boostrapping a 1:1 scheduler");
};
new_sched.bootstrap(bootstrap_task);
- debug2!("enqueing join_task");
+ debug!("enqueing join_task");
// Now tell the original scheduler to join with this thread
// by scheduling a thread-joining task on the original scheduler
orig_sched_handle.send_task_from_friend(join_task);
}
task.name = opts.name.take();
- debug2!("spawn calling run_task");
+ debug!("spawn calling run_task");
Scheduler::run_task(task);
}
.. default_task_opts()
};
do spawn_raw(opts) {
- fail2!();
+ fail!();
}
}
.. default_task_opts()
};
do spawn_raw(opts) {
- fail2!();
+ fail!();
}
assert_eq!(notify_po.recv(), Failure);
}
External(stored, _) if stored == key => {
match replace(child, Nothing) {
External(_, value) => (Some(value), true),
- _ => fail2!()
+ _ => fail!()
}
}
External(*) => (None, false),
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));
}
}
} {
Ok(()) => {},
- Err(str) => fail2!("{}", str)
+ Err(str) => fail!("{}", str)
}
}
}
// The math library does not need to be loaded since it is already
// statically linked in
let libm = match DynamicLibrary::open(None) {
- Err(error) => fail2!("Could not load self as module: {}", error),
+ Err(error) => fail!("Could not load self as module: {}", error),
Ok(libm) => libm
};
let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe {
match libm.symbol("cos") {
- Err(error) => fail2!("Could not load function cos: {}", error),
+ Err(error) => fail!("Could not load function cos: {}", error),
Ok(cosine) => cosine
}
};
let expected_result = 1.0;
let result = cosine(argument);
if result != expected_result {
- fail2!("cos({:?}) != {:?} but equaled {:?} instead", argument,
+ fail!("cos({:?}) != {:?} but equaled {:?} instead", argument,
expected_result, result)
}
}
let path = GenericPath::new("/dev/null");
match DynamicLibrary::open(Some(&path)) {
Err(_) => {}
- Ok(_) => fail2!("Successfully opened the empty library.")
+ Ok(_) => fail!("Successfully opened the empty library.")
}
}
}
let mut i = 0;
do (|| {
i = 10;
- fail2!();
+ fail!();
}).finally {
assert!(failing());
assert_eq!(i, 10);
// If 'put' returns the server end back to us, we were rejected;
// someone else was trying to unwrap. Avoid guaranteed deadlock.
cast::forget(data);
- fail2!("Another task is already unwrapping this Arc!");
+ fail!("Another task is already unwrapping this Arc!");
}
}
}
let rec = self.x.get();
do (*rec).lock.lock {
if (*rec).failed {
- fail2!("Poisoned Exclusive::new - another task failed inside!");
+ fail!("Poisoned Exclusive::new - another task failed inside!");
}
(*rec).failed = true;
let result = f(&mut (*rec).data);
let x2 = x.clone();
do task::spawn {
do 10.times { task::deschedule(); } // try to let the unwrapper go
- fail2!(); // punt it awake from its deadlock
+ fail!(); // punt it awake from its deadlock
}
let _z = x.unwrap();
unsafe { do x2.with |_hello| { } }
#[inline]
fn head(&self) -> &'self T {
- if self.len() == 0 { fail2!("head: empty vector") }
+ if self.len() == 0 { fail!("head: empty vector") }
&self[0]
}
#[inline]
fn last(&self) -> &'self T {
- if self.len() == 0 { fail2!("last: empty vector") }
+ if self.len() == 0 { fail!("last: empty vector") }
&self[self.len() - 1]
}
let alloc = n * mem::nonzero_size_of::<T>();
let size = alloc + mem::size_of::<Vec<()>>();
if alloc / mem::nonzero_size_of::<T>() != n || size < alloc {
- fail2!("vector size is too large: {}", n);
+ fail!("vector size is too large: {}", n);
}
*ptr = realloc_raw(*ptr as *mut c_void, size)
as *mut Vec<()>;
fn reserve_additional(&mut self, n: uint) {
if self.capacity() - self.len() < n {
match self.len().checked_add(&n) {
- None => fail2!("vec::reserve_additional: `uint` overflow"),
+ None => fail!("vec::reserve_additional: `uint` overflow"),
Some(new_cap) => self.reserve_at_least(new_cap)
}
}
fn swap_remove(&mut self, index: uint) -> T {
let ln = self.len();
if index >= ln {
- fail2!("vec::swap_remove - index {} >= length {}", index, ln);
+ fail!("vec::swap_remove - index {} >= length {}", index, ln);
}
if index < ln - 1 {
self.swap(index, ln - 1);
3 => assert_eq!(v, [2, 3, 1]),
4 => assert_eq!(v, [2, 1, 3]),
5 => assert_eq!(v, [1, 2, 3]),
- _ => fail2!(),
+ _ => fail!(),
}
}
}
#[should_fail]
fn test_from_fn_fail() {
do from_fn(100) |v| {
- if v == 50 { fail2!() }
+ if v == 50 { fail!() }
(~0, @0)
};
}
fn clone(&self) -> S {
let s = unsafe { cast::transmute_mut(self) };
s.f += 1;
- if s.f == 10 { fail2!() }
+ if s.f == 10 { fail!() }
S { f: s.f, boxes: s.boxes.clone() }
}
}
push((~0, @0));
push((~0, @0));
push((~0, @0));
- fail2!();
+ fail!();
};
}
let mut v = ~[];
do v.grow_fn(100) |i| {
if i == 50 {
- fail2!()
+ fail!()
}
(~0, @0)
}
let mut i = 0;
do v.map |_elt| {
if i == 2 {
- fail2!()
+ fail!()
}
i += 1;
~[(~0, @0)]
let mut i = 0;
do flat_map(v) |_elt| {
if i == 2 {
- fail2!()
+ fail!()
}
i += 1;
~[(~0, @0)]
let mut i = 0;
for _ in v.permutations_iter() {
if i == 2 {
- fail2!()
+ fail!()
}
i += 1;
}
fn test_as_imm_buf_fail() {
let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
do v.as_imm_buf |_buf, _i| {
- fail2!()
+ fail!()
}
}
fn test_as_mut_buf_fail() {
let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)];
do v.as_mut_buf |_buf, _i| {
- fail2!()
+ fail!()
}
}
sum += *x;
}
// sum == 11806, to stop dead code elimination.
- if sum == 0 {fail2!()}
+ if sum == 0 {fail!()}
}
}
let data = abi.data();
for other_abi in abis.slice(0, i).iter() {
let other_data = other_abi.data();
- debug2!("abis=({:?},{:?}) datas=({:?},{:?})",
+ debug!("abis=({:?},{:?}) datas=({:?},{:?})",
abi, data.abi_arch,
other_abi, other_data.abi_arch);
match (&data.abi_arch, &other_data.abi_arch) {
(m == a && n == b));
}
None => {
- fail2!("Invalid match not detected");
+ fail!("Invalid match not detected");
}
}
}
set.add(m);
match set.check_valid() {
Some((_, _)) => {
- fail2!("Valid match declared invalid");
+ fail!("Valid match declared invalid");
}
None => {}
}
let mut set = AbiSet::empty();
set.add(Aapcs);
set.add(C);
- debug2!("set = {}", set.to_str());
+ debug!("set = {}", set.to_str());
assert!(set.to_str() == ~"\"aapcs C\"");
}
fn abi_to_str_rust() {
let mut set = AbiSet::empty();
set.add(Rust);
- debug2!("set = {}", set.to_str());
+ debug!("set = {}", set.to_str());
assert!(set.to_str() == ~"\"Rust\"");
}
// if it should be non-hygienic (most things are), just compare the
// 'name' fields of the idents. Or, even better, replace the idents
// with Name's.
- fail2!("not allowed to compare these idents: {:?}, {:?}.
+ fail!("not allowed to compare these idents: {:?}, {:?}.
Probably related to issue \\#6993", self, other);
}
}
item,
p));
}
- _ => fail2!("struct def parent wasn't an item")
+ _ => fail!("struct def parent wasn't an item")
}
}
}
error_msg: ~str) -> Result {
match items.find(&id) {
Some(&node_item(it, _)) => query(it),
- _ => fail2!("{}", error_msg)
+ _ => fail!("{}", error_msg)
}
}
StmtDecl(_, id) => id,
StmtExpr(_, id) => id,
StmtSemi(_, id) => id,
- StmtMac(*) => fail2!("attempted to analyze unexpanded stmt")
+ StmtMac(*) => fail!("attempted to analyze unexpanded stmt")
}
}
local_def(id)
}
- DefPrimTy(_) => fail2!()
+ DefPrimTy(_) => fail!()
}
}
}
true => {
match table.mark_memo.find(&key) {
- None => fail2!("internal error: key disappeared 2013042901"),
+ None => fail!("internal error: key disappeared 2013042901"),
Some(idxptr) => {*idxptr}
}
}
}
true => {
match table.rename_memo.find(&key) {
- None => fail2!("internal error: key disappeared 2013042902"),
+ None => fail!("internal error: key disappeared 2013042902"),
Some(idxptr) => {*idxptr}
}
}
/// print out an SCTable for debugging
pub fn display_sctable(table : &SCTable) {
- error2!("SC table:");
+ error!("SC table:");
for (idx,val) in table.table.iter().enumerate() {
- error2!("{:4u} : {:?}",idx,val);
+ error!("{:4u} : {:?}",idx,val);
}
}
resolvedthis
}
}
- IllegalCtxt() => fail2!("expected resolvable context, got IllegalCtxt")
+ IllegalCtxt() => fail!("expected resolvable context, got IllegalCtxt")
}
};
resolve_table.insert(key,resolved);
loopvar = tl;
}
}
- IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt")
+ IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt")
}
}
}
let sctable = get_sctable();
match sctable.table[ctxt] {
ast::Mark(mrk,_) => mrk,
- _ => fail2!("can't retrieve outer mark when outside is not a mark")
+ _ => fail!("can't retrieve outer mark when outside is not a mark")
}
}
sc = tail;
continue;
}
- IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt")
+ IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt")
}
}
}
/// span included in the `==` comparison a plain MetaItem.
pub fn contains(haystack: &[@ast::MetaItem],
needle: @ast::MetaItem) -> bool {
- debug2!("attr::contains (name={})", needle.name());
+ debug!("attr::contains (name={})", needle.name());
do haystack.iter().any |item| {
- debug2!(" testing: {}", item.name());
+ debug!(" testing: {}", item.name());
item.node == needle.node
}
}
pub fn contains_name<AM: AttrMetaMethods>(metas: &[AM], name: &str) -> bool {
- debug2!("attr::contains_name (name={})", name);
+ debug!("attr::contains_name (name={})", name);
do metas.iter().any |item| {
- debug2!(" testing: {}", item.name());
+ debug!(" testing: {}", item.name());
name == item.name()
}
}
// this would be much nicer as a chain of iterator adaptors, but
// this doesn't work.
let some_cfg_matches = do metas.any |mi| {
- debug2!("testing name: {}", mi.name());
+ debug!("testing name: {}", mi.name());
if "cfg" == mi.name() { // it is a #[cfg()] attribute
- debug2!("is cfg");
+ debug!("is cfg");
no_cfgs = false;
// only #[cfg(...)] ones are understood.
match mi.meta_item_list() {
Some(cfg_meta) => {
- debug2!("is cfg(...)");
+ debug!("is cfg(...)");
do cfg_meta.iter().all |cfg_mi| {
- debug2!("cfg({}[...])", cfg_mi.name());
+ debug!("cfg({}[...])", cfg_mi.name());
match cfg_mi.node {
ast::MetaList(s, ref not_cfgs) if "not" == s => {
- debug2!("not!");
+ debug!("not!");
// inside #[cfg(not(...))], so these need to all
// not match.
not_cfgs.iter().all(|mi| {
- debug2!("cfg(not({}[...]))", mi.name());
+ debug!("cfg(not({}[...]))", mi.name());
!contains(cfg, *mi)
})
}
false
}
};
- debug2!("test_cfg (no_cfgs={}, some_cfg_matches={})", no_cfgs, some_cfg_matches);
+ debug!("test_cfg (no_cfgs={}, some_cfg_matches={})", no_cfgs, some_cfg_matches);
no_cfgs || some_cfg_matches
}
for fm in self.files.iter() { if filename == fm.name { return *fm; } }
//XXjdm the following triggers a mismatched type bug
// (or expected function, found _|_)
- fail2!(); // ("asking for " + filename + " which we don't know about");
+ fail!(); // ("asking for " + filename + " which we don't know about");
}
}
}
}
if (a >= len) {
- fail2!("position {} does not resolve to a source location", pos.to_uint())
+ fail!("position {} does not resolve to a source location", pos.to_uint())
}
return a;
let chpos = self.bytepos_to_local_charpos(pos);
let linebpos = f.lines[a];
let linechpos = self.bytepos_to_local_charpos(linebpos);
- debug2!("codemap: byte pos {:?} is on the line at byte pos {:?}",
+ debug!("codemap: byte pos {:?} is on the line at byte pos {:?}",
pos, linebpos);
- debug2!("codemap: char pos {:?} is on the line at char pos {:?}",
+ debug!("codemap: char pos {:?} is on the line at char pos {:?}",
chpos, linechpos);
- debug2!("codemap: byte is on line: {:?}", line);
+ debug!("codemap: byte is on line: {:?}", line);
assert!(chpos >= linechpos);
return Loc {
file: f,
// Converts an absolute BytePos to a CharPos relative to the file it is
// located in
fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos {
- debug2!("codemap: converting {:?} to char pos", bpos);
+ debug!("codemap: converting {:?} to char pos", bpos);
let idx = self.lookup_filemap_idx(bpos);
let map = self.files[idx];
let mut total_extra_bytes = 0;
for mbc in map.multibyte_chars.iter() {
- debug2!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos);
+ debug!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos);
if mbc.pos < bpos {
total_extra_bytes += mbc.bytes;
// We should never see a byte position in the middle of a
impl span_handler for CodemapT {
fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
self.handler.emit(Some((self.cm, sp)), msg, fatal);
- fail2!();
+ fail!();
}
fn span_err(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, error);
impl handler for HandlerT {
fn fatal(@mut self, msg: &str) -> ! {
self.emit.emit(None, msg, fatal);
- fail2!();
+ fail!();
}
fn err(@mut self, msg: &str) {
self.emit.emit(None, msg, error);
// names? I think not.
// delaying implementing this....
pub fn each_key (&self, _f: &fn (&K)->bool) {
- fail2!("unimplemented 2013-02-15T10:01");
+ fail!("unimplemented 2013-02-15T10:01");
}
pub fn each_value (&self, _f: &fn (&V) -> bool) {
- fail2!("unimplemented 2013-02-15T10:02");
+ fail!("unimplemented 2013-02-15T10:02");
}
// Returns a copy of the value that the name maps to.
if satisfies_pred(map,&n,pred) {
map.insert(key,ext);
} else {
- fail2!("expected map chain containing satisfying frame")
+ fail!("expected map chain containing satisfying frame")
}
},
ConsMapChain (~ref mut map, rest) => {
match t {
&@BlockInfo(BlockInfo {macros_escape:false,_}) => true,
&@BlockInfo(BlockInfo {_}) => false,
- _ => fail2!("special identifier {:?} was bound to a non-BlockInfo",
+ _ => fail!("special identifier {:?} was bound to a non-BlockInfo",
special_block_name)
}
};
fn mustbesome<T>(val : Option<T>) -> T {
match val {
Some(v) => v,
- None => fail2!("rename_fold returned None")
+ None => fail!("rename_fold returned None")
}
}
fn get_block_info(exts : SyntaxEnv) -> BlockInfo {
match exts.find_in_topmost_frame(&intern(special_block_name)) {
Some(@BlockInfo(bi)) => bi,
- _ => fail2!("special identifier {:?} was bound to a non-BlockInfo",
+ _ => fail!("special identifier {:?} was bound to a non-BlockInfo",
@" block")
}
}
fn apply_pending_renames(folder : @ast_fold, stmt : ast::Stmt) -> @ast::Stmt {
match folder.fold_stmt(&stmt) {
Some(s) => s,
- None => fail2!("renaming of stmt produced None")
+ None => fail!("renaming of stmt produced None")
}
}
// NOTE (acrichto): remove these after the next snapshot
macro_rules! log2( ($($arg:tt)*) => (log!($($arg)*)) )
- macro_rules! error2( ($($arg:tt)*) => (error!($($arg)*)) )
- macro_rules! warn2 ( ($($arg:tt)*) => (warn!($($arg)*)) )
- macro_rules! info2 ( ($($arg:tt)*) => (info!($($arg)*)) )
- macro_rules! debug2( ($($arg:tt)*) => (debug!($($arg)*)) )
- macro_rules! fail2( ($($arg:tt)*) => (fail!($($arg)*)) )
+ macro_rules! error( ($($arg:tt)*) => (error!($($arg)*)) )
+ macro_rules! warn ( ($($arg:tt)*) => (warn!($($arg)*)) )
+ macro_rules! info ( ($($arg:tt)*) => (info!($($arg)*)) )
+ macro_rules! debug( ($($arg:tt)*) => (debug!($($arg)*)) )
+ macro_rules! fail( ($($arg:tt)*) => (fail!($($arg)*)) )
macro_rules! assert(
($cond:expr) => {
// check both directions of equality....
if !((*given_val == *expected_val) &&
(*expected_val == *given_val)) {
- fail2!(\"assertion failed: `(left == right) && (right == \
+ fail!(\"assertion failed: `(left == right) && (right == \
left)` (left: `{:?}`, right: `{:?}`)\",
*given_val, *expected_val);
}
given_val.approx_eq(&expected_val) &&
expected_val.approx_eq(&given_val)
) {
- fail2!(\"left: {:?} does not approximately equal right: {:?}\",
+ fail!(\"left: {:?} does not approximately equal right: {:?}\",
given_val, expected_val);
}
}
given_val.approx_eq_eps(&expected_val, &epsilon_val) &&
expected_val.approx_eq_eps(&given_val, &epsilon_val)
) {
- fail2!(\"left: {:?} does not approximately equal right: \
+ fail!(\"left: {:?} does not approximately equal right: \
{:?} with epsilon: {:?}\",
given_val, expected_val, epsilon_val);
}
*/
macro_rules! unreachable (() => (
- fail2!(\"internal error: entered unreachable code\");
+ fail!(\"internal error: entered unreachable code\");
))
macro_rules! condition (
~[],
parse_sess) {
Some(item) => item,
- None => fail2!("expected core macros to parse correctly")
+ None => fail!("expected core macros to parse correctly")
};
let injector = @Injector {
use util::parser_testing::{string_to_pat, string_to_tts, strs_to_idents};
use visit;
- // make sure that fail2! is present
+ // make sure that fail! is present
#[test] fn fail_exists_test () {
- let src = @"fn main() { fail2!(\"something appropriately gloomy\");}";
+ let src = @"fn main() { fail!(\"something appropriately gloomy\");}";
let sess = parse::new_parse_sess(None);
let crate_ast = parse::parse_crate_from_source_str(
@"<test>",
src,
~[],sess);
let crate_ast = inject_std_macros(sess, ~[], crate_ast);
- // don't bother with striping, doesn't affect fail2!.
+ // don't bother with striping, doesn't affect fail!.
expand_crate(sess,~[],crate_ast);
}
cfg,~[],sess);
match item_ast {
Some(_) => (), // success
- None => fail2!("expected this to parse")
+ None => fail!("expected this to parse")
}
}
let marked_once_ctxt =
match marked_once[0] {
ast::tt_tok(_,token::IDENT(id,_)) => id.ctxt,
- _ => fail2!(format!("unexpected shape for marked tts: {:?}",marked_once[0]))
+ _ => fail!(format!("unexpected shape for marked tts: {:?}",marked_once[0]))
};
assert_eq!(mtwt_marksof(marked_once_ctxt,invalid_name),~[fm]);
let remarked = mtwt_cancel_outer_mark(marked_once,marked_once_ctxt);
match remarked[0] {
ast::tt_tok(_,token::IDENT(id,_)) =>
assert_eq!(mtwt_marksof(id.ctxt,invalid_name),~[]),
- _ => fail2!(format!("unexpected shape for marked tts: {:?}",remarked[0]))
+ _ => fail!(format!("unexpected shape for marked tts: {:?}",remarked[0]))
}
}
bindings.iter().filter(|b|{@"xx" == (ident_to_str(*b))}).collect();
let cxbind = match cxbinds {
[b] => b,
- _ => fail2!("expected just one binding for ext_cx")
+ _ => fail!("expected just one binding for ext_cx")
};
let resolved_binding = mtwt_resolve(*cxbind);
// find all the xx varrefs:
match res {
Some(ast) => ast,
None => {
- error2!("Parse error with ```\n{}\n```", s);
- fail2!()
+ error!("Parse error with ```\n{}\n```", s);
+ fail!()
}
}
}
~[mk_ident(cx, sp, ident)]);
}
- INTERPOLATED(_) => fail2!("quote! with interpolated token"),
+ INTERPOLATED(_) => fail!("quote! with interpolated token"),
_ => ()
}
DOLLAR => "DOLLAR",
UNDERSCORE => "UNDERSCORE",
EOF => "EOF",
- _ => fail2!()
+ _ => fail!()
};
cx.expr_ident(sp, id_ext(name))
}
}
ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts),
- ast::tt_seq(*) => fail2!("tt_seq in quote!"),
+ ast::tt_seq(*) => fail!("tt_seq in quote!"),
ast::tt_nonterminal(sp, ident) => {
pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos {
match *mpu {
matcher_pos_up(Some(ref mp)) => (*mp).clone(),
- _ => fail2!()
+ _ => fail!()
}
}
format!("{} ('{}')", ident_to_str(name),
ident_to_str(bind))
}
- _ => fail2!()
+ _ => fail!()
} }).connect(" or ");
return error(sp, format!(
"Local ambiguity: multiple parsing options: \
parse_nt(&rust_parser, ident_to_str(name))));
ei.idx += 1u;
}
- _ => fail2!()
+ _ => fail!()
}
cur_eis.push(ei);
let a_val = $a;
let b_val = $b;
if !(pred_val(a_val,b_val)) {
- fail2!("expected args satisfying {}, got {:?} and {:?}",
+ fail!("expected args satisfying {}, got {:?} and {:?}",
$predname, a_val, b_val);
}
}
pub fn get<'a>(&'a self, i: uint) -> &'a T {
match *self {
- Empty => fail2!("Invalid index {}", i),
+ Empty => fail!("Invalid index {}", i),
Vec(ref v) => &v[i]
}
}
fn parse_outer_attributes(&self) -> ~[ast::Attribute] {
let mut attrs: ~[ast::Attribute] = ~[];
loop {
- debug2!("parse_outer_attributes: self.token={:?}",
+ debug!("parse_outer_attributes: self.token={:?}",
self.token);
match *self.token {
token::INTERPOLATED(token::nt_attr(*)) => {
// if permit_inner is true, then a trailing `;` indicates an inner
// attribute
fn parse_attribute(&self, permit_inner: bool) -> ast::Attribute {
- debug2!("parse_attributes: permit_inner={:?} self.token={:?}",
+ debug!("parse_attributes: permit_inner={:?} self.token={:?}",
permit_inner, self.token);
let (span, value) = match *self.token {
INTERPOLATED(token::nt_attr(attr)) => {
return lines.connect("\n");
}
- fail2!("not a doc-comment: {}", comment);
+ fail!("not a doc-comment: {}", comment);
}
fn read_to_eol(rdr: @mut StringReader) -> ~str {
}
fn push_blank_line_comment(rdr: @mut StringReader, comments: &mut ~[cmnt]) {
- debug2!(">>> blank-line comment");
+ debug!(">>> blank-line comment");
let v: ~[~str] = ~[];
comments.push(cmnt {style: blank_line, lines: v, pos: rdr.last_pos});
}
fn read_shebang_comment(rdr: @mut StringReader, code_to_the_left: bool,
comments: &mut ~[cmnt]) {
- debug2!(">>> shebang comment");
+ debug!(">>> shebang comment");
let p = rdr.last_pos;
- debug2!("<<< shebang comment");
+ debug!("<<< shebang comment");
comments.push(cmnt {
style: if code_to_the_left { trailing } else { isolated },
lines: ~[read_one_line_comment(rdr)],
fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool,
comments: &mut ~[cmnt]) {
- debug2!(">>> line comments");
+ debug!(">>> line comments");
let p = rdr.last_pos;
let mut lines: ~[~str] = ~[];
while rdr.curr == '/' && nextch(rdr) == '/' {
let line = read_one_line_comment(rdr);
- debug2!("{}", line);
+ debug!("{}", line);
if is_doc_comment(line) { // doc-comments are not put in comments
break;
}
lines.push(line);
consume_non_eol_whitespace(rdr);
}
- debug2!("<<< line comments");
+ debug!("<<< line comments");
if !lines.is_empty() {
comments.push(cmnt {
style: if code_to_the_left { trailing } else { isolated },
}
None => s,
};
- debug2!("pushing line: {}", s1);
+ debug!("pushing line: {}", s1);
lines.push(s1);
}
fn read_block_comment(rdr: @mut StringReader,
code_to_the_left: bool,
comments: &mut ~[cmnt]) {
- debug2!(">>> block comment");
+ debug!(">>> block comment");
let p = rdr.last_pos;
let mut lines: ~[~str] = ~[];
let col: CharPos = rdr.col;
} else {
let mut level: int = 1;
while level > 0 {
- debug2!("=== block comment level {}", level);
+ debug!("=== block comment level {}", level);
if is_eof(rdr) {
(rdr as @mut reader).fatal(~"unterminated block comment");
}
if !is_eof(rdr) && rdr.curr != '\n' && lines.len() == 1u {
style = mixed;
}
- debug2!("<<< block comment");
+ debug!("<<< block comment");
comments.push(cmnt {style: style, lines: lines, pos: p});
}
fn consume_comment(rdr: @mut StringReader,
code_to_the_left: bool,
comments: &mut ~[cmnt]) {
- debug2!(">>> consume comment");
+ debug!(">>> consume comment");
if rdr.curr == '/' && nextch(rdr) == '/' {
read_line_comments(rdr, code_to_the_left, comments);
} else if rdr.curr == '/' && nextch(rdr) == '*' {
read_block_comment(rdr, code_to_the_left, comments);
} else if rdr.curr == '#' && nextch(rdr) == '!' {
read_shebang_comment(rdr, code_to_the_left, comments);
- } else { fail2!(); }
- debug2!("<<< consume comment");
+ } else { fail!(); }
+ debug!("<<< consume comment");
}
#[deriving(Clone)]
let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
if token::is_lit(&tok) {
do with_str_from(rdr, bstart) |s| {
- debug2!("tok lit: {}", s);
+ debug!("tok lit: {}", s);
literals.push(lit {lit: s.to_owned(), pos: sp.lo});
}
} else {
- debug2!("tok: {}", token::to_str(get_ident_interner(), &tok));
+ debug!("tok: {}", token::to_str(get_ident_interner(), &tok));
}
first_read = false;
}
fn is_eof(@mut self) -> bool { self.cur_tok == token::EOF }
fn next_token(@mut self) -> TokenAndSpan {
let r = tt_next_token(self);
- debug2!("TtReader: r={:?}", r);
+ debug!("TtReader: r={:?}", r);
return r;
}
fn fatal(@mut self, m: ~str) -> ! {
if in_range(c, '0', '9') { return (c as int) - ('0' as int); }
if in_range(c, 'a', 'f') { return (c as int) - ('a' as int) + 10; }
if in_range(c, 'A', 'F') { return (c as int) - ('A' as int) + 10; }
- fail2!();
+ fail!();
}
fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; }
~"int literal is too large")
};
- debug2!("lexing {} as an unsuffixed integer literal", num_str);
+ debug!("lexing {} as an unsuffixed integer literal", num_str);
return token::LIT_INT_UNSUFFIXED(parsed as i64);
}
}
_ => assert_eq!("wrong 4","correct")
},
_ => {
- error2!("failing value 3: {:?}",first_set);
+ error!("failing value 3: {:?}",first_set);
assert_eq!("wrong 3","correct")
}
},
_ => {
- error2!("failing value 2: {:?}",delim_elts);
+ error!("failing value 2: {:?}",delim_elts);
assert_eq!("wrong","correct");
}
},
_ => {
- error2!("failing value: {:?}",tts);
+ error!("failing value: {:?}",tts);
assert_eq!("wrong 1","correct");
}
}
// followed by some token from the set edible + inedible. Recover
// from anticipated input errors, discarding erroneous characters.
pub fn commit_expr(&self, e: @Expr, edible: &[token::Token], inedible: &[token::Token]) {
- debug2!("commit_expr {:?}", e);
+ debug!("commit_expr {:?}", e);
match e.node {
ExprPath(*) => {
// might be unit-struct construction; check for recoverableinput error.
// followed by some token from the set edible + inedible. Check
// for recoverable input errors, discarding erroneous characters.
pub fn commit_stmt(&self, s: @Stmt, edible: &[token::Token], inedible: &[token::Token]) {
- debug2!("commit_stmt {:?}", s);
+ debug!("commit_stmt {:?}", s);
let _s = s; // unused, but future checks might want to inspect `s`.
if self.last_token.as_ref().map_default(false, |t| is_ident_or_path(*t)) {
let expected = vec::append(edible.to_owned(), inedible);
};
let hi = p.last_span.hi;
- debug2!("parse_trait_methods(): trait method signature ends in \
+ debug!("parse_trait_methods(): trait method signature ends in \
`{}`",
self.this_token_to_str());
match *p.token {
token::SEMI => {
p.bump();
- debug2!("parse_trait_methods(): parsing required method");
+ debug!("parse_trait_methods(): parsing required method");
// NB: at the moment, visibility annotations on required
// methods are ignored; this could change.
if vis != ast::inherited {
})
}
token::LBRACE => {
- debug2!("parse_trait_methods(): parsing provided method");
+ debug!("parse_trait_methods(): parsing provided method");
let (inner_attrs, body) =
p.parse_inner_attrs_and_block();
let attrs = vec::append(attrs, inner_attrs);
_ => 0
};
- debug2!("parser is_named_argument offset:{}", offset);
+ debug!("parser is_named_argument offset:{}", offset);
if offset == 0 {
is_plain_ident_or_underscore(&*self.token)
pub fn parse_arg_general(&self, require_name: bool) -> arg {
let is_mutbl = self.eat_keyword(keywords::Mut);
let pat = if require_name || self.is_named_argument() {
- debug2!("parse_arg_general parse_pat (require_name:{:?})",
+ debug!("parse_arg_general parse_pat (require_name:{:?})",
require_name);
let pat = self.parse_pat();
self.expect(&token::COLON);
pat
} else {
- debug2!("parse_arg_general ident_to_pat");
+ debug!("parse_arg_general ident_to_pat");
ast_util::ident_to_pat(ast::DUMMY_NODE_ID,
*self.last_span,
special_idents::invalid)
// There may be other types of expressions that can
// represent the callee in `for` and `do` expressions
// but they aren't represented by tests
- debug2!("sugary call on {:?}", e.node);
+ debug!("sugary call on {:?}", e.node);
self.span_fatal(
e.span,
format!("`{}` must be followed by a block call", keyword));
attrs = attrs_remaining + attrs;
first = false;
}
- debug2!("parse_mod_items: parse_item_or_view_item(attrs={:?})",
+ debug!("parse_mod_items: parse_item_or_view_item(attrs={:?})",
attrs);
match self.parse_item_or_view_item(attrs,
true /* macros allowed */) {
let first_ident = self.parse_ident();
let mut path = ~[first_ident];
- debug2!("parsed view_path: {}", self.id_to_str(first_ident));
+ debug!("parsed view_path: {}", self.id_to_str(first_ident));
match *self.token {
token::EQ => {
// x = foo::bar
break;
}
iovi_foreign_item(_) => {
- fail2!();
+ fail!();
}
}
attrs = self.parse_outer_attributes();
items.push(item)
}
iovi_foreign_item(_) => {
- fail2!();
+ fail!();
}
}
}
nt_block(*) => ~"block",
nt_stmt(*) => ~"statement",
nt_pat(*) => ~"pattern",
- nt_attr(*) => fail2!("should have been handled"),
- nt_expr(*) => fail2!("should have been handled above"),
+ nt_attr(*) => fail!("should have been handled"),
+ nt_expr(*) => fail!("should have been handled above"),
nt_ty(*) => ~"type",
nt_ident(*) => ~"identifier",
nt_path(*) => ~"path",
RPAREN => LPAREN,
RBRACE => LBRACE,
RBRACKET => LBRACKET,
- _ => fail2!()
+ _ => fail!()
}
}
// Yes 3, it makes the ring buffers big enough to never
// fall behind.
let n: uint = 3 * linewidth;
- debug2!("mk_printer {}", linewidth);
+ debug!("mk_printer {}", linewidth);
let token: ~[token] = vec::from_elem(n, EOF);
let size: ~[int] = vec::from_elem(n, 0);
let scan_stack: ~[uint] = vec::from_elem(n, 0u);
self.token[self.right] = t;
}
pub fn pretty_print(&mut self, t: token) {
- debug2!("pp ~[{},{}]", self.left, self.right);
+ debug!("pp ~[{},{}]", self.left, self.right);
match t {
EOF => {
if !self.scan_stack_empty {
self.left = 0u;
self.right = 0u;
} else { self.advance_right(); }
- debug2!("pp BEGIN({})/buffer ~[{},{}]",
+ debug!("pp BEGIN({})/buffer ~[{},{}]",
b.offset, self.left, self.right);
self.token[self.right] = t;
self.size[self.right] = -self.right_total;
}
END => {
if self.scan_stack_empty {
- debug2!("pp END/print ~[{},{}]", self.left, self.right);
+ debug!("pp END/print ~[{},{}]", self.left, self.right);
self.print(t, 0);
} else {
- debug2!("pp END/buffer ~[{},{}]", self.left, self.right);
+ debug!("pp END/buffer ~[{},{}]", self.left, self.right);
self.advance_right();
self.token[self.right] = t;
self.size[self.right] = -1;
self.left = 0u;
self.right = 0u;
} else { self.advance_right(); }
- debug2!("pp BREAK({})/buffer ~[{},{}]",
+ debug!("pp BREAK({})/buffer ~[{},{}]",
b.offset, self.left, self.right);
self.check_stack(0);
self.scan_push(self.right);
}
STRING(s, len) => {
if self.scan_stack_empty {
- debug2!("pp STRING('{}')/print ~[{},{}]",
+ debug!("pp STRING('{}')/print ~[{},{}]",
s, self.left, self.right);
self.print(t, len);
} else {
- debug2!("pp STRING('{}')/buffer ~[{},{}]",
+ debug!("pp STRING('{}')/buffer ~[{},{}]",
s, self.left, self.right);
self.advance_right();
self.token[self.right] = t;
}
}
pub fn check_stream(&mut self) {
- debug2!("check_stream ~[{}, {}] with left_total={}, right_total={}",
+ debug!("check_stream ~[{}, {}] with left_total={}, right_total={}",
self.left, self.right, self.left_total, self.right_total);
if self.right_total - self.left_total > self.space {
- debug2!("scan window is {}, longer than space on line ({})",
+ debug!("scan window is {}, longer than space on line ({})",
self.right_total - self.left_total, self.space);
if !self.scan_stack_empty {
if self.left == self.scan_stack[self.bottom] {
- debug2!("setting {} to infinity and popping", self.left);
+ debug!("setting {} to infinity and popping", self.left);
self.size[self.scan_pop_bottom()] = size_infinity;
}
}
}
}
pub fn scan_push(&mut self, x: uint) {
- debug2!("scan_push {}", x);
+ debug!("scan_push {}", x);
if self.scan_stack_empty {
self.scan_stack_empty = false;
} else {
assert!((self.right != self.left));
}
pub fn advance_left(&mut self, x: token, L: int) {
- debug2!("advnce_left ~[{},{}], sizeof({})={}", self.left, self.right,
+ debug!("advnce_left ~[{},{}], sizeof({})={}", self.left, self.right,
self.left, L);
if L >= 0 {
self.print(x, L);
}
}
pub fn print_newline(&mut self, amount: int) {
- debug2!("NEWLINE {}", amount);
+ debug!("NEWLINE {}", amount);
(*self.out).write_str("\n");
self.pending_indentation = 0;
self.indent(amount);
}
pub fn indent(&mut self, amount: int) {
- debug2!("INDENT {}", amount);
+ debug!("INDENT {}", amount);
self.pending_indentation += amount;
}
pub fn get_top(&mut self) -> print_stack_elt {
(*self.out).write_str(s);
}
pub fn print(&mut self, x: token, L: int) {
- debug2!("print {} {} (remaining line space={})", tok_str(x), L,
+ debug!("print {} {} (remaining line space={})", tok_str(x), L,
self.space);
- debug2!("{}", buf_str(self.token.clone(),
+ debug!("{}", buf_str(self.token.clone(),
self.size.clone(),
self.left,
self.right,
BEGIN(b) => {
if L > self.space {
let col = self.margin - self.space + b.offset;
- debug2!("print BEGIN -> push broken block at col {}", col);
+ debug!("print BEGIN -> push broken block at col {}", col);
self.print_stack.push(print_stack_elt {
offset: col,
pbreak: broken(b.breaks)
});
} else {
- debug2!("print BEGIN -> push fitting block");
+ debug!("print BEGIN -> push fitting block");
self.print_stack.push(print_stack_elt {
offset: 0,
pbreak: fits
}
}
END => {
- debug2!("print END -> pop END");
+ debug!("print END -> pop END");
let print_stack = &mut *self.print_stack;
assert!((print_stack.len() != 0u));
print_stack.pop();
let top = self.get_top();
match top.pbreak {
fits => {
- debug2!("print BREAK({}) in fitting block", b.blank_space);
+ debug!("print BREAK({}) in fitting block", b.blank_space);
self.space -= b.blank_space;
self.indent(b.blank_space);
}
broken(consistent) => {
- debug2!("print BREAK({}+{}) in consistent block",
+ debug!("print BREAK({}+{}) in consistent block",
top.offset, b.offset);
self.print_newline(top.offset + b.offset);
self.space = self.margin - (top.offset + b.offset);
}
broken(inconsistent) => {
if L > self.space {
- debug2!("print BREAK({}+{}) w/ newline in inconsistent",
+ debug!("print BREAK({}+{}) w/ newline in inconsistent",
top.offset, b.offset);
self.print_newline(top.offset + b.offset);
self.space = self.margin - (top.offset + b.offset);
} else {
- debug2!("print BREAK({}) w/o newline in inconsistent",
+ debug!("print BREAK({}) w/o newline in inconsistent",
b.blank_space);
self.indent(b.blank_space);
self.space -= b.blank_space;
}
}
STRING(s, len) => {
- debug2!("print STRING({})", s);
+ debug!("print STRING({})", s);
assert_eq!(L, len);
// assert!(L <= space);
self.space -= len;
}
EOF => {
// EOF should never get here.
- fail2!();
+ fail!();
}
}
}
word(s.s, ")");
}
ast::ty_mac(_) => {
- fail2!("print_type doesn't know how to print a ty_mac");
+ fail!("print_type doesn't know how to print a ty_mac");
}
ast::ty_infer => {
- fail2!("print_type shouldn't see a ty_infer");
+ fail!("print_type shouldn't see a ty_infer");
}
}
popen(s);
do commasep(s, inconsistent, struct_def.fields) |s, field| {
match field.node.kind {
- ast::named_field(*) => fail2!("unexpected named field"),
+ ast::named_field(*) => fail!("unexpected named field"),
ast::unnamed_field => {
maybe_print_comment(s, field.span.lo);
print_type(s, &field.node.ty);
for field in struct_def.fields.iter() {
match field.node.kind {
- ast::unnamed_field => fail2!("unexpected unnamed field"),
+ ast::unnamed_field => fail!("unexpected unnamed field"),
ast::named_field(ident, visibility) => {
hardbreak_if_not_bol(s);
maybe_print_comment(s, field.span.lo);
}
// BLEAH, constraints would be great here
_ => {
- fail2!("print_if saw if with weird alternative");
+ fail!("print_if saw if with weird alternative");
}
}
}
}
end(s); // close enclosing cbox
}
- None => fail2!()
+ None => fail!()
}
} else {
// the block will close the pattern's ibox
fn string_check<T:Eq> (given : &T, expected: &T) {
if !(given == expected) {
- fail2!("given {:?}, expected {:?}", given, expected);
+ fail!("given {:?}, expected {:?}", given, expected);
}
}
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
pub fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
return entry.value.clone();
}
}
- fail2!();
+ fail!();
}
#[inline]
#[fixed_stack_segment] #[inline(never)]
pub fn fact(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
fn index(&self, _idx: &uint) -> T {
match self {
&just(ref t) => (*t).clone(),
- ¬hing => { fail2!(); }
+ ¬hing => { fail!(); }
}
}
}
// except according to those terms.
pub unsafe fn f(xs: ~[int]) {
- xs.map(|_x| { unsafe fn q() { fail2!(); } });
+ xs.map(|_x| { unsafe fn q() { fail!(); } });
}
// except according to those terms.
pub fn foo<T>() {
- fn death() -> int { fail2!() }
- debug2!("{:?}", (||{ death() })());
+ fn death() -> int { fail!() }
+ debug!("{:?}", (||{ death() })());
}
pub fn read<T:read>(s: ~str) -> T {
match read::readMaybe(s) {
Some(x) => x,
- _ => fail2!("read failed!")
+ _ => fail!("read failed!")
}
}
for _ in range(0u, 20000) {
v.push('b' as u8);
if !str::is_utf8(v) {
- fail2!("is_utf8 failed");
+ fail!("is_utf8 failed");
}
}
}
for _ in range(0u, 5000) {
v.push_all(s.as_bytes());
if !str::is_utf8(v) {
- fail2!("is_utf8 failed");
+ fail!("is_utf8 failed");
}
}
}
for i in range(0u, n) {
let x = i.to_str();
- info2!("{}", x);
+ info!("{}", x);
}
}
match requests.try_recv() {
Some(get_count) => { responses.send(count.clone()); }
Some(bytes(b)) => {
- //error2!("server: received {:?} bytes", b);
+ //error!("server: received {:?} bytes", b);
count += b;
}
None => { done = true; }
}
}
responses.send(count);
- //error2!("server exiting");
+ //error!("server exiting");
}
fn run(args: &[~str]) {
worker_results.push(builder.future_result());
do builder.spawn {
for _ in range(0u, size / workers) {
- //error2!("worker {:?}: sending {:?} bytes", i, num_bytes);
+ //error!("worker {:?}: sending {:?} bytes", i, num_bytes);
to_child.send(bytes(num_bytes));
}
- //error2!("worker {:?} exiting", i);
+ //error!("worker {:?} exiting", i);
}
}
do task::spawn || {
r.recv();
}
- //error2!("sending stop message");
+ //error!("sending stop message");
to_child.send(stop);
move_out(to_child);
let result = from_child.recv();
args.clone()
};
- info2!("{:?}", args);
+ info!("{:?}", args);
run(args);
}
match requests.try_recv() {
Some(get_count) => { responses.send(count.clone()); }
Some(bytes(b)) => {
- //error2!("server: received {:?} bytes", b);
+ //error!("server: received {:?} bytes", b);
count += b;
}
None => { done = true; }
}
}
responses.send(count);
- //error2!("server exiting");
+ //error!("server exiting");
}
fn run(args: &[~str]) {
worker_results.push(builder.future_result());
do builder.spawn {
for _ in range(0u, size / workers) {
- //error2!("worker {:?}: sending {:?} bytes", i, num_bytes);
+ //error!("worker {:?}: sending {:?} bytes", i, num_bytes);
to_child.send(bytes(num_bytes));
}
- //error2!("worker {:?} exiting", i);
+ //error!("worker {:?} exiting", i);
};
}
do task::spawn || {
r.recv();
}
- //error2!("sending stop message");
+ //error!("sending stop message");
to_child.send(stop);
move_out(to_child);
let result = from_child.recv();
args.clone()
};
- info2!("{:?}", args);
+ info!("{:?}", args);
run(args);
}
7 => {~"seven"}
8 => {~"eight"}
9 => {~"nine"}
- _ => {fail2!("expected digits from 0 to 9...")}
+ _ => {fail!("expected digits from 0 to 9...")}
}
}
Ok(ref m) => {
return Config {stress: m.opt_present("stress")}
}
- Err(_) => { fail2!(); }
+ Err(_) => { fail!(); }
}
}
let n = 15;
assert_eq!(fib(n), fib(n));
i += 1;
- error2!("{}: Completed {} iterations", id, i);
+ error!("{}: Completed {} iterations", id, i);
}
}
return;
}
token => {
- info2!("thread: {} got token: {}", id, token);
+ info!("thread: {} got token: {}", id, token);
ch.send(token - 1);
if token <= n_tasks {
return;
g[row][col] = from_str::<uint>(comps[2]).unwrap() as u8;
}
else {
- fail2!("Invalid sudoku file");
+ fail!("Invalid sudoku file");
}
}
return Sudoku::new(g)
ptr = ptr + 1u;
} else {
// no: redo this field aft recoloring pred; unless there is none
- if ptr == 0u { fail2!("No solution found for this sudoku"); }
+ if ptr == 0u { fail!("No solution found for this sudoku"); }
ptr = ptr - 1u;
}
}
fn run(repeat: int, depth: int) {
for _ in range(0, repeat) {
- info2!("starting {:.4f}", precise_time_s());
+ info!("starting {:.4f}", precise_time_s());
do task::try {
recurse_or_fail(depth, None)
};
- info2!("stopping {:.4f}", precise_time_s());
+ info!("stopping {:.4f}", precise_time_s());
}
}
fn recurse_or_fail(depth: int, st: Option<State>) {
if depth == 0 {
- info2!("unwinding {:.4f}", precise_time_s());
- fail2!();
+ info!("unwinding {:.4f}", precise_time_s());
+ fail!();
} else {
let depth = depth - 1;
let (p,c) = comm::stream();
child_generation(from_str::<uint>(args[1]).unwrap(), c);
if p.try_recv().is_none() {
- fail2!("it happened when we slumbered");
+ fail!("it happened when we slumbered");
}
}
p.recv(); // block forever
}
}
- error2!("Grandchild group getting started");
+ error!("Grandchild group getting started");
for _ in range(0, num_tasks) {
// Make sure all above children are fully spawned; i.e., enlisted in
// their ancestor groups.
po.recv();
}
- error2!("Grandchild group ready to go.");
+ error!("Grandchild group ready to go.");
// Master grandchild task exits early.
}
let res = builder.future_result();
builder.supervised();
builder.spawn(f);
- error2!("{} group waiting", myname);
+ error!("{} group waiting", myname);
let x = res.recv();
assert_eq!(x, task::Success);
}
grandchild_group(num_tasks);
}
// When grandchild group is ready to go, make the middle group exit.
- error2!("Middle group wakes up and exits");
+ error!("Middle group wakes up and exits");
}
// Grandparent group waits for middle group to be gone, then fails
- error2!("Grandparent group wakes up and fails");
- fail2!();
+ error!("Grandparent group wakes up and fails");
+ fail!();
};
assert!(x.is_err());
}
// xfail-fast #[feature] doesn't work with check-fast
#[feature(asm)];
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
// xfail-fast #[feature] doesn't work with check-fast
#[feature(asm)];
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
// xfail-fast #[feature] doesn't work with check-fast
#[feature(asm)];
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
// xfail-fast #[feature] doesn't work with check-fast
#[feature(asm)];
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
fn test() {
let v: int;
v = 1; //~ NOTE prior assignment occurs here
- info2!("v={}", v);
+ info!("v={}", v);
v = 2; //~ ERROR re-assignment of immutable variable
- info2!("v={}", v);
+ info!("v={}", v);
}
fn main() {
fn main() {
let nyan : cat = cat(52u, 99);
- nyan.speak = || info2!("meow"); //~ ERROR attempted to take value of method
+ nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
}
let a: clam = clam{x: @1, y: @2};
let b: clam = clam{x: @10, y: @20};
let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int`
- info2!("{:?}", z);
+ info!("{:?}", z);
assert_eq!(z, 21);
let forty: fish = fish{a: @40};
let two: fish = fish{a: @2};
let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int`
- info2!("{:?}", answer);
+ info!("{:?}", answer);
assert_eq!(answer, 42);
}
// Tests that a function with a ! annotation always actually fails
fn bad_bang(i: uint) -> ! {
- if i < 0u { } else { fail2!(); }
+ if i < 0u { } else { fail!(); }
//~^ ERROR expected `!` but found `()`
}
// error-pattern:expected `~str` but found `int`
static i: ~str = 10i;
-fn main() { info2!("{:?}", i); }
+fn main() { info!("{:?}", i); }
impl Drop for X {
fn drop(&mut self) {
- error2!("destructor runs");
+ error!("destructor runs");
}
}
let x = Some(X { x: () });
match x {
Some(ref _y @ _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail2!()
+ None => fail!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error2!("destructor runs");
+ error!("destructor runs");
}
}
let x = Some((X { x: () }, X { x: () }));
match x {
Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail2!()
+ None => fail!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error2!("destructor runs");
+ error!("destructor runs");
}
}
let x = some2(X { x: () }, X { x: () });
match x {
some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- none2 => fail2!()
+ none2 => fail!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error2!("destructor runs");
+ error!("destructor runs");
}
}
let x = Some((X { x: () }, X { x: () }));
match x {
Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail2!()
+ None => fail!()
}
}
let x = Some(p);
c.send(false);
match x {
- Some(z) if z.recv() => { fail2!() }, //~ ERROR cannot bind by-move into a pattern guard
+ Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
Some(z) => { assert!(!z.recv()); },
- None => fail2!()
+ None => fail!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error2!("destructor runs");
+ error!("destructor runs");
}
}
let x = Some(X { x: () });
match x {
Some(_y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings
- None => fail2!()
+ None => fail!()
}
}
fn main() {
let x = compute1();
- info2!("{:?}", x);
+ info!("{:?}", x);
assert_eq!(x, -4f64);
}
fn main() {
let i = 8;
- let f = coerce(|| error2!("{:?}", i) );
+ let f = coerce(|| error!("{:?}", i) );
f();
}
fn main() {
let red: color = rgb(255, 0, 0);
match red {
- rgb(r, g, b) => { info2!("rgb"); }
- hsl(h, s, l) => { info2!("hsl"); }
+ rgb(r, g, b) => { info!("rgb"); }
+ hsl(h, s, l) => { info!("hsl"); }
}
}
let a = match y {
Y(ref mut a, _) => a,
- X => fail2!()
+ X => fail!()
};
let b = match y {
Y(_, ref mut b) => b,
- X => fail2!()
+ X => fail!()
};
*a += 1;
let a = match y {
Y(ref mut a, _) => a,
- X => fail2!()
+ X => fail!()
};
let b = match y {
Y(ref mut b, _) => b, //~ ERROR cannot borrow
- X => fail2!()
+ X => fail!()
};
*a += 1;
p[0] = 5; //~ ERROR cannot assign
- info2!("{}", *q);
+ info!("{}", *q);
}
fn borrow(_x: &[int], _f: &fn()) {}
x = X(Left((0,0))); //~ ERROR cannot assign to `x`
(*f)()
},
- _ => fail2!()
+ _ => fail!()
}
}
}
int2: int,
}
-fn make_foo() -> ~Foo { fail2!() }
+fn make_foo() -> ~Foo { fail!() }
fn borrow_same_field_twice_mut_mut() {
let mut foo = make_foo();
int2: int,
}
-fn make_foo() -> Foo { fail2!() }
+fn make_foo() -> Foo { fail!() }
fn borrow_same_field_twice_mut_mut() {
let mut foo = make_foo();
impl<'self> Drop for defer<'self> {
fn drop(&mut self) {
unsafe {
- error2!("{:?}", self.x);
+ error!("{:?}", self.x);
}
}
}
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail2!() }
-fn for_func(_f: &fn() -> bool) { fail2!() }
-fn produce<T>() -> T { fail2!(); }
+fn cond() -> bool { fail!() }
+fn for_func(_f: &fn() -> bool) { fail!() }
+fn produce<T>() -> T { fail!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail2!() }
-fn produce<T>() -> T { fail2!(); }
+fn cond() -> bool { fail!() }
+fn produce<T>() -> T { fail!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
#[allow(unused_variable)];
#[allow(dead_assignment)];
-fn cond() -> bool { fail2!() }
+fn cond() -> bool { fail!() }
fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true }
fn separate_arms() {
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail2!() }
-fn for_func(_f: &fn() -> bool) { fail2!() }
-fn produce<T>() -> T { fail2!(); }
+fn cond() -> bool { fail!() }
+fn for_func(_f: &fn() -> bool) { fail!() }
+fn produce<T>() -> T { fail!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
let v = ~3;
let _w = &v;
do task::spawn {
- info2!("v={}", *v);
+ info!("v={}", *v);
//~^ ERROR cannot move `v` into closure
}
let v = ~3;
let _w = &v;
task::spawn(|| {
- info2!("v={}", *v);
+ info!("v={}", *v);
//~^ ERROR cannot move
});
}
*x = Right(1.0);
*z
}
- _ => fail2!()
+ _ => fail!()
}
}
}
}
let z = tail[0].clone();
- info2!("{:?}", z);
+ info!("{:?}", z);
}
_ => {
unreachable!();
let x: int = 3;
let y: &mut int = &mut x; //~ ERROR cannot borrow
*y = 5;
- info2!("{:?}", *y);
+ info!("{:?}", *y);
}
Some(ref m) => { //~ ERROR borrowed value does not live long enough
msg = m;
},
- None => { fail2!() }
+ None => { fail!() }
}
println(*msg);
}
let vec = ~[1, 2, 3, 4];
let tail = match vec {
[_, ..tail] => tail, //~ ERROR does not live long enough
- _ => fail2!("a")
+ _ => fail!("a")
};
tail
}
let vec = ~[1, 2, 3, 4];
let init = match vec {
[..init, _] => init, //~ ERROR does not live long enough
- _ => fail2!("b")
+ _ => fail!("b")
};
init
}
let vec = ~[1, 2, 3, 4];
let slice = match vec {
[_, ..slice, _] => slice, //~ ERROR does not live long enough
- _ => fail2!("c")
+ _ => fail!("c")
};
slice
}
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
- _ => fail2!("foo")
+ _ => fail!("foo")
}
}
let vec = ~[1, 2, 3, 4];
let tail = match vec {
[_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough
- _ => fail2!("foo")
+ _ => fail!("foo")
};
tail
}
impl cat {
pub fn eat(&self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1;
if self.meows % 5 == 0 {
self.how_hungry += 1;
impl cat {
fn sleep(&self) { loop{} }
fn meow(&self) {
- error2!("Meow");
+ error!("Meow");
meows += 1u; //~ ERROR unresolved name
sleep(); //~ ERROR unresolved name
}
fn main() {
// Type inference didn't use to be able to handle this:
- foo(|| fail2!());
+ foo(|| fail!());
foo(|| 22); //~ ERROR mismatched types
}
let x = foo(10);
let _y = x.clone();
//~^ ERROR does not implement any method in scope
- error2!("{:?}", x);
+ error!("{:?}", x);
}
fn main() {
match *1 { //~ ERROR: cannot be dereferenced
- _ => { fail2!(); }
+ _ => { fail!(); }
}
}
impl Drop for X {
fn drop(&mut self) {
- error2!("value: {}", self.x);
+ error!("value: {}", self.x);
}
}
fn main() {
let x = X { x: ~"hello" };
let y = unwrap(x);
- error2!("contents: {}", y);
+ error!("contents: {}", y);
}
impl Drop for X {
fn drop(&mut self) {
- error2!("value: {}", self.x);
+ error!("value: {}", self.x);
}
}
let x = X { x: ~"hello" };
match x {
- X { x: y } => error2!("contents: {}", y)
+ X { x: y } => error!("contents: {}", y)
//~^ ERROR cannot move out of type `X`, which defines the `Drop` trait
}
}
// error-pattern: unresolved name `this_does_nothing_what_the`.
-fn main() { info2!("doing"); this_does_nothing_what_the; info2!("boing"); }
+fn main() { info!("doing"); this_does_nothing_what_the; info!("boing"); }
}
mod bar {
- fn x() { info2!("x"); }
+ fn x() { info!("x"); }
pub fn y() { }
}
// error-pattern:failed to find an implementation of trait std::sys::FailWithCause for int
-fn main() { fail2!(5); }
+fn main() { fail!(5); }
// error-pattern:unexpected token
fn main() {
- fail2!(@);
+ fail!(@);
}
// except according to those terms.
// error-pattern:failed to find an implementation of trait std::sys::FailWithCause for ~[int]
-fn main() { fail2!(~[0i]); }
+fn main() { fail!(~[0i]); }
fn main() {
let a = if true { true };
- info2!("{:?}", a);
+ info!("{:?}", a);
}
use module_of_many_things::*;
mod module_of_many_things {
- pub fn f1() { info2!("f1"); }
- pub fn f2() { info2!("f2"); }
- fn f3() { info2!("f3"); }
- pub fn f4() { info2!("f4"); }
+ pub fn f1() { info!("f1"); }
+ pub fn f2() { info!("f2"); }
+ fn f3() { info!("f3"); }
+ pub fn f4() { info!("f4"); }
}
mod circ1 {
pub use circ2::f2;
- pub fn f1() { info2!("f1"); }
+ pub fn f1() { info!("f1"); }
pub fn common() -> uint { return 0u; }
}
mod circ2 {
pub use circ1::f1;
- pub fn f2() { info2!("f2"); }
+ pub fn f2() { info!("f2"); }
pub fn common() -> uint { return 1u; }
}
use zed::bar;
use zed::baz;
mod zed {
- pub fn bar() { info2!("bar"); }
+ pub fn bar() { info!("bar"); }
}
fn main(args: ~[str]) { bar(); }
mod baz {}
mod zed {
- pub fn bar() { info2!("bar3"); }
+ pub fn bar() { info!("bar3"); }
}
fn main(args: ~[str]) { bar(); }
// error-pattern: unresolved
use main::bar;
-fn main(args: ~[str]) { info2!("foo"); }
+fn main(args: ~[str]) { info!("foo"); }
mod a { pub use b::foo; }
mod b { pub use a::foo; }
-fn main(args: ~[str]) { info2!("loop"); }
+fn main(args: ~[str]) { info!("loop"); }
fn foo(a: uint) -> uint { a }
fn main() {
- info2!("{:u}", foo(10i)); //~ ERROR mismatched types
+ info!("{:u}", foo(10i)); //~ ERROR mismatched types
}
// except according to those terms.
fn main() {
- error2!("{:?}", x); //~ ERROR unresolved name `x`.
+ error!("{:?}", x); //~ ERROR unresolved name `x`.
}
impl<A> vec_monad<A> for ~[A] {
fn bind<B>(&self, f: &fn(A) -> ~[B]) {
- let mut r = fail2!();
+ let mut r = fail!();
for elt in self.iter() { r = r + f(*elt); }
//~^ ERROR the type of this value must be known
}
fn fail_len(v: ~[int]) -> uint {
let mut i = 3;
- fail2!();
+ fail!();
for x in v.iter() { i += 1u; }
//~^ ERROR: unreachable statement
return i;
// except according to those terms.
fn main() {
- let x = fail2!();
+ let x = fail!();
x.clone(); //~ ERROR the type of this value must be known in this context
}
// error-pattern: unresolved name `foobar`.
-fn main(args: ~[str]) { info2!("{:?}", foobar); }
+fn main(args: ~[str]) { info!("{:?}", foobar); }
// `chan` is not a trait, it's an enum
impl chan for int { //~ ERROR chan is not a trait
- fn send(&self, v: int) { fail2!() }
+ fn send(&self, v: int) { fail!() }
}
fn main() {
fn main() {
let kitty : cat = cat { x: () };
- error2!("{:?}", *kitty);
+ error!("{:?}", *kitty);
}
fn main() {
let nyan = cat { foo: () };
- error2!("{:?}", *nyan);
+ error!("{:?}", *nyan);
}
}
impl A for E {
- fn b<F:Freeze,G>(_x: F) -> F { fail2!() } //~ ERROR type parameter 0 requires `Freeze`
+ fn b<F:Freeze,G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Freeze`
}
fn main() {}
impl A for E {
// n.b. The error message is awful -- see #3404
- fn b<F:Clone,G>(&self, _x: G) -> G { fail2!() } //~ ERROR method `b` has an incompatible type
+ fn b<F:Clone,G>(&self, _x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type
}
fn main() {}
impl Drop for C {
fn drop(&mut self) {
- error2!("dropping: {:?}", self.x);
+ error!("dropping: {:?}", self.x);
}
}
//~^ ERROR unresolved name `k0`.
}
}
- fail2!();
+ fail!();
}
fn main() {}
{
let _z = match g(1, 2) {
- g(x, x) => { info2!("{:?}", x + x); }
+ g(x, x) => { info!("{:?}", x + x); }
//~^ ERROR Identifier `x` is bound more than once in the same pattern
};
let _z = match i(l(1, 2), m(3, 4)) {
i(l(x, _), m(_, x)) //~ ERROR Identifier `x` is bound more than once in the same pattern
- => { error2!("{:?}", x + x); }
+ => { error!("{:?}", x + x); }
};
let _z = match (1, 2) {
}
fn main() {
- info2!("Result: ");
+ info!("Result: ");
}
static y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
- error2!("{}", y);
+ error!("{}", y);
}
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
}
- error2!("{:?}", Bar);
+ error!("{:?}", Bar);
}
~Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
~HTMLImageElement(ref d) if d.image.is_some() => { true }
},
- _ => fail2!("WAT") //~ ERROR unreachable pattern
+ _ => fail!("WAT") //~ ERROR unreachable pattern
};
}
impl PTrait for P {
fn getChildOption(&self) -> Option<@P> {
static childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant
- fail2!();
+ fail!();
}
}
// except according to those terms.
fn foo<T>(t: T) {}
-fn main() { foo(fail2!()) } //~ ERROR cannot determine a type for this expression: unconstrained type
+fn main() { foo(fail!()) } //~ ERROR cannot determine a type for this expression: unconstrained type
}
}
-fn callback<T>(_f: &fn() -> T) -> T { fail2!() }
+fn callback<T>(_f: &fn() -> T) -> T { fail!() }
unsafe fn unsf() {}
fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
sure that when purity is inherited that the source of the unsafe-ness
is tracked correctly */
unsafe {
- unsafe fn what() -> ~[~str] { fail2!() }
+ unsafe fn what() -> ~[~str] { fail!() }
do callback {
what();
fn main() {
let i: int;
- info2!("{}", false && { i = 5; true });
- info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ info!("{}", false && { i = 5; true });
+ info!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
}
// Tests that a function with a ! annotation always actually fails
// error-pattern: some control paths may return
-fn bad_bang(i: uint) -> ! { info2!("{}", 3); }
+fn bad_bang(i: uint) -> ! { info!("{}", 3); }
fn main() { bad_bang(5u); }
fn main() {
let x: int;
force(|| {
- info2!("{}", x); //~ ERROR capture of possibly uninitialized variable: `x`
+ info!("{}", x); //~ ERROR capture of possibly uninitialized variable: `x`
});
}
x = 0;
}
- info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ info!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { info2!("{}", foo()); }
+fn main() { info!("{}", foo()); }
x = 0;
}
- info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ info!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { info2!("{}", foo()); }
+fn main() { info!("{}", foo()); }
// except according to those terms.
fn force(f: &fn() -> int) -> int { f() }
-fn main() { info2!("{:?}", force(|| {})); } //~ ERROR mismatched types
+fn main() { info!("{:?}", force(|| {})); } //~ ERROR mismatched types
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
fn main() {
let x: int; if 1 > 2 { x = 10; }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info2!("{:?}", x); }
+fn foo(x: int) { info!("{:?}", x); }
fn main() {
let x: int;
if 1 > 2 {
- info2!("whoops");
+ info!("whoops");
} else {
x = 10;
}
let i: int;
i //~ ERROR use of possibly uninitialized variable: `i`
};
- error2!("{:?}", f());
+ error!("{:?}", f());
}
let y: ~int = ~42;
let mut x: ~int;
loop {
- info2!("{:?}", y);
+ info!("{:?}", y);
loop {
loop {
loop {
let y: ~int = ~42;
let mut x: ~int;
loop {
- info2!("{:?}", y); //~ ERROR use of moved value: `y`
+ info!("{:?}", y); //~ ERROR use of moved value: `y`
while true { while true { while true { x = y; x.clone(); } } }
//~^ ERROR use of moved value: `y`
}
fn main() {
let i: int;
- info2!("{}", false || { i = 5; true });
- info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ info!("{}", false || { i = 5; true });
+ info!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
fn main() {
let x: int;
fn main() {
let x = ~5;
let y = x;
- info2!("{:?}", *x); //~ ERROR use of moved value: `x`
+ info!("{:?}", *x); //~ ERROR use of moved value: `x`
y.clone();
}
// except according to those terms.
fn send<T:Send>(ch: _chan<T>, data: T) {
- info2!("{:?}", ch);
- info2!("{:?}", data);
- fail2!();
+ info!("{:?}", ch);
+ info!("{:?}", data);
+ fail!();
}
struct _chan<T>(int);
// message after the send deinitializes it
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
send(ch, message);
- info2!("{:?}", message); //~ ERROR use of moved value: `message`
+ info!("{:?}", message); //~ ERROR use of moved value: `message`
}
-fn main() { fail2!(); }
+fn main() { fail!(); }
v = 3;
break;
}
- info2!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
+ info!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
}
fn main() {
// a good test that we merge paths correctly in the presence of a
// variable that's used before it's declared
-fn my_fail() -> ! { fail2!(); }
+fn my_fail() -> ! { fail!(); }
fn main() {
match true { false => { my_fail(); } true => { } }
- info2!("{:?}", x); //~ ERROR unresolved name `x`.
+ info!("{:?}", x); //~ ERROR unresolved name `x`.
let x: int;
}
// they occur as part of various kinds of expressions.
struct Foo<A> { f: A }
-fn guard(_s: ~str) -> bool {fail2!()}
+fn guard(_s: ~str) -> bool {fail!()}
fn touch<A>(_a: &A) {}
fn f10() {
// terms of the binding, not the discriminant.
struct Foo<A> { f: A }
-fn guard(_s: ~str) -> bool {fail2!()}
+fn guard(_s: ~str) -> bool {fail!()}
fn touch<A>(_a: &A) {}
fn f10() {
(f.c)(f, true);
println!("{:?}", msg);
},
- None => fail2!("oops"),
+ None => fail!("oops"),
}
}
}
assert_eq!((arc_v.get())[2], 3);
- info2!("{:?}", arc_v);
+ info!("{:?}", arc_v);
}
assert_eq!((arc_v.get())[2], 3); //~ ERROR use of moved value: `arc_v`
- info2!("{:?}", arc_v); //~ ERROR use of moved value: `arc_v`
+ info!("{:?}", arc_v); //~ ERROR use of moved value: `arc_v`
}
do task::spawn {
let y = x.take(); //~ ERROR does not fulfill `Send`
- error2!("{:?}", y);
+ error!("{:?}", y);
}
}
fn main() {
let x = a(c);
match x {
- a(d) => { fail2!("hello"); }
- b => { fail2!("goodbye"); }
+ a(d) => { fail!("hello"); }
+ b => { fail!("goodbye"); }
}
}
fn main() {
let x = foo(10);
let _y = x.clone(); //~ ERROR does not implement any method in scope
- error2!("{:?}", x);
+ error!("{:?}", x);
}
}
fn main() {
- info2!("{:?}", foo{ x: 1 } as int);
+ info!("{:?}", foo{ x: 1 } as int);
}
// unrelated errors.
fn foo(a: int, b: int, c: int, d:int) {
- fail2!();
+ fail!();
}
fn main() {
// error-pattern:literal out of range
-fn main() { info2!("{}", 300u8); }
+fn main() { info!("{}", 300u8); }
let foo = Foo { bar: [1u8, 2, 3, 4, 5], baz: 10i32 };
unsafe {
let oof: Oof<[u8, .. 5], i32> = cast::transmute(foo);
- info2!("{:?}", oof);
+ info!("{:?}", oof);
}
}
let foo = Foo { bar: 1, baz: 10 };
unsafe {
let oof: Oof = cast::transmute(foo);
- info2!("{:?}", oof);
+ info!("{:?}", oof);
}
}
enum bar { t1((), Option<~[int]>), t2, }
// n.b. my change changes this error message, but I think it's right -- tjc
-fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail2!(); } } } //~ ERROR binary operation * cannot be applied to
+fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation * cannot be applied to
fn main() { }
fn foo(t: bar) {
match t {
t1(_, Some::<int>(x)) => {
- info2!("{:?}", x);
+ info!("{:?}", x);
}
- _ => { fail2!(); }
+ _ => { fail!(); }
}
}
// Can't do this copy
let x = ~~~A {y: r(i)};
let _z = x.clone(); //~ ERROR failed to find an implementation
- info2!("{:?}", x);
+ info!("{:?}", x);
}
- error2!("{:?}", *i);
+ error!("{:?}", *i);
}
fn main() {
let mut d = dog();
d.chase_cat();
- info2!("cats_chased: {}", d.cats_chased);
+ info!("cats_chased: {}", d.cats_chased);
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn of<T>() -> &fn(T) { fail2!(); }
-fn subtype<T>(x: &fn(T)) { fail2!(); }
+fn of<T>() -> &fn(T) { fail!(); }
+fn subtype<T>(x: &fn(T)) { fail!(); }
fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
// Here, x, y, and z are free. Other letters
// Do not infer an ordering from the return value.
let z: &'b uint = &*x;
//~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
- fail2!();
+ fail!();
}
fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: &fn(&'a &'b uint)) {
fn main() {
let i = 3;
do wants_static_fn { //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
- info2!("i={}", i);
+ info!("i={}", i);
}
}
fn main() {
let x = return_it();
- info2!("foo={}", *x);
+ info!("foo={}", *x);
}
fn main() {
let x = return_it();
- info2!("foo={}", *x);
+ info!("foo={}", *x);
}
extern mod std;
fn last<T>(v: ~[&T]) -> std::option::Option<T> {
- fail2!();
+ fail!();
}
fn main() {
fn foo(c: quux) { assert!((false)); }
-fn main() { fail2!(); }
+fn main() { fail!(); }
fn main() {
let i = ~r { b: true };
let _j = i.clone(); //~ ERROR failed to find an implementation
- info2!("{:?}", i);
+ info!("{:?}", i);
}
let r2 = ~[~r { i: i2 }];
f(r1.clone(), r2.clone());
//~^ ERROR failed to find an implementation of
- info2!("{:?}", (r2, *i1));
- info2!("{:?}", (r1, *i2));
+ info!("{:?}", (r2, *i1));
+ info!("{:?}", (r1, *i2));
}
use std::libc;
fn main() {
- info2!("{:?}", 1.0 as *libc::FILE); // Can't cast float to foreign.
+ info!("{:?}", 1.0 as *libc::FILE); // Can't cast float to foreign.
}
fn f() {
let v = ~[1i];
- info2!("{}", v.some_field_name); //type error
+ info!("{}", v.some_field_name); //type error
}
fn main() { }
let i = ~[r(0)];
let j = ~[r(1)];
let k = i + j;
- info2!("{}", j);
+ info!("{}", j);
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn f() { if (1 == fail2!()) { } else { } }
+fn f() { if (1 == fail!()) { } else { } }
fn main() { }
// except according to those terms.
// error-pattern:meep
-fn f(_a: int, _b: int, _c: @int) { fail2!("moop"); }
+fn f(_a: int, _b: int, _c: @int) { fail!("moop"); }
-fn main() { f(1, fail2!("meep"), @42); }
+fn main() { f(1, fail!("meep"), @42); }
// except according to those terms.
// error-pattern:quux
-fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); }
+fn my_err(s: ~str) -> ! { error!("{}", s); fail!("quux"); }
fn main() { 3u == my_err(~"bye"); }
// except according to those terms.
// error-pattern:quux
-fn foo() -> ! { fail2!("quux"); }
+fn foo() -> ! { fail!("quux"); }
fn main() { foo() == foo(); }
// except according to those terms.
// error-pattern:quux
-fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); }
+fn my_err(s: ~str) -> ! { error!("{}", s); fail!("quux"); }
fn main() { 3u == my_err(~"bye"); }
do x.as_imm_buf |p, _len| {
let base = p as uint;
let idx = base / mem::size_of::<uint>();
- error2!("ov1 base = 0x{:x}", base);
- error2!("ov1 idx = 0x{:x}", idx);
- error2!("ov1 sizeof::<uint>() = 0x{:x}", mem::size_of::<uint>());
- error2!("ov1 idx * sizeof::<uint>() = 0x{:x}",
+ error!("ov1 base = 0x{:x}", base);
+ error!("ov1 idx = 0x{:x}", idx);
+ error!("ov1 sizeof::<uint>() = 0x{:x}", mem::size_of::<uint>());
+ error!("ov1 idx * sizeof::<uint>() = 0x{:x}",
idx * mem::size_of::<uint>());
// This should fail.
- error2!("ov1 0x{:x}", x[idx]);
+ error!("ov1 0x{:x}", x[idx]);
}
}
port: port_id,
}
-fn send<T:Send>(_ch: chan_t<T>, _data: T) { fail2!(); }
+fn send<T:Send>(_ch: chan_t<T>, _data: T) { fail!(); }
-fn main() { fail2!("quux"); }
+fn main() { fail!("quux"); }
// error-pattern:test
fn main() {
- let _i: int = fail2!("test");
+ let _i: int = fail!("test");
}
// error-pattern:test
fn f() {
- fail2!("test");
+ fail!("test");
}
fn main() {
// error-pattern:test
fn main() {
- fail2!("test");
+ fail!("test");
}
//error-pattern:One
fn main() {
- fail2!("One");
- fail2!("Two");
+ fail!("One");
+ fail!("Two");
}
fn main() {
let mut a = 1;
if 1 == 1 { a = 2; }
- fail2!(~"woooo" + "o");
+ fail!(~"woooo" + "o");
}
// error-pattern:explicit
-fn main() { fail2!(); }
+fn main() { fail!(); }
// error-pattern:explicit failure
-fn f() -> ! { fail2!() }
+fn f() -> ! { fail!() }
fn main() { f(); }
// error-pattern:explicit failure
-fn f() -> ! { fail2!() }
+fn f() -> ! { fail!() }
fn g() -> int { let x = if true { f() } else { 10 }; return x; }
// error-pattern:explicit failure
-fn main() { let _x = if false { 0 } else if true { fail2!() } else { 10 }; }
+fn main() { let _x = if false { 0 } else if true { fail!() } else { 10 }; }
// error-pattern:explicit failure
-fn f() -> ! { fail2!() }
+fn f() -> ! { fail!() }
fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }
// error-pattern:explicit failure
-fn main() { let _x = match true { false => { 0 } true => { fail2!() } }; }
+fn main() { let _x = match true { false => { 0 } true => { fail!() } }; }
do task::spawn {
let result = count(5u);
info!("result = %?", result);
- fail2!();
+ fail!();
};
}
}
// except according to those terms.
// error-pattern:woe
-fn f(a: int) { info2!("{}", a); }
+fn f(a: int) { info!("{}", a); }
-fn main() { f(fail2!("woe")); }
+fn main() { f(fail!("woe")); }
// error-pattern:failed at 'explicit failure'
fn main() {
- fail2!();
+ fail!();
}
// error-pattern:failed at 'test-fail-fmt 42 rust'
fn main() {
- fail2!("test-fail-fmt {} {}", 42, "rust");
+ fail!("test-fail-fmt {} {}", 42, "rust");
}
// error-pattern:failed at 'test-fail-owned'
fn main() {
- fail2!("test-fail-owned");
+ fail!("test-fail-owned");
}
// error-pattern:failed at 'test-fail-static'
fn main() {
- fail2!("test-fail-static");
+ fail!("test-fail-static");
}
// error-pattern:moop
extern mod extra;
-fn main() { fail2!("moop"); }
+fn main() { fail!("moop"); }
// error-pattern:oops
fn bigfail() {
- while (fail2!("oops")) { if (fail2!()) {
- match (fail2!()) { () => {
+ while (fail!("oops")) { if (fail!()) {
+ match (fail!()) { () => {
}
}
}};
fn main() {
do spawn {
- fail2!("test");
+ fail!("test");
}
}
let mut t = ::std::task::task();
t.name(~"owned name");
do t.spawn {
- fail2!("test");
+ fail!("test");
}
}
let mut t = ::std::task::task();
t.name("send name".to_send_str());
do t.spawn {
- fail2!("test");
+ fail!("test");
}
}
let mut t = ::std::task::task();
t.name("static name");
do t.spawn {
- fail2!("test");
+ fail!("test");
}
}
// error-pattern:meh
extern mod extra;
-fn main() { let str_var: ~str = ~"meh"; fail2!("{}", str_var); }
+fn main() { let str_var: ~str = ~"meh"; fail!("{}", str_var); }
// error-pattern:moop
extern mod extra;
-fn main() { for _ in range(0u, 10u) { fail2!("moop"); } }
+fn main() { for _ in range(0u, 10u) { fail!("moop"); } }
fn foo(x: uint) {
if even(x) {
- info2!("{}", x);
+ info!("{}", x);
} else {
- fail2!("Number is odd");
+ fail!("Number is odd");
}
}
// except according to those terms.
// error-pattern:quux
-fn my_err(s: ~str) -> ! { error2!("{}", s); fail2!("quux"); }
+fn my_err(s: ~str) -> ! { error!("{}", s); fail!("quux"); }
fn main() { if my_err(~"bye") { } }
fn main() {
do io::with_str_reader(~"") |rdr| {
- match rdr.read_char() { '=' => { } _ => { fail2!() } }
+ match rdr.read_char() { '=' => { } _ => { fail!() } }
}
}
},
a: ~0
};
- fail2!();
+ fail!();
}
enum e<T> { e(arc::Arc<T>) }
-fn foo() -> e<int> {fail2!();}
+fn foo() -> e<int> {fail!();}
fn main() {
let _f = foo();
fn main() {
let mut x = ~[];
let y = ~[3];
- fail2!("so long");
+ fail!("so long");
x.push_all_move(y);
~"good" + ~"bye";
}
fn main() {
let origin = Point {x: 0, y: 0};
- let f: Point = Point {x: (fail2!("beep boop")),.. origin};
+ let f: Point = Point {x: (fail!("beep boop")),.. origin};
}
use std::comm;
use std::task;
-fn child() { fail2!(); }
+fn child() { fail!(); }
fn main() {
let (p, _c) = comm::stream::<()>();
use std::comm;
use std::task;
-fn grandchild() { fail2!("grandchild dies"); }
+fn grandchild() { fail!("grandchild dies"); }
fn child() {
let (p, _c) = comm::stream::<int>();
fn main() {
let i =
- match Some::<int>(3) { None::<int> => { fail2!() } Some::<int>(_) => { fail2!() } };
+ match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { fail!() } };
foo(i);
}
// except according to those terms.
// error-pattern:quux
-fn f() -> ! { fail2!("quux") }
+fn f() -> ! { fail!("quux") }
fn g() -> int { match f() { true => { 1 } false => { 0 } } }
fn main() { g(); }
// error-pattern:squirrelcupcake
fn cmp() -> int {
match (Some('a'), None::<char>) {
- (Some(_), _) => { fail2!("squirrelcupcake"); }
- (_, Some(_)) => { fail2!(); }
- _ => { fail2!("wat"); }
+ (Some(_), _) => { fail!("squirrelcupcake"); }
+ (_, Some(_)) => { fail!(); }
+ _ => { fail!("wat"); }
}
}
-fn main() { error2!("{}", cmp()); }
+fn main() { error!("{}", cmp()); }
if i != 0 {
getbig(i - 1);
} else {
- fail2!();
+ fail!();
}
}
} else {
unsafe {
rustrt::rust_get_argc();
- fail2!();
+ fail!();
}
}
}
if i != 0 {
getbig_and_fail(i - 1);
} else {
- fail2!();
+ fail!();
}
}
if i != 0 {
getbig_and_fail(i - 1);
} else {
- fail2!();
+ fail!();
}
}
use std::result;
fn main() {
- error2!("{:?}", result::Err::<int,~str>(~"kitty").unwrap());
+ error!("{:?}", result::Err::<int,~str>(~"kitty").unwrap());
}
struct T { t: ~str }
fn main() {
- let pth = fail2!("bye");
+ let pth = fail!("bye");
let _rs: T = T {t: pth};
}
use std::os;
fn main() {
- error2!("whatever");
+ error!("whatever");
// Setting the exit status only works when the scheduler terminates
// normally. In this case we're going to fail, so instead of of
// returning 50 the process will return the typical rt failure code.
os::set_exit_status(50);
- fail2!();
+ fail!();
}
}
fn main() {
- error2!("whatever");
+ error!("whatever");
do task::spawn {
let _i = r(5);
};
- fail2!();
+ fail!();
}
use std::os;
fn main() {
- error2!("whatever");
+ error!("whatever");
// 101 is the code the runtime uses on task failure and the value
// compiletest expects run-fail tests to return.
os::set_exit_status(101);
pub fn exported() { }
#[test]
- fn unexported() { fail2!("runned an unexported test"); }
+ fn unexported() { fail!("runned an unexported test"); }
}
// We don't want to see any invalid reads
fn main() {
fn f() {
- fail2!();
+ fail!();
}
task::spawn(|| f() );
}
fn goodfail() {
task::deschedule();
- fail2!("goodfail");
+ fail!("goodfail");
}
fn main() {
// We shouldn't be able to get past this recv since there's no
// message available
let i: int = po.recv();
- fail2!("badfail");
+ fail!("badfail");
}
fn main() {
os::args();
- fail2!("please have a nonzero exit status");
+ fail!("please have a nonzero exit status");
}
// except according to those terms.
// error-pattern: fail
-fn main() { ~fail2!(); }
+fn main() { ~fail!(); }
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
let y = ~0;
let x: @~fn() = @(|| {
- error2!("{:?}", y.clone());
+ error!("{:?}", y.clone());
});
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
use std::cast;
fn failfn() {
- fail2!();
+ fail!();
}
struct r {
cast::forget(i1);
let x = @r(i1p);
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
let x = @~"hi";
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
trait i {
fn main() {
let x = @~0 as @i;
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
let x = @~~0;
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
let x = @~0;
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
let x = @~[0, 1, 2, 3, 4, 5];
failfn();
- error2!("{:?}", x);
+ error!("{:?}", x);
}
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
fn main() {
@0;
- fail2!();
+ fail!();
}
// error-pattern:fail
-fn f() -> @int { fail2!(); }
+fn f() -> @int { fail!(); }
fn main() {
let _a: @int = f();
fn main() {
let _a: @int = {
- fail2!();
+ fail!();
};
}
fn a() { }
-fn b() { fail2!(); }
+fn b() { fail!(); }
fn main() {
let _x = ~[0];
#[allow(unused_variable)];
fn x(it: &fn(int)) {
- fail2!();
+ fail!();
it(0);
}
}
fn main() {
- x(|_x| fail2!() );
+ x(|_x| fail!() );
}
let cheese = cheese.clone();
let f: &fn() = || {
let _chew = mush + cheese;
- fail2!("so yummy")
+ fail!("so yummy")
};
f();
});
}
fn test_str() {
let res = match false { true => { ~"happy" },
- _ => fail2!("non-exhaustive match failure") };
+ _ => fail!("non-exhaustive match failure") };
assert_eq!(res, ~"happy");
}
fn main() {
arr.push(@~"key stuff");
map.insert(arr.clone(), arr + &[@~"value stuff"]);
if arr.len() == 5 {
- fail2!();
+ fail!();
}
}
}
// error-pattern:fail
fn f(_a: @int) {
- fail2!();
+ fail!();
}
fn main() {
{
let _b = @0;
{
- fail2!();
+ fail!();
}
}
}
// error-pattern:fail
-fn f() -> ~[int] { fail2!(); }
+fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might
// have been to do with memory allocation patterns.
// error-pattern:fail
-fn f() -> ~[int] { fail2!(); }
+fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might
// have been to do with memory allocation patterns.
// error-pattern:fail
-fn f() -> ~[int] { fail2!(); }
+fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might
// have been to do with memory allocation patterns.
// error-pattern:fail
fn build() -> ~[int] {
- fail2!();
+ fail!();
}
struct Blk { node: ~[int] }
}
fn build2() -> ~[int] {
- fail2!();
+ fail!();
}
struct Blk { node: ~[int], span: ~[int] }
}
impl Drop for r {
- fn drop(&mut self) { fail2!("squirrel") }
+ fn drop(&mut self) { fail!("squirrel") }
}
fn r(i: int) -> r { r { i: i } }
}
impl Drop for r {
- fn drop(&mut self) { fail2!("wombat") }
+ fn drop(&mut self) { fail!("wombat") }
}
fn r(i: int) -> r { r { i: i } }
fn main() {
@0;
let r = r(0);
- fail2!();
+ fail!();
}
#[unsafe_destructor]
impl Drop for faily_box {
fn drop(&mut self) {
- fail2!("quux");
+ fail!("quux");
}
}
fn f() {
let _a = @0;
- fail2!();
+ fail!();
}
fn g() {
// error-pattern:fail
fn fold_local() -> @~[int]{
- fail2!();
+ fail!();
}
fn main() {
}
fn fold_remote() -> @~[int]{
- fail2!();
+ fail!();
}
fn main() {
// error-pattern:fail
fn f() {
- fail2!();
+ fail!();
}
fn main() {
// error-pattern:fail
fn failfn() {
- fail2!();
+ fail!();
}
fn main() {
#[allow(while_true)];
// error-pattern:quux
-fn main() { let _x: int = { while true { fail2!("quux"); } ; 8 } ; }
+fn main() { let _x: int = { while true { fail!("quux"); } ; 8 } ; }
// error-pattern:giraffe
fn main() {
- fail2!({ while true { fail2!("giraffe") }; "clandestine" });
+ fail!({ while true { fail!("giraffe") }; "clandestine" });
}
pub fn main() {
let (a, b) = f(22_u64, 44u16).f();
- info2!("a={:?} b={:?}", a, b);
+ info!("a={:?} b={:?}", a, b);
assert_eq!(a, 22u64);
assert_eq!(b, 44u16);
}
let z = f(~x, y);
make_cycle(z);
let (a, b) = z.f();
- info2!("a={} b={}", *a as uint, b as uint);
+ info!("a={} b={}", *a as uint, b as uint);
assert_eq!(*a, x);
assert_eq!(b, y);
}
pub fn main() {
let a: int = 10;
- info2!("{}", a);
+ info!("{}", a);
assert_eq!(a * (a - 1), 90);
}
assert_eq!(i32_b << 1, i32_b << 1);
assert_eq!(i32_b >> 1, i32_b >> 1);
assert_eq!(i32_b & i32_b << 1, 0);
- info2!("{}", i32_b | i32_b << 1);
+ info!("{}", i32_b | i32_b << 1);
assert_eq!(i32_b | i32_b << 1, 0x30303030);
}
// xfail-fast
pub fn main() {
- fail2!()
+ fail!()
}
#[main]
fn f<T,U>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
pub fn main() {
- info2!("{:?}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
- info2!("{:?}", f(5, 6).a);
+ info!("{:?}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
+ info!("{:?}", f(5, 6).a);
}
// Check that issue #954 stays fixed
pub fn main() {
- match -1 { -1 => {}, _ => fail2!("wat") }
+ match -1 { -1 => {}, _ => fail!("wat") }
assert_eq!(1-1, 0);
}
let x = Some(p);
match x {
Some(z) => { dispose(z); },
- None => fail2!()
+ None => fail!()
}
}
let mut r = p(1, 2);
unsafe {
- error2!("q = {:x}, r = {:x}",
+ error!("q = {:x}, r = {:x}",
(::std::cast::transmute::<*p, uint>(&q)),
(::std::cast::transmute::<*p, uint>(&r)));
}
a ^= b;
b ^= a;
a = a ^ b;
- info2!("{}", a);
- info2!("{}", b);
+ info!("{}", a);
+ info!("{}", b);
assert_eq!(b, 1);
assert_eq!(a, 2);
assert_eq!(!0xf0 & 0xff, 0xf);
// Statement form does not require parentheses:
for i in v.iter() {
- info2!("{:?}", *i);
+ info!("{:?}", *i);
}
// Usable at all:
assert!(false);
}
match do v.iter().all |e| { e.is_negative() } {
- true => { fail2!("incorrect answer."); }
+ true => { fail!("incorrect answer."); }
false => { }
}
match 3 {
_ if do v.iter().any |e| { e.is_negative() } => {
}
_ => {
- fail2!("wrong answer.");
+ fail!("wrong answer.");
}
}
pub fn main() {
fn as_buf<T>(s: ~str, f: &fn(~str) -> T) -> T { f(s) }
- as_buf(~"foo", |foo: ~str| -> () error2!("{}", foo) );
+ as_buf(~"foo", |foo: ~str| -> () error!("{}", foo) );
}
odds += 1;
}
});
- error2!("{:?}", odds);
+ error!("{:?}", odds);
assert_eq!(odds, 4);
}
sum += *i * *j;
});
});
- error2!("{:?}", sum);
+ error!("{:?}", sum);
assert_eq!(sum, 225);
}
);
match s {
~Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)),
- _ => fail2!()
+ _ => fail!()
}
}
- fn check_id(&mut self, s: int) { fail2!() }
+ fn check_id(&mut self, s: int) { fail!() }
}
pub fn main() { }
add_int(ints, 44);
do iter_ints(ints) |i| {
- error2!("int = {}", *i);
+ error!("int = {}", *i);
true
};
- error2!("ints={:?}", ints);
+ error!("ints={:?}", ints);
}
x = @F {f: ~4};
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(**b_x)) as uint);
assert_eq!(**b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(**b_x)));
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
x = @F {f: ~4};
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(*b_x)) as uint);
assert_eq!(*b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
*x = @F {f: ~4};
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(**b_x)) as uint);
assert_eq!(**b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(**b_x)));
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
*x = @F{f: ~4};
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(*b_x)) as uint);
assert_eq!(*b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
assert_eq!(ptr::to_unsafe_ptr(&(*x)), ptr::to_unsafe_ptr(&(*b_x)));
x = @22;
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(*b_x)) as uint);
assert_eq!(*b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x)) != ptr::to_unsafe_ptr(&(*b_x)));
exp = 4;
}
- info2!("*r = {}, exp = {}", *r, exp);
+ info!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);
x = @5;
y = @6;
- info2!("*r = {}, exp = {}", *r, exp);
+ info!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);
assert_eq!(x, @5);
assert_eq!(y, @6);
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
x = @F {f: ~4};
- info2!("ptr::to_unsafe_ptr(*b_x) = {:x}",
+ info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
ptr::to_unsafe_ptr(&(*b_x)) as uint);
assert_eq!(*b_x, 3);
assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
impl Drop for noncopyable {
fn drop(&mut self) {
- error2!("dropped");
+ error!("dropped");
}
}
fn length_is_even(_vs: @int) -> bool { return true; }
fn foo(_acc: int, n: int) {
- if is_odd(n) && length_is_even(some_box(1)) { error2!("bloop"); }
+ if is_odd(n) && length_is_even(some_box(1)) { error!("bloop"); }
}
pub fn main() { foo(67, 5); }
fn length_is_even(_vs: @int) -> bool { return true; }
fn foo(_acc: int, n: int) {
- if is_odd(n) || length_is_even(some_box(1)) { error2!("bloop"); }
+ if is_odd(n) || length_is_even(some_box(1)) { error!("bloop"); }
}
pub fn main() { foo(67, 5); }
pub fn main() {
let foo: int = 17;
let bfoo: Box<int> = Box {c: @foo};
- info2!("see what's in our box");
+ info!("see what's in our box");
assert_eq!(unbox::<int>(bfoo), foo);
}
parent: Option<T>
}
-fn empty<T>() -> Tree<T> { fail2!() }
+fn empty<T>() -> Tree<T> { fail!() }
struct Box {
tree: Tree<@Box>
pub fn main() {
let x = 3;
- info2!("&x={:x}", borrow::to_uint(&x));
+ info!("&x={:x}", borrow::to_uint(&x));
}
pub fn main() {
let p = @22u;
let r = foo(p);
- info2!("r={}", r);
+ info!("r={}", r);
assert_eq!(r, 22u);
}
impl Drop for cat {
#[cat_dropper]
- fn drop(&mut self) { error2!("{} landed on hir feet" , self . name); }
+ fn drop(&mut self) { error!("{} landed on hir feet" , self . name); }
}
Actually, cats don't always land on their feet when you drop them.
*/
fn drop(&mut self) {
- error2!("{} landed on hir feet", self.name);
+ error!("{} landed on hir feet", self.name);
}
}
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
- info2!("{}", actual);
+ info!("{}", actual);
assert_eq!(actual, expected);
}
impl dog {
fn bark(&self) -> int {
- info2!("Woof {} {}", *self.barks, *self.volume);
+ info!("Woof {} {}", *self.barks, *self.volume);
*self.barks += 1u;
if *self.barks % 3u == 0u {
*self.volume += 1;
if *self.barks % 10u == 0u {
*self.volume -= 2;
}
- info2!("Grrr {} {}", *self.barks, *self.volume);
+ info!("Grrr {} {}", *self.barks, *self.volume);
*self.volume
}
}
impl cat {
fn meow(&self) -> uint {
- info2!("Meow");
+ info!("Meow");
*self.meows += 1u;
if *self.meows % 5u == 0u {
*self.how_hungry += 1;
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
true
}
- fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail2!() }
+ fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail!() }
fn remove(&mut self, k: &int) -> bool {
if self.find(k).is_some() {
}
}
- fn pop(&mut self, _k: &int) -> Option<T> { fail2!() }
+ fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
- fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail2!() }
+ fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
}
impl<T> cat<T> {
pub fn get<'a>(&'a self, k: &int) -> &'a T {
match self.find(k) {
Some(v) => { v }
- None => { fail2!("epic fail"); }
+ None => { fail!("epic fail"); }
}
}
impl<T> cat<T> {
fn meow(&mut self) {
self.meows += 1;
- error2!("Meow {}", self.meows);
+ error!("Meow {}", self.meows);
if self.meows % 5 == 0 {
self.how_hungry += 1;
}
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
- info2!("{}", actual);
+ info!("{}", actual);
assert_eq!(actual, expected);
}
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
- error2!("OM NOM NOM");
+ error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
- error2!("Not hungry!");
+ error!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&mut self) {
- error2!("Meow");
+ error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
use std::task;
fn adder(x: @int, y: @int) -> int { return *x + *y; }
-fn failer() -> @int { fail2!(); }
+fn failer() -> @int { fail!(); }
pub fn main() {
assert!(task::try(|| {
adder(@2, failer()); ()
pub fn main() {
let (a, b) = f(22_u64, 44u16).f();
- info2!("a={:?} b={:?}", a, b);
+ info!("a={:?} b={:?}", a, b);
assert_eq!(a, 22u64);
assert_eq!(b, 44u16);
}
let (p, ch) = stream();
let _t = task::spawn(|| child(&ch) );
let y = p.recv();
- error2!("received");
- error2!("{:?}", y);
+ error!("received");
+ error!("{:?}", y);
assert_eq!(y, 10);
}
fn child(c: &Chan<int>) {
- error2!("sending");
+ error!("sending");
c.send(10);
- error2!("value sent");
+ error!("value sent");
}
pub fn main() {
let x: int = 2 + 2;
- info2!("{}", x);
- info2!("hello, world");
- info2!("{}", 10);
+ info!("{}", x);
+ info!("hello, world");
+ info!("{}", 10);
}
fn main() {
// only fails if debug! evaluates its argument.
- debug2!("{:?}", { if true { fail2!() } });
+ debug!("{:?}", { if true { fail!() } });
}
fn main() {
// exits early if debug! evaluates its arguments, otherwise it
// will hit the fail.
- debug2!("{:?}", { if true { return; } });
+ debug!("{:?}", { if true { return; } });
- fail2!();
+ fail!();
}
pub fn main() {
match X {
Baz => {}
- _ => fail2!()
+ _ => fail!()
}
match Y {
Bar(s) => assert!(s == 2654435769),
- _ => fail2!()
+ _ => fail!()
}
match Z {
Quux(d,h) => {
assert_eq!(d, 0x123456789abcdef0);
assert_eq!(h, 0x1234);
}
- _ => fail2!()
+ _ => fail!()
}
}
pub fn method(&self) {
match *self {
V => {}
- VV(*) => fail2!()
+ VV(*) => fail!()
}
}
}
fn f(a: &E) {
match *a {
V => {}
- VV(*) => fail2!()
+ VV(*) => fail!()
}
}
pub fn main() {
match *C {
V0 => (),
- _ => fail2!()
+ _ => fail!()
}
}
pub fn main() {
match C {
- S0 { _ } => fail2!(),
+ S0 { _ } => fail!(),
S1 { u } => assert!(u == 23)
}
}
pub fn main() {
match C0 {
V0 => (),
- _ => fail2!()
+ _ => fail!()
}
match C1 {
V1(n) => assert!(n == 0xDEADBEE),
- _ => fail2!()
+ _ => fail!()
}
}
pub fn main() {
match C[1] {
V1(n) => assert!(n == 0xDEADBEE),
- _ => fail2!()
+ _ => fail!()
}
match C[2] {
V0 => (),
- _ => fail2!()
+ _ => fail!()
}
}
pub fn main() {
match C[1] {
V1(n) => assert!(n == 0xDEADBEE),
- _ => fail2!()
+ _ => fail!()
}
match C[2] {
V0 => (),
- _ => fail2!()
+ _ => fail!()
}
}
pub fn main() {
match X {
Bar => {}
- Baz | Boo => fail2!()
+ Baz | Boo => fail!()
}
match Y {
Baz => {}
- Bar | Boo => fail2!()
+ Bar | Boo => fail!()
}
}
static i: int = 10;
-pub fn main() { info2!("{}", i); }
+pub fn main() { info!("{}", i); }
#[start]
fn start(argc: int, argv: **u8) -> int {
do std::rt::start(argc, argv) {
- info2!("creating my own runtime is joy");
+ info!("creating my own runtime is joy");
}
}
// -*- rust -*-
-pub fn main() { if 1 == 1 { return; } info2!("Paul is dead"); }
+pub fn main() { if 1 == 1 { return; } info!("Paul is dead"); }
-pub fn main() { let x = @mut 5; *x = 1000; info2!("{:?}", *x); }
+pub fn main() { let x = @mut 5; *x = 1000; info!("{:?}", *x); }
pub struct FailCmp;
impl Eq for FailCmp {
- fn eq(&self, _: &FailCmp) -> bool { fail2!("eq") }
+ fn eq(&self, _: &FailCmp) -> bool { fail!("eq") }
}
impl Ord for FailCmp {
- fn lt(&self, _: &FailCmp) -> bool { fail2!("lt") }
+ fn lt(&self, _: &FailCmp) -> bool { fail!("lt") }
}
impl TotalEq for FailCmp {
- fn equals(&self, _: &FailCmp) -> bool { fail2!("equals") }
+ fn equals(&self, _: &FailCmp) -> bool { fail!("equals") }
}
impl TotalOrd for FailCmp {
- fn cmp(&self, _: &FailCmp) -> Ordering { fail2!("cmp") }
+ fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") }
}
#[deriving(Eq,Ord,TotalEq,TotalOrd)]
#[allow(unreachable_code)];
fn f() {
- fail2!();
+ fail!();
- let _x: int = fail2!();
+ let _x: int = fail!();
}
pub fn main() {
pub fn main() {
let x = Some(0u64);
match x {
- None => fail2!(),
+ None => fail!(),
Some(ref y) => assert!(is_aligned(y))
}
}
match Cons(10, @Nil) {
Cons(10, _) => {}
Nil => {}
- _ => fail2!()
+ _ => fail!()
}
}
let v = &"hello";
let y : &str = &"there";
- info2!("{}", x);
- info2!("{}", y);
+ info!("{}", x);
+ info!("{}", y);
assert_eq!(x[0], 'h' as u8);
assert_eq!(x[4], 'o' as u8);
let c = &"cccc";
let cc = &"ccccc";
- info2!("{}", a);
+ info!("{}", a);
assert!(a < b);
assert!(a <= b);
assert!(b >= a);
assert!(b > a);
- info2!("{}", b);
+ info!("{}", b);
assert!(a < c);
assert!(a <= c);
assert!(c >= a);
assert!(c > a);
- info2!("{}", c);
+ info!("{}", c);
assert!(c < cc);
assert!(c <= cc);
assert!(cc >= c);
assert!(cc > c);
- info2!("{}", cc);
+ info!("{}", cc);
}
let c : &[int] = &[2,2,2,2,3];
let cc : &[int] = &[2,2,2,2,2,2];
- info2!("{:?}", a);
+ info!("{:?}", a);
assert!(a < b);
assert!(a <= b);
assert!(b >= a);
assert!(b > a);
- info2!("{:?}", b);
+ info!("{:?}", b);
assert!(b < c);
assert!(b <= c);
assert!(c >= a);
assert!(c > a);
- info2!("{:?}", c);
+ info!("{:?}", c);
assert!(a < cc);
assert!(a <= cc);
assert!(cc >= a);
assert!(cc > a);
- info2!("{:?}", cc);
+ info!("{:?}", cc);
}
pub fn y() { super::super::foo::x(); }
}
- pub fn x() { info2!("x"); }
+ pub fn x() { info!("x"); }
}
pub fn main() { self::foo::bar::y(); }
}
pub mod bar {
- pub fn x() { info2!("x"); }
+ pub fn x() { info!("x"); }
}
pub fn main() { foo::x(); }
fn test_box() {
fn compare_box(b1: @bool, b2: @bool) -> bool {
- info2!("{}", *b1);
- info2!("{}", *b2);
+ info!("{}", *b1);
+ info!("{}", *b2);
return *b1 == *b2;
}
test_generic::<bool>(@true, compare_box);
fn test_box() {
fn compare_box(b1: ~bool, b2: ~bool) -> bool {
- info2!("{}", *b1);
- info2!("{}", *b2);
+ info!("{}", *b1);
+ info!("{}", *b2);
return *b1 == *b2;
}
test_generic::<bool>(~true, compare_box);
let _x = if true {
10
} else {
- if true { fail2!() } else { fail2!() }
+ if true { fail!() } else { fail!() }
};
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn test_if_fail() { let x = if false { fail2!() } else { 10 }; assert!((x == 10)); }
+fn test_if_fail() { let x = if false { fail!() } else { 10 }; assert!((x == 10)); }
fn test_else_fail() {
- let x = if true { 10 } else { fail2!() };
+ let x = if true { 10 } else { fail!() };
assert_eq!(x, 10);
}
fn test_elseif_fail() {
- let x = if false { 0 } else if false { fail2!() } else { 10 };
+ let x = if false { 0 } else if false { fail!() } else { 10 };
assert_eq!(x, 10);
}
// Tests for match as expressions resulting in boxed types
fn test_box() {
- let res = match true { true => { @100 } _ => fail2!("wat") };
+ let res = match true { true => { @100 } _ => fail!("wat") };
assert_eq!(*res, 100);
}
fn test_str() {
let res = match true { true => { ~"happy" },
- _ => fail2!("not happy at all") };
+ _ => fail!("not happy at all") };
assert_eq!(res, ~"happy");
}
let _x =
match true {
true => { 10 }
- false => { match true { true => { fail2!() } false => { fail2!() } } }
+ false => { match true { true => { fail!() } false => { fail!() } } }
};
}
// except according to those terms.
fn test_simple() {
- let r = match true { true => { true } false => { fail2!() } };
+ let r = match true { true => { true } false => { fail!() } };
assert_eq!(r, true);
}
fn test_box() {
- let r = match true { true => { ~[10] } false => { fail2!() } };
+ let r = match true { true => { ~[10] } false => { fail!() } };
assert_eq!(r[0], 10);
}
type compare<T> = &'static fn(@T, @T) -> bool;
fn test_generic<T>(expected: @T, eq: compare<T>) {
- let actual: @T = match true { true => { expected }, _ => fail2!() };
+ let actual: @T = match true { true => { expected }, _ => fail!() };
assert!((eq(expected, actual)));
}
type compare<T> = &'static fn(T, T) -> bool;
fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
- let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") };
+ let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") };
assert!((eq(expected, actual)));
}
fn test_generic<T:Clone>(expected: ~T, eq: compare<T>) {
let actual: ~T = match true {
true => { expected.clone() },
- _ => fail2!("wat")
+ _ => fail!("wat")
};
assert!((eq(expected, actual)));
}
fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
let actual: T = match true {
true => expected.clone(),
- _ => fail2!("wat")
+ _ => fail!("wat")
};
assert!((eq(expected, actual)));
}
type compare<T> = extern "Rust" fn(T, T) -> bool;
fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
- let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") };
+ let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") };
assert!((eq(expected, actual)));
}
struct R { i: int }
fn test_rec() {
- let rs = match true { true => R {i: 100}, _ => fail2!() };
+ let rs = match true { true => R {i: 100}, _ => fail!() };
assert_eq!(rs.i, 100);
}
// Tests for match as expressions resulting in boxed types
fn test_box() {
- let res = match true { true => { ~100 }, _ => fail2!() };
+ let res = match true { true => { ~100 }, _ => fail!() };
assert_eq!(*res, 100);
}
#[fixed_stack_segment]
fn count(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = count(1000u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 1000u);
}
#[fixed_stack_segment] #[inline(never)]
fn count(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
// has a large stack)
do task::spawn {
let result = count(1000u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 1000u);
};
}
#[fixed_stack_segment] #[inline(never)]
fn fact(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 3628800u);
}
#[fixed_stack_segment] #[inline(never)]
fn count(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
// has a large stack)
do task::spawn {
let result = count(12u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 2048u);
};
}
#[fixed_stack_segment] #[inline(never)]
fn fact(n: uint) -> uint {
unsafe {
- info2!("n = {}", n);
+ info!("n = {}", n);
externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
}
}
pub fn main() {
let result = fact(10u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 3628800u);
}
do 10u.times {
do task::spawn {
let result = count(5u);
- info2!("result = {}", result);
+ info!("result = {}", result);
assert_eq!(result, 16u);
};
}
fn f(x: int) -> int {
// info!("in f:");
- info2!("{}", x);
+ info!("{}", x);
if x == 1 {
// info!("bottoming out");
let y: int = x * f(x - 1);
// info!("returned");
- info2!("{}", y);
+ info!("{}", y);
return y;
}
}
}
pub fn main() {
- error2!("{}", match red {
+ error!("{}", match red {
red => { 1 }
green => { 2 }
blue => { 3 }
fn foo(n: f64) -> f64 { return n + 0.12345; }
let n: f64 = 0.1;
let m: f64 = foo(n);
- info2!("{}", m);
+ info!("{}", m);
}
pub fn main() {
let pi = 3.1415927;
- info2!("{:?}", -pi * (pi + 2.0 / pi) - pi * 5.0);
+ info!("{:?}", -pi * (pi + 2.0 / pi) - pi * 5.0);
if pi == 5.0 || pi < 10.0 || pi <= 2.0 || pi != 22.0 / 7.0 || pi >= 10.0
|| pi > 1.0 {
- info2!("yes");
+ info!("yes");
}
}
// except according to those terms.
fn f() {
- info2!("This is a bare function");
+ info!("This is a bare function");
}
pub fn main() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-pub fn main() { let x: ~[int] = ~[]; for _ in x.iter() { fail2!("moop"); } }
+pub fn main() { let x: ~[int] = ~[]; for _ in x.iter() { fail!("moop"); } }
let mut j: int = 0;
do pairs() |p| {
let (_0, _1) = p;
- info2!("{}", _0);
- info2!("{}", _1);
+ info!("{}", _0);
+ info!("{}", _1);
assert_eq!(_0 + 10, i);
i += 1;
j = _1;
// -*- rust -*-
pub fn main() {
let mut sum: int = 0;
- do first_ten |i| { info2!("main"); info2!("{}", i); sum = sum + i; }
- info2!("sum");
- info2!("{}", sum);
+ do first_ten |i| { info!("main"); info!("{}", i); sum = sum + i; }
+ info!("sum");
+ info!("{}", sum);
assert_eq!(sum, 45);
}
fn first_ten(it: &fn(int)) {
let mut i: int = 0;
- while i < 10 { info2!("first_ten"); it(i); i = i + 1; }
+ while i < 10 { info!("first_ten"); it(i); i = i + 1; }
}
pub fn main() {
let expected = @100;
let actual = id::<@int>(expected);
- info2!("{:?}", *actual);
+ info!("{:?}", *actual);
assert_eq!(*expected, *actual);
}
pub fn main() {
let expected = ~100;
let actual = id::<~int>(expected.clone());
- info2!("{:?}", *actual);
+ info!("{:?}", *actual);
assert_eq!(*expected, *actual);
}
pub fn main() {
let b = f::<int>(10);
- info2!("{:?}" ,b.a);
- info2!("{:?}", b.b);
+ info!("{:?}" ,b.a);
+ info!("{:?}", b.b);
assert_eq!(b.a, 10);
assert_eq!(b.b, 10);
}
fn f<T>(x: @T) -> @T { return x; }
-pub fn main() { let x = f(@3); info2!("{:?}", *x); }
+pub fn main() { let x = f(@3); info!("{:?}", *x); }
fn f<T>(x: ~T) -> ~T { return x; }
-pub fn main() { let x = f(~3); info2!("{:?}", *x); }
+pub fn main() { let x = f(~3); info!("{:?}", *x); }
let p: Triple = Triple {x: 65, y: 66, z: 67};
let mut q: Triple = Triple {x: 68, y: 69, z: 70};
y = id::<int>(x);
- info2!("{}", y);
+ info!("{}", y);
assert_eq!(x, y);
b = id::<char>(a);
- info2!("{}", b);
+ info!("{}", b);
assert_eq!(a, b);
q = id::<Triple>(p);
x = p.z;
y = q.z;
- info2!("{}", y);
+ info!("{}", y);
assert_eq!(x, y);
}
fn altfoo<T>(f: foo<T>) {
let mut hit = false;
- match f { arm::<T>(_x) => { info2!("in arm"); hit = true; } }
+ match f { arm::<T>(_x) => { info!("in arm"); hit = true; } }
assert!((hit));
}
pub fn main() {
let nop: noption<int> = some::<int>(5);
- match nop { some::<int>(n) => { info2!("{:?}", n); assert!((n == 5)); } }
+ match nop { some::<int>(n) => { info!("{:?}", n); assert!((n == 5)); } }
let nop2: noption<Pair> = some(Pair{x: 17, y: 42});
match nop2 {
some(t) => {
- info2!("{:?}", t.x);
- info2!("{:?}", t.y);
+ info!("{:?}", t.x);
+ info!("{:?}", t.y);
assert_eq!(t.x, 17);
assert_eq!(t.y, 42);
}
fn mk() -> int { return 1; }
-fn chk(a: int) { info2!("{}", a); assert!((a == 1)); }
+fn chk(a: int) { info!("{}", a); assert!((a == 1)); }
fn apply<T>(produce: extern fn() -> T,
consume: extern fn(T)) {
fn get_third<T>(t: (T, T, T)) -> T { let (_, _, x) = t; return x; }
pub fn main() {
- info2!("{:?}", get_third((1, 2, 3)));
+ info!("{:?}", get_third((1, 2, 3)));
assert_eq!(get_third((1, 2, 3)), 3);
assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8);
}
match getopts(args, opts) {
Ok(ref m) =>
assert!(!m.opt_present("b")),
- Err(ref f) => fail2!("{:?}", (*f).clone().to_err_msg())
+ Err(ref f) => fail!("{:?}", (*f).clone().to_err_msg())
};
}
return;
}
let (pp, cc) = stream();
- error2!("sending find_reducer");
+ error!("sending find_reducer");
ctrl.send(find_reducer(key.as_bytes().to_owned(), cc));
- error2!("receiving");
+ error!("receiving");
let c = pp.recv();
- error2!("{:?}", c);
+ error!("{:?}", c);
im.insert(key, c);
}
pub fn main() {
- let i: int = if false { fail2!() } else { 5 };
- info2!("{:?}", i);
+ let i: int = if false { fail!() } else { 5 };
+ info!("{:?}", i);
}
fn foo(x: uint) {
if even(x) {
- info2!("{}", x);
+ info!("{}", x);
} else {
- fail2!();
+ fail!();
}
}
use dug::too::greedily::and::too::deep::*;
mod module_of_many_things {
- pub fn f1() { info2!("f1"); }
- pub fn f2() { info2!("f2"); }
- fn f3() { info2!("f3"); }
- pub fn f4() { info2!("f4"); }
+ pub fn f1() { info!("f1"); }
+ pub fn f2() { info!("f2"); }
+ fn f3() { info!("f3"); }
+ pub fn f4() { info!("f4"); }
}
mod dug {
pub mod and {
pub mod too {
pub mod deep {
- pub fn nameless_fear() { info2!("Boo!"); }
- pub fn also_redstone() { info2!("Whatever."); }
+ pub fn nameless_fear() { info!("Boo!"); }
+ pub fn also_redstone() { info!("Whatever."); }
}
}
}
// except according to those terms.
mod foo {
- pub fn x(y: int) { info2!("{:?}", y); }
+ pub fn x(y: int) { info!("{:?}", y); }
}
mod bar {
use zed::bar;
mod zed {
- pub fn bar() { info2!("bar"); }
+ pub fn bar() { info!("bar"); }
}
pub fn main() { bar(); }
mod baz {
pub mod zed {
- pub fn bar() { info2!("bar2"); }
+ pub fn bar() { info!("bar2"); }
}
}
use zed::bar;
mod zed {
- pub fn bar() { info2!("bar"); }
+ pub fn bar() { info!("bar"); }
}
pub fn main() { let _zed = 42; bar(); }
mod foo {
pub use foo::zed::bar;
pub mod zed {
- pub fn bar() { info2!("foo"); }
+ pub fn bar() { info!("foo"); }
}
}
mod foo {
pub mod zed {
- pub fn baz() { info2!("baz"); }
+ pub fn baz() { info!("baz"); }
}
}
mod bar {
mod foo {
pub mod zed {
- pub fn baz() { info2!("baz"); }
+ pub fn baz() { info!("baz"); }
}
}
mod bar {
use z = foo::x;
mod foo {
- pub fn x(y: int) { info2!("{}", y); }
+ pub fn x(y: int) { info!("{}", y); }
}
pub fn main() { x(10); z(10); }
// -*- rust -*-
mod inner {
pub mod inner2 {
- pub fn hello() { info2!("hello, modular world"); }
+ pub fn hello() { info!("hello, modular world"); }
}
pub fn hello() { inner2::hello(); }
}
assert_eq!(v[3i8], 3);
assert_eq!(v[3u32], 3);
assert_eq!(v[3i32], 3);
- info2!("{}", v[3u8]);
+ info!("{}", v[3u8]);
assert_eq!(s[3u], 'd' as u8);
assert_eq!(s[3u8], 'd' as u8);
assert_eq!(s[3i8], 'd' as u8);
assert_eq!(s[3u32], 'd' as u8);
assert_eq!(s[3i32], 'd' as u8);
- info2!("{}", s[3u8]);
+ info!("{}", s[3u8]);
}
// except according to those terms.
pub fn main() {
- let early_error: &'static fn(&str) -> ! = |_msg| { fail2!() };
+ let early_error: &'static fn(&str) -> ! = |_msg| { fail!() };
}
pub fn main() {
let mut m = HashMap::new();
m.insert("foo".as_bytes().to_owned(), "bar".as_bytes().to_owned());
- error2!("{:?}", m);
+ error!("{:?}", m);
}
break;
}
- error2!("{:?}", x);
+ error!("{:?}", x);
assert_eq!(x, 42);
}
impl<A> foo<A> {
pub fn bar<B,C:clam<A>>(&self, _c: C) -> B {
- fail2!();
+ fail!();
}
}
struct foo(int);
impl foo {
- pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { fail2!(); }
+ pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { fail!(); }
}
pub fn main() { }
}
impl A for E {
- fn b<F,G>(_x: F) -> F { fail2!() }
+ fn b<F,G>(_x: F) -> F { fail!() }
//~^ ERROR in method `b`, type parameter 0 has 1 bound, but
}
}
fn meow() {
- error2!("meow")
+ error!("meow")
}
fn cat() -> cat {
}
mod rusti {
- pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail2!(); }
- pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail2!(); }
- pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail2!(); }
+ pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail!(); }
+ pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail!(); }
+ pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail!(); }
}
// We should consider moving this to ::std::unsafe, although I
// The receiver will eventually clean this up.
unsafe { forget(p); }
}
- full => { fail2!("duplicate send") }
+ full => { fail!("duplicate send") }
blocked => {
// The receiver will eventually clean this up.
}
full => {
// This is impossible
- fail2!("you dun goofed")
+ fail!("you dun goofed")
}
terminated => {
// I have to clean up, use drop_glue
}
blocked => {
// this shouldn't happen.
- fail2!("terminating a blocked packet")
+ fail!("terminating a blocked packet")
}
terminated | full => {
// I have to clean up, use drop_glue
let _addr : *::pipes::send_packet<pong> = match &p {
&ping(ref x) => { cast::transmute(x) }
};
- fail2!()
+ fail!()
}
}
let _addr : *::pipes::send_packet<ping> = match &p {
&pong(ref x) => { cast::transmute(x) }
};
- fail2!()
+ fail!()
}
}
pub fn do_pong(c: pong) -> (ping, ()) {
let packet = ::pipes::recv(c);
if packet.is_none() {
- fail2!("sender closed the connection")
+ fail!("sender closed the connection")
}
(pingpong::liberate_pong(packet.unwrap()), ())
}
pub fn do_ping(c: ping) -> (pong, ()) {
let packet = ::pipes::recv(c);
if packet.is_none() {
- fail2!("sender closed the connection")
+ fail!("sender closed the connection")
}
(pingpong::liberate_ping(packet.unwrap()), ())
}
fn client(chan: pingpong::client::ping) {
let chan = pingpong::client::do_ping(chan);
- error2!("Sent ping");
+ error!("Sent ping");
let (_chan, _data) = pingpong::client::do_pong(chan);
- error2!("Received pong");
+ error!("Received pong");
}
fn server(chan: pingpong::server::ping) {
let (chan, _data) = pingpong::server::do_ping(chan);
- error2!("Received ping");
+ error!("Received ping");
let _chan = pingpong::server::do_pong(chan);
- error2!("Sent pong");
+ error!("Sent pong");
}
pub fn main() {
use std::hashmap::HashMap;
fn add_interfaces(managed_ip: ~str, device: HashMap<~str, int>) {
- error2!("{}, {:?}", managed_ip, device.get(&~"interfaces"));
+ error!("{}, {:?}", managed_ip, device.get(&~"interfaces"));
}
pub fn main() {}
(*s).clone()
}
option::Some(value) => {
- error2!("{} was expected to be a string but is a {:?}", key, value);
+ error!("{} was expected to be a string but is a {:?}", key, value);
default
}
option::None => {
(label, bool_value(false))
}
_ => {
- error2!("Expected dict for {} interfaces but found {:?}", managed_ip, data);
+ error!("Expected dict for {} interfaces but found {:?}", managed_ip, data);
(~"gnos:missing-interface", bool_value(true))
}
}
}
_ =>
{
- error2!("Expected list for {} interfaces but found {:?}", managed_ip,
+ error!("Expected list for {} interfaces but found {:?}", managed_ip,
device.get(&~"interfaces"));
~[]
}
'.' => { earth }
' ' => { empty }
_ => {
- error2!("invalid square: {:?}", c);
- fail2!()
+ error!("invalid square: {:?}", c);
+ fail!()
}
}
}
// x.f();
// y.f();
// (*z).f();
- error2!("ok so far...");
+ error!("ok so far...");
z.f(); //segfault
}
// except according to those terms.
pub fn main() {
- error2!("{:?}", ("hi there!", "you"));
+ error!("{:?}", ("hi there!", "you"));
}
|buffer|
{
for i in range(0u, buffer.len()) {
- error2!("{}: {}", i, buffer[i])
+ error!("{}: {}", i, buffer[i])
}
};
samples_chan.send(GetSamples(name.clone(), callback));
match BadChar {
_ if true => BadChar,
- BadChar | BadSyntax => fail2!() ,
+ BadChar | BadSyntax => fail!() ,
};
}
let doc = json::from_str("").unwrap();
let mut decoder = json::Decoder(doc);
let _v: T = Decodable::decode(&mut decoder);
- fail2!()
+ fail!()
}
pub fn main() {}
fn foo(self_: &A) -> int {
if true {
- fail2!()
+ fail!()
} else {
*bar(self_.bar)
}
}
fn bar<'r>(_: &'r mut int) -> &'r int {
- fail2!()
+ fail!()
}
struct A {
impl<E> Graph<int, E> for HashMap<int, int> {
fn f(&self, _e: E) {
- fail2!();
+ fail!();
}
}
let a = A { x: 0 };
let A { x: ref x } = a;
- info2!("{:?}", x)
+ info!("{:?}", x)
}
match a {
A { x : ref x } => {
- info2!("{:?}", x)
+ info!("{:?}", x)
}
}
}
let sa = A { a: 100 };
let sb = B { b: 200, pa: &sa };
- debug2!("sa is {:?}", sa);
- debug2!("sb is {:?}", sb);
- debug2!("sb.pa is {:?}", sb.get_pa());
+ debug!("sa is {:?}", sa);
+ debug!("sb is {:?}", sb);
+ debug!("sb.pa is {:?}", sb.get_pa());
}
pub fn main() {
let e = Foo{f: 0};
match e {
- Foo{f: 1} => fail2!(),
+ Foo{f: 1} => fail!(),
Foo{_} => (),
- _ => fail2!(),
+ _ => fail!(),
}
}
pub fn main() {
let e = Foo{f: 0, b: false};
match e {
- Foo{f: 1, b: true} => fail2!(),
+ Foo{f: 1, b: true} => fail!(),
Foo{b: false, f: 0} => (),
- _ => fail2!(),
+ _ => fail!(),
}
}
fn test_stack_assign() {
let s: ~str = ~"a";
- info2!("{}", s.clone());
+ info!("{}", s.clone());
let t: ~str = ~"a";
assert!(s == t);
let u: ~str = ~"b";
assert!((s != u));
}
-fn test_heap_log() { let s = ~"a big ol' string"; info2!("{}", s); }
+fn test_heap_log() { let s = ~"a big ol' string"; info!("{}", s); }
fn test_stack_add() {
assert_eq!(~"a" + "b", ~"ab");
let mut s = ~"a";
s.push_str("b");
- info2!("{}", s.clone());
+ info!("{}", s.clone());
assert_eq!(s, ~"ab");
let mut s = ~"c";
pub fn main() {
let mut sum: int = 0;
range_(0, 100, |x| sum += x );
- info2!("{}", sum);
+ info!("{}", sum);
}
pub fn main() {
let e = @mut Refs{refs: ~[], n: 0};
- let _f: &fn() = || error2!("{}", e.n);
+ let _f: &fn() = || error!("{}", e.n);
e.refs.push(1);
}
let r = f(s);
return (r);
}
- fail2!();
+ fail!();
}
fn apply<T>(s: ~str, f: &fn(~str) -> T) -> T {
fn invoke(f: &fn()) { f(); }
let k = ~22;
let _u = A {a: k.clone()};
- invoke(|| error2!("{:?}", k.clone()) )
+ invoke(|| error!("{:?}", k.clone()) )
}
let x = 1 == 2 || 3 == 3;
assert!((x));
let mut y: int = 10;
- info2!("{:?}", x || incr(&mut y));
+ info!("{:?}", x || incr(&mut y));
assert_eq!(y, 10);
if true && x { assert!((true)); } else { assert!((false)); }
}
-fn foo(x: int) { info2!("{}", x); }
+fn foo(x: int) { info!("{}", x); }
pub fn main() { let mut x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); }
pub fn main() {
let x = ~[1, 2, 3];
let mut y = 0;
- for i in x.iter() { info2!("{:?}", *i); y += *i; }
- info2!("{:?}", y);
+ for i in x.iter() { info!("{:?}", *i); y += *i; }
+ info!("{:?}", y);
assert_eq!(y, 6);
let s = ~"hello there";
let mut i: int = 0;
// ...
i += 1;
- info2!("{:?}", i);
- info2!("{:?}", c);
+ info!("{:?}", i);
+ info!("{:?}", c);
}
assert_eq!(i, 11);
}
v = 3;
break;
}
- info2!("{}", v);
+ info!("{}", v);
}
pub fn main() {
-pub fn main() { if false { error2!("{}", ~"foo" + "bar"); } }
+pub fn main() { if false { error!("{}", ~"foo" + "bar"); } }
fn f<T,U:'static>() {
let sim = mk::<U>();
- error2!("{:?}", sim);
+ error!("{:?}", sim);
}
pub fn main() {
}
pub fn main() {
- info2!("{}", 1);
- info2!("{}", 2.0);
- warn2!("{:?}", Three);
- error2!("{:?}", ~[4]);
+ info!("{}", 1);
+ info!("{}", 2.0);
+ warn!("{:?}", Three);
+ error!("{:?}", ~[4]);
}
pub fn main() {
let mut i = 0u;
loop {
- error2!("a");
+ error!("a");
i += 1u;
if i == 10u {
break;
if i == 21u {
break;
}
- error2!("b");
+ error!("b");
is_even = false;
i += 1u;
if i % 2u != 0u {
}
assert!(!is_even);
loop {
- error2!("c");
+ error!("c");
if i == 22u {
break;
}
Some($pat) => {
$res
}
- _ => { fail2!(); }
+ _ => { fail!(); }
}
})
// except according to those terms.
// n.b. This was only ever failing with optimization disabled.
-fn a() -> int { match return 1 { 2 => 3, _ => fail2!() } }
+fn a() -> int { match return 1 { 2 => 3, _ => fail!() } }
pub fn main() { a(); }
pub fn main() {
let i: int =
- match Some::<int>(3) { None::<int> => { fail2!() } Some::<int>(_) => { 5 } };
- info2!("{}", i);
+ match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { 5 } };
+ info!("{}", i);
}
pub fn main() {
let e = Bar;
match e {
- Foo{f: _f} => fail2!(),
+ Foo{f: _f} => fail!(),
_ => (),
}
}
let e = Foo{f: 1};
match e {
Foo{_} => (),
- _ => fail2!(),
+ _ => fail!(),
}
match e {
Foo{f: _f} => (),
- _ => fail2!(),
+ _ => fail!(),
}
}
return;
}
-pub fn main() { info2!("hello"); foo::<int>(Some::<int>(5)); }
+pub fn main() { info!("hello"); foo::<int>(Some::<int>(5)); }
enum t { make_t(@int), clam, }
fn foo(s: @int) {
- info2!("{:?}", ::std::managed::refcount(s));
+ info!("{:?}", ::std::managed::refcount(s));
let count = ::std::managed::refcount(s);
let x: t = make_t(s); // ref up
assert_eq!(::std::managed::refcount(s), count + 1u);
- info2!("{:?}", ::std::managed::refcount(s));
+ info!("{:?}", ::std::managed::refcount(s));
match x {
make_t(y) => {
- info2!("{:?}", y); // ref up then down
+ info!("{:?}", y); // ref up then down
}
- _ => { info2!("?"); fail2!(); }
+ _ => { info!("?"); fail!(); }
}
- info2!("{:?}", ::std::managed::refcount(s));
+ info!("{:?}", ::std::managed::refcount(s));
assert_eq!(::std::managed::refcount(s), count + 1u);
let _ = ::std::managed::refcount(s); // don't get bitten by last-use.
}
foo(s); // ref up then down
- info2!("{}", ::std::managed::refcount(s));
+ info!("{}", ::std::managed::refcount(s));
let count2 = ::std::managed::refcount(s);
assert_eq!(count, count2);
}
fn altlit(f: int) -> int {
match f {
- 10 => { info2!("case 10"); return 20; }
- 11 => { info2!("case 11"); return 22; }
- _ => fail2!("the impossible happened")
+ 10 => { info!("case 10"); return 20; }
+ 11 => { info!("case 11"); return 22; }
+ _ => fail!("the impossible happened")
}
}
fn foo(x: maybe<int>) {
match x {
- nothing => { error2!("A"); }
- just(_a) => { error2!("B"); }
+ nothing => { error!("A"); }
+ just(_a) => { error!("B"); }
}
}
assert_eq!(a, ~"a");
assert_eq!(b, ~"b");
},
- _ => fail2!(),
+ _ => fail!(),
}
}
assert_eq!(a, 2);
assert_eq!(b, 3);
},
- _ => fail2!(),
+ _ => fail!(),
}
}
assert_eq!(*a, 2);
assert_eq!(*b, 3);
},
- _ => fail2!(),
+ _ => fail!(),
}
}
assert_eq!(a, 2);
assert_eq!(b, 3);
},
- _ => fail2!(),
+ _ => fail!(),
}
}
assert_eq!(*a, 2);
assert_eq!(*b, 3);
},
- _ => fail2!(),
+ _ => fail!(),
}
}
pub fn main() {
match 5u {
1u..5u => {}
- _ => fail2!("should match range"),
+ _ => fail!("should match range"),
}
match 5u {
- 6u..7u => fail2!("shouldn't match range"),
+ 6u..7u => fail!("shouldn't match range"),
_ => {}
}
match 5u {
- 1u => fail2!("should match non-first range"),
+ 1u => fail!("should match non-first range"),
2u..6u => {}
- _ => fail2!("math is broken")
+ _ => fail!("math is broken")
}
match 'c' {
'a'..'z' => {}
- _ => fail2!("should suppport char ranges")
+ _ => fail!("should suppport char ranges")
}
match -3 {
-7..5 => {}
- _ => fail2!("should match signed range")
+ _ => fail!("should match signed range")
}
match 3.0 {
1.0..5.0 => {}
- _ => fail2!("should match float range")
+ _ => fail!("should match float range")
}
match -1.5 {
-3.6..3.6 => {}
- _ => fail2!("should match negative float range")
+ _ => fail!("should match negative float range")
}
}
Some(ref z) if z.with(|b| *b) => {
do z.with |b| { assert!(*b); }
},
- _ => fail2!()
+ _ => fail!()
}
}
}
// Issue #53
pub fn main() {
- match ~"test" { ~"not-test" => fail2!(), ~"test" => (), _ => fail2!() }
+ match ~"test" { ~"not-test" => fail!(), ~"test" => (), _ => fail!() }
enum t { tag1(~str), tag2, }
match tag1(~"test") {
- tag2 => fail2!(),
- tag1(~"not-test") => fail2!(),
+ tag2 => fail!(),
+ tag1(~"not-test") => fail!(),
tag1(~"test") => (),
- _ => fail2!()
+ _ => fail!()
}
- let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail2!() };
+ let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail!() };
assert_eq!(x, 1);
- match ~"a" { ~"a" => { } ~"b" => { }, _ => fail2!() }
+ match ~"a" { ~"a" => { } ~"b" => { }, _ => fail!() }
}
pub fn main() {
let f = Foo{f: 1};
match f {
- Foo{f: 0} => fail2!(),
+ Foo{f: 0} => fail!(),
Foo{_} => (),
}
match f {
- Foo{f: 0} => fail2!(),
+ Foo{f: 0} => fail!(),
Foo{f: _f} => (),
}
match f {
- Foo{f: 0} => fail2!(),
+ Foo{f: 0} => fail!(),
_ => (),
}
}
pub fn main() {
match ~100 {
~x => {
- info2!("{:?}", x);
+ info!("{:?}", x);
assert_eq!(x, 100);
}
}
Some(num) => num as u32
};
assert_eq!(f, 1234u32);
- error2!("{}", f)
+ error!("{}", f)
}
unsafe {
let addr = rusti::morestack_addr();
assert!(addr.is_not_null());
- error2!("{}", addr);
+ error!("{}", addr);
}
}
grow(&mut v);
grow(&mut v);
let len = v.len();
- info2!("{}", len);
+ info!("{}", len);
assert_eq!(len, 3 as uint);
}
pub fn main() {
match -5 {
-5 => {}
- _ => { fail2!() }
+ _ => { fail!() }
}
}
// except according to those terms.
-fn baz() -> ! { fail2!(); }
+fn baz() -> ! { fail!(); }
fn foo() {
match Some::<int>(5) {
Some::<int>(_x) => {
let mut bar;
match None::<int> { None::<int> => { bar = 5; } _ => { baz(); } }
- info2!("{:?}", bar);
+ info!("{:?}", bar);
}
- None::<int> => { info2!("hello"); }
+ None::<int> => { info!("hello"); }
}
}
fn nested(o: t) {
match o {
- bar(_i, Some::<int>(_)) => { error2!("wrong pattern matched"); fail2!(); }
- _ => { error2!("succeeded"); }
+ bar(_i, Some::<int>(_)) => { error!("wrong pattern matched"); fail!(); }
+ _ => { error!("succeeded"); }
}
}
pub fn main() {
match A {a: 10, b: @20} {
x@A {a, b: @20} => { assert!(x.a == 10); assert!(a == 10); }
- A {b: _b, _} => { fail2!(); }
+ A {b: _b, _} => { fail!(); }
}
let mut x@B {b, _} = B {a: 10, b: C {c: 20}};
x.b.c = 30;
pub fn main() {
let mut x: int = 1;
x *= 2;
- info2!("{}", x);
+ info!("{}", x);
assert_eq!(x, 2);
x += 3;
- info2!("{}", x);
+ info!("{}", x);
assert_eq!(x, 5);
x *= x;
- info2!("{}", x);
+ info!("{}", x);
assert_eq!(x, 25);
x /= 5;
- info2!("{}", x);
+ info!("{}", x);
assert_eq!(x, 5);
}
fn unwrap<T>(o: Option<T>) -> T {
match o {
Some(v) => v,
- None => fail2!()
+ None => fail!()
}
}
while b <= 32u {
0u << b;
b <<= 1u;
- info2!("{:?}", b);
+ info!("{:?}", b);
}
}
return pair.value.clone();
}
}
- fail2!("No value found for key: {:?}", index);
+ fail!("No value found for key: {:?}", index);
}
}
pub fn main() {
let x = true;
if x { let mut i = 10; while i > 0 { i -= 1; } }
- match x { true => { info2!("right"); } false => { info2!("wrong"); } }
+ match x { true => { info!("right"); } false => { info!("wrong"); } }
}
#[allow(unreachable_code)];
// -*- rust -*-
-fn dont_call_me() { fail2!(); info2!("{}", 1); }
+fn dont_call_me() { fail!(); info!("{}", 1); }
pub fn main() { }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn magic(x: A) { info2!("{:?}", x); }
-fn magic2(x: @int) { info2!("{:?}", x); }
+fn magic(x: A) { info!("{:?}", x); }
+fn magic2(x: @int) { info!("{:?}", x); }
struct A { a: @int }
fn something(f: &fn()) { f(); }
pub fn main() {
- something(|| error2!("hi!") );
+ something(|| error!("hi!") );
}
let x = @6;
let y = x.get();
- info2!("y={}", y);
+ info!("y={}", y);
assert_eq!(y, 6);
let x = ~6;
let y = x.get();
- info2!("y={}", y);
+ info!("y={}", y);
assert_eq!(y, 6);
let x = &6;
let y = x.get();
- info2!("y={}", y);
+ info!("y={}", y);
assert_eq!(y, 6);
}
pub fn main() {
let x = ~[1, 2, 3];
let y = call_sum(x);
- info2!("y=={}", y);
+ info!("y=={}", y);
assert_eq!(y, 6);
let x = ~[1, 2, 3];
let y = x.sum_();
- info2!("y=={}", y);
+ info!("y=={}", y);
assert_eq!(y, 6);
let x = ~[1, 2, 3];
let y = x.sum_();
- info2!("y=={}", y);
+ info!("y=={}", y);
assert_eq!(y, 6);
}
// Send it through the shape code
let y = format!("{:?}", x);
- info2!("align inner = {:?}", rusti::min_align_of::<Inner>());
- info2!("size outer = {:?}", mem::size_of::<Outer>());
- info2!("y = {}", y);
+ info!("align inner = {:?}", rusti::min_align_of::<Inner>());
+ info!("size outer = {:?}", mem::size_of::<Outer>());
+ info!("y = {}", y);
// per clang/gcc the alignment of `inner` is 4 on x86.
assert_eq!(rusti::min_align_of::<Inner>(), m::align());
// Send it through the shape code
let y = format!("{:?}", x);
- info2!("align inner = {}", rusti::min_align_of::<Inner>());
- info2!("size outer = {}", mem::size_of::<Outer>());
- info2!("y = {}", y);
+ info!("align inner = {}", rusti::min_align_of::<Inner>());
+ info!("size outer = {}", mem::size_of::<Outer>());
+ info!("y = {}", y);
// per clang/gcc the alignment of `Inner` is 4 on x86.
assert_eq!(rusti::min_align_of::<Inner>(), m::m::align());
pub fn main() {
let x = X {foo: ~"hello", bar: ~"world"};
- info2!("{}", x.foo.clone());
- info2!("{}", x.bar.clone());
+ info!("{}", x.foo.clone());
+ info!("{}", x.bar.clone());
}
_sz: uint, _align: uint) -> bool { true }
fn visit_rec_field(&mut self, _i: uint, _name: &str,
_mtbl: uint, inner: *TyDesc) -> bool {
- error2!("rec field!");
+ error!("rec field!");
self.visit_inner(inner)
}
fn visit_leave_rec(&mut self, _n_fields: uint,
fn visit_enter_tup(&mut self, _n_fields: uint,
_sz: uint, _align: uint) -> bool { true }
fn visit_tup_field(&mut self, _i: uint, inner: *TyDesc) -> bool {
- error2!("tup field!");
+ error!("tup field!");
self.visit_inner(inner)
}
fn visit_leave_tup(&mut self, _n_fields: uint,
vals: ~[]});
let mut v = ptr_visit_adaptor(Inner {inner: u});
let td = get_tydesc_for(r);
- error2!("tydesc sz: {}, align: {}",
+ error!("tydesc sz: {}, align: {}",
(*td).size, (*td).align);
visit_tydesc(td, &mut v as &mut TyVisitor);
for s in r.iter() {
println!("val: {}", *s);
}
- error2!("{:?}", u.vals.clone());
+ error!("{:?}", u.vals.clone());
assert_eq!(u.vals.clone(),
~[ ~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3", ~"12"]);
}
impl TyVisitor for MyVisitor {
fn visit_bot(&mut self) -> bool {
self.types.push(~"bot");
- error2!("visited bot type");
+ error!("visited bot type");
true
}
fn visit_nil(&mut self) -> bool {
self.types.push(~"nil");
- error2!("visited nil type");
+ error!("visited nil type");
true
}
fn visit_bool(&mut self) -> bool {
self.types.push(~"bool");
- error2!("visited bool type");
+ error!("visited bool type");
true
}
fn visit_int(&mut self) -> bool {
self.types.push(~"int");
- error2!("visited int type");
+ error!("visited int type");
true
}
fn visit_i8(&mut self) -> bool {
self.types.push(~"i8");
- error2!("visited i8 type");
+ error!("visited i8 type");
true
}
fn visit_i16(&mut self) -> bool {
self.types.push(~"i16");
- error2!("visited i16 type");
+ error!("visited i16 type");
true
}
fn visit_i32(&mut self) -> bool { true }
fn get_v6_a<'v>(a: &'v A, _i: uint) -> &'v int {
match a.value.v6 {
Some(ref v) => &v.f,
- None => fail2!()
+ None => fail!()
}
}
fn get_v6_b<'v>(a: &'v A, _i: uint) -> &'v int {
match *a {
A { value: B { v6: Some(ref v), _ } } => &v.f,
- _ => fail2!()
+ _ => fail!()
}
}
fn get_v6_c<'v>(a: &'v A, _i: uint) -> &'v int {
match a {
&A { value: B { v6: Some(ref v), _ } } => &v.f,
- _ => fail2!()
+ _ => fail!()
}
}
fn get<'r, T>(opt: &'r Option<T>) -> &'r T {
match *opt {
Some(ref v) => v,
- None => fail2!("none")
+ None => fail!("none")
}
}
pub fn main() {
let three = &3;
- error2!("{}", *f(three));
+ error!("{}", *f(three));
}
pub fn main() {
let p = @22u;
let r = foo(p);
- info2!("r={}", r);
+ info!("r={}", r);
assert_eq!(r, 22u);
}
// A very limited test of the "bottom" region
-fn produce_static<T>() -> &'static T { fail2!(); }
+fn produce_static<T>() -> &'static T { fail!(); }
fn foo<T>(_x: &T) -> &uint { produce_static() }
pub fn main() {
let clam = Clam { chowder: &3 };
- info2!("{:?}", *clam.get_chowder());
+ info!("{:?}", *clam.get_chowder());
clam.get_chowder();
}
match y {
int_wrapper_ctor(zz) => { z = zz; }
}
- info2!("{:?}", *z);
+ info!("{:?}", *z);
}
let mut x: int = 3;
let y: &mut int = &mut x;
*y = 5;
- info2!("{:?}", *y);
+ info!("{:?}", *y);
}
}
pub fn main() {
- let cl_box = box_it(|| info2!("Hello, world!"));
+ let cl_box = box_it(|| info!("Hello, world!"));
call_static_closure(cl_box);
}
let x = [ @[true], ..512 ];
let y = [ 0, ..1 ];
- error2!("{:?}", x);
- error2!("{:?}", y);
+ error!("{:?}", x);
+ error!("{:?}", y);
}
let a = r(i);
let b = (a, 10);
let (c, _d) = b;
- info2!("{:?}", c);
+ info!("{:?}", c);
}
assert_eq!(*i, 1);
}
impl Drop for r {
fn drop(&mut self) {
unsafe {
- info2!("r's dtor: self = {:x}, self.v = {:x}, self.v's value = {:x}",
+ info!("r's dtor: self = {:x}, self.v = {:x}, self.v's value = {:x}",
cast::transmute::<*mut r, uint>(self),
cast::transmute::<**int, uint>(&(self.v)),
cast::transmute::<*int, uint>(self.v));
next: None,
r: {
let rs = r(i1p);
- info2!("r = {:x}", cast::transmute::<*r, uint>(&rs));
+ info!("r = {:x}", cast::transmute::<*r, uint>(&rs));
rs }
});
- info2!("x1 = {:x}, x1.r = {:x}",
+ info!("x1 = {:x}, x1.r = {:x}",
cast::transmute::<@mut t, uint>(x1),
cast::transmute::<*r, uint>(&x1.r));
next: None,
r: {
let rs = r(i2p);
- info2!("r2 = {:x}", cast::transmute::<*r, uint>(&rs));
+ info!("r2 = {:x}", cast::transmute::<*r, uint>(&rs));
rs
}
});
- info2!("x2 = {:x}, x2.r = {:x}",
+ info!("x2 = {:x}, x2.r = {:x}",
cast::transmute::<@mut t, uint>(x2),
cast::transmute::<*r, uint>(&(x2.r)));
#[unsafe_destructor]
impl Drop for shrinky_pointer {
fn drop(&mut self) {
- error2!("Hello!"); **(self.i) -= 1;
+ error!("Hello!"); **(self.i) -= 1;
}
}
pub fn main() {
let my_total = @@mut 10;
{ let pt = shrinky_pointer(my_total); assert!((pt.look_at() == 10)); }
- error2!("my_total = {}", **my_total);
+ error!("my_total = {}", **my_total);
assert_eq!(**my_total, 9);
}
// -*- rust -*-
-fn my_err(s: ~str) -> ! { error2!("{:?}", s); fail2!(); }
+fn my_err(s: ~str) -> ! { error!("{:?}", s); fail!(); }
fn okay(i: uint) -> int {
if i == 3u { my_err(~"I don't like three"); } else { return 42; }
#[start]
fn start(argc: int, argv: **u8) -> int {
do std::rt::start_on_main_thread(argc, argv) {
- info2!("running on main thread");
+ info!("running on main thread");
do spawn {
- info2!("running on another thread");
+ info!("running on another thread");
}
}
}
fn test05_start(f: &~fn(v: f64, v: ~str) -> Pair<f64, ~str>) {
let p = (*f)(22.22, ~"Hi");
- info2!("{:?}", p.clone());
+ info!("{:?}", p.clone());
assert!(p.a == 22.22);
assert!(p.b == ~"Hi");
let q = (*f)(44.44, ~"Ho");
- info2!("{:?}", q.clone());
+ info!("{:?}", q.clone());
assert!(q.a == 44.44);
assert!(q.b == ~"Ho");
}
fn test05() {
let three = ~3;
let fn_to_send: ~fn(int) = |n| {
- error2!("{}", *three + n); // will copy x into the closure
+ error!("{}", *three + n); // will copy x into the closure
assert_eq!(*three, 3);
};
let fn_to_send = Cell::new(fn_to_send);
match none::<int> {
some::<int>(_) => {
for _i in c.iter() {
- info2!("{:?}", a);
+ info!("{:?}", a);
let a = 17;
b.push(a);
}
let p_: Path_ = Path_ { global: true, idents: ~[~"hi"], types: ~[t] };
let p: path = Spanned { data: p_, span: sp };
let x = X { sp: sp, path: p };
- error2!("{:?}", x.path.clone());
- error2!("{:?}", x.clone());
+ error!("{:?}", x.path.clone());
+ error!("{:?}", x.clone());
}
-pub fn main() { let mut n; n = 1; info2!("{}", n); }
+pub fn main() { let mut n; n = 1; info!("{}", n); }
pub fn main() {
let x = none::<int>;
- match x { none::<int> => { info2!("hello world"); } }
+ match x { none::<int> => { info!("hello world"); } }
}
fn uhoh<T>(v: ~[clam<T>]) {
match v[1] {
a::<T>(ref _t, ref u) => {
- info2!("incorrect");
- info2!("{:?}", u);
- fail2!();
+ info!("incorrect");
+ info!("{:?}", u);
+ fail!();
}
- b::<T> => { info2!("correct"); }
+ b::<T> => { info!("correct"); }
}
}
use std::task;
fn x(s: ~str, n: int) {
- info2!("{:?}", s);
- info2!("{:?}", n);
+ info!("{:?}", s);
+ info!("{:?}", n);
}
pub fn main() {
task::spawn(|| x(~"hello from second spawned fn", 66) );
task::spawn(|| x(~"hello from third spawned fn", 67) );
let mut i: int = 30;
- while i > 0 { i = i - 1; info2!("parent sleeping"); task::deschedule(); }
+ while i > 0 { i = i - 1; info!("parent sleeping"); task::deschedule(); }
}
task::spawn(|| child(10) );
}
-fn child(i: int) { error2!("{}", i); assert!((i == 10)); }
+fn child(i: int) { error!("{}", i); assert!((i == 10)); }
fn child(args: (int, int, int, int, int, int, int, int, int)) {
let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args;
- error2!("{}", i1);
- error2!("{}", i2);
- error2!("{}", i3);
- error2!("{}", i4);
- error2!("{}", i5);
- error2!("{}", i6);
- error2!("{}", i7);
- error2!("{}", i8);
- error2!("{}", i9);
+ error!("{}", i1);
+ error!("{}", i2);
+ error!("{}", i3);
+ error!("{}", i4);
+ error!("{}", i5);
+ error!("{}", i6);
+ error!("{}", i7);
+ error!("{}", i8);
+ error!("{}", i9);
assert_eq!(i1, 10);
assert_eq!(i2, 20);
assert_eq!(i3, 30);
{
match io::file_writer(&path, [io::Create, io::Truncate]) {
- Err(ref e) => fail2!("{}", e.clone()),
+ Err(ref e) => fail!("{}", e.clone()),
Ok(f) => {
for _ in range(0u, 1000) {
f.write_u8(0);
fn test1() {
let mut s: ~str = ~"hello";
s.push_str("world");
- info2!("{}", s.clone());
+ info!("{}", s.clone());
assert_eq!(s[9], 'd' as u8);
}
let ff: ~str = ~"abc";
let a: ~str = ff + "ABC" + ff;
let b: ~str = ~"ABC" + ff + "ABC";
- info2!("{}", a.clone());
- info2!("{}", b.clone());
+ info!("{}", a.clone());
+ info!("{}", b.clone());
assert_eq!(a, ~"abcABCabc");
assert_eq!(b, ~"ABCabcABC");
}
let a: ~str = ~"hello";
let b: ~str = ~"world";
let s: ~str = a + b;
- info2!("{}", s.clone());
+ info!("{}", s.clone());
assert_eq!(s[9], 'd' as u8);
}
pub fn main() {
let s = ~"hello";
let c: u8 = s[4];
- info2!("{:?}", c);
+ info!("{:?}", c);
assert_eq!(c, 0x6f as u8);
}
let mut i = 20;
let mut expected_len = 1u;
while i > 0 {
- error2!("{}", a.len());
+ error!("{}", a.len());
assert_eq!(a.len(), expected_len);
a = a + a; // FIXME(#3387)---can't write a += a
i -= 1;
impl Drop for foo {
fn drop(&mut self) {
- error2!("{}", self.x);
+ error!("{}", self.x);
}
}
c: 0xcccc_cccc_cccc_cccc_u64,
d: 0xdddd_dddd_dddd_dddd_u64 };
let qq = rustrt::rust_dbg_abi_1(q);
- error2!("a: {:x}", qq.a as uint);
- error2!("b: {:x}", qq.b as uint);
- error2!("c: {:x}", qq.c as uint);
- error2!("d: {:x}", qq.d as uint);
+ error!("a: {:x}", qq.a as uint);
+ error!("b: {:x}", qq.b as uint);
+ error!("c: {:x}", qq.c as uint);
+ error!("d: {:x}", qq.d as uint);
assert_eq!(qq.a, q.c + 1u64);
assert_eq!(qq.b, q.d - 1u64);
assert_eq!(qq.c, q.a + 1u64);
b: 0b_1010_1010_u8,
c: 1.0987654321e-15_f64 };
let ff = rustrt::rust_dbg_abi_2(f);
- error2!("a: {}", ff.a as f64);
- error2!("b: {}", ff.b as uint);
- error2!("c: {}", ff.c as f64);
+ error!("a: {}", ff.a as f64);
+ error!("b: {}", ff.b as uint);
+ error!("c: {}", ff.c as f64);
assert_eq!(ff.a, f.c + 1.0f64);
assert_eq!(ff.b, 0xff_u8);
assert_eq!(ff.c, f.a - 1.0f64);
pub fn main() {
let f = 1 as *libc::FILE;
- info2!("{}", f as int);
- info2!("{}", f as uint);
- info2!("{}", f as i8);
- info2!("{}", f as i16);
- info2!("{}", f as i32);
- info2!("{}", f as i64);
- info2!("{}", f as u8);
- info2!("{}", f as u16);
- info2!("{}", f as u32);
- info2!("{}", f as u64);
-
- info2!("{}", 1 as int);
- info2!("{}", 1 as uint);
- info2!("{}", 1 as *libc::FILE);
- info2!("{}", 1 as i8);
- info2!("{}", 1 as i16);
- info2!("{}", 1 as i32);
- info2!("{}", 1 as i64);
- info2!("{}", 1 as u8);
- info2!("{}", 1 as u16);
- info2!("{}", 1 as u32);
- info2!("{}", 1 as u64);
- info2!("{}", 1 as f32);
- info2!("{}", 1 as f64);
-
- info2!("{}", 1u as int);
- info2!("{}", 1u as uint);
- info2!("{}", 1u as *libc::FILE);
- info2!("{}", 1u as i8);
- info2!("{}", 1u as i16);
- info2!("{}", 1u as i32);
- info2!("{}", 1u as i64);
- info2!("{}", 1u as u8);
- info2!("{}", 1u as u16);
- info2!("{}", 1u as u32);
- info2!("{}", 1u as u64);
- info2!("{}", 1u as f32);
- info2!("{}", 1u as f64);
-
- info2!("{}", 1i8 as int);
- info2!("{}", 1i8 as uint);
- info2!("{}", 1i8 as *libc::FILE);
- info2!("{}", 1i8 as i8);
- info2!("{}", 1i8 as i16);
- info2!("{}", 1i8 as i32);
- info2!("{}", 1i8 as i64);
- info2!("{}", 1i8 as u8);
- info2!("{}", 1i8 as u16);
- info2!("{}", 1i8 as u32);
- info2!("{}", 1i8 as u64);
- info2!("{}", 1i8 as f32);
- info2!("{}", 1i8 as f64);
-
- info2!("{}", 1u8 as int);
- info2!("{}", 1u8 as uint);
- info2!("{}", 1u8 as *libc::FILE);
- info2!("{}", 1u8 as i8);
- info2!("{}", 1u8 as i16);
- info2!("{}", 1u8 as i32);
- info2!("{}", 1u8 as i64);
- info2!("{}", 1u8 as u8);
- info2!("{}", 1u8 as u16);
- info2!("{}", 1u8 as u32);
- info2!("{}", 1u8 as u64);
- info2!("{}", 1u8 as f32);
- info2!("{}", 1u8 as f64);
-
- info2!("{}", 1i16 as int);
- info2!("{}", 1i16 as uint);
- info2!("{}", 1i16 as *libc::FILE);
- info2!("{}", 1i16 as i8);
- info2!("{}", 1i16 as i16);
- info2!("{}", 1i16 as i32);
- info2!("{}", 1i16 as i64);
- info2!("{}", 1i16 as u8);
- info2!("{}", 1i16 as u16);
- info2!("{}", 1i16 as u32);
- info2!("{}", 1i16 as u64);
- info2!("{}", 1i16 as f32);
- info2!("{}", 1i16 as f64);
-
- info2!("{}", 1u16 as int);
- info2!("{}", 1u16 as uint);
- info2!("{}", 1u16 as *libc::FILE);
- info2!("{}", 1u16 as i8);
- info2!("{}", 1u16 as i16);
- info2!("{}", 1u16 as i32);
- info2!("{}", 1u16 as i64);
- info2!("{}", 1u16 as u8);
- info2!("{}", 1u16 as u16);
- info2!("{}", 1u16 as u32);
- info2!("{}", 1u16 as u64);
- info2!("{}", 1u16 as f32);
- info2!("{}", 1u16 as f64);
-
- info2!("{}", 1i32 as int);
- info2!("{}", 1i32 as uint);
- info2!("{}", 1i32 as *libc::FILE);
- info2!("{}", 1i32 as i8);
- info2!("{}", 1i32 as i16);
- info2!("{}", 1i32 as i32);
- info2!("{}", 1i32 as i64);
- info2!("{}", 1i32 as u8);
- info2!("{}", 1i32 as u16);
- info2!("{}", 1i32 as u32);
- info2!("{}", 1i32 as u64);
- info2!("{}", 1i32 as f32);
- info2!("{}", 1i32 as f64);
-
- info2!("{}", 1u32 as int);
- info2!("{}", 1u32 as uint);
- info2!("{}", 1u32 as *libc::FILE);
- info2!("{}", 1u32 as i8);
- info2!("{}", 1u32 as i16);
- info2!("{}", 1u32 as i32);
- info2!("{}", 1u32 as i64);
- info2!("{}", 1u32 as u8);
- info2!("{}", 1u32 as u16);
- info2!("{}", 1u32 as u32);
- info2!("{}", 1u32 as u64);
- info2!("{}", 1u32 as f32);
- info2!("{}", 1u32 as f64);
-
- info2!("{}", 1i64 as int);
- info2!("{}", 1i64 as uint);
- info2!("{}", 1i64 as *libc::FILE);
- info2!("{}", 1i64 as i8);
- info2!("{}", 1i64 as i16);
- info2!("{}", 1i64 as i32);
- info2!("{}", 1i64 as i64);
- info2!("{}", 1i64 as u8);
- info2!("{}", 1i64 as u16);
- info2!("{}", 1i64 as u32);
- info2!("{}", 1i64 as u64);
- info2!("{}", 1i64 as f32);
- info2!("{}", 1i64 as f64);
-
- info2!("{}", 1u64 as int);
- info2!("{}", 1u64 as uint);
- info2!("{}", 1u64 as *libc::FILE);
- info2!("{}", 1u64 as i8);
- info2!("{}", 1u64 as i16);
- info2!("{}", 1u64 as i32);
- info2!("{}", 1u64 as i64);
- info2!("{}", 1u64 as u8);
- info2!("{}", 1u64 as u16);
- info2!("{}", 1u64 as u32);
- info2!("{}", 1u64 as u64);
- info2!("{}", 1u64 as f32);
- info2!("{}", 1u64 as f64);
-
- info2!("{}", 1u64 as int);
- info2!("{}", 1u64 as uint);
- info2!("{}", 1u64 as *libc::FILE);
- info2!("{}", 1u64 as i8);
- info2!("{}", 1u64 as i16);
- info2!("{}", 1u64 as i32);
- info2!("{}", 1u64 as i64);
- info2!("{}", 1u64 as u8);
- info2!("{}", 1u64 as u16);
- info2!("{}", 1u64 as u32);
- info2!("{}", 1u64 as u64);
- info2!("{}", 1u64 as f32);
- info2!("{}", 1u64 as f64);
-
- info2!("{}", true as int);
- info2!("{}", true as uint);
- info2!("{}", true as *libc::FILE);
- info2!("{}", true as i8);
- info2!("{}", true as i16);
- info2!("{}", true as i32);
- info2!("{}", true as i64);
- info2!("{}", true as u8);
- info2!("{}", true as u16);
- info2!("{}", true as u32);
- info2!("{}", true as u64);
- info2!("{}", true as f32);
- info2!("{}", true as f64);
-
- info2!("{}", 1. as int);
- info2!("{}", 1. as uint);
- info2!("{}", 1. as i8);
- info2!("{}", 1. as i16);
- info2!("{}", 1. as i32);
- info2!("{}", 1. as i64);
- info2!("{}", 1. as u8);
- info2!("{}", 1. as u16);
- info2!("{}", 1. as u32);
- info2!("{}", 1. as u64);
- info2!("{}", 1. as f32);
- info2!("{}", 1. as f64);
-
- info2!("{}", 1f32 as int);
- info2!("{}", 1f32 as uint);
- info2!("{}", 1f32 as i8);
- info2!("{}", 1f32 as i16);
- info2!("{}", 1f32 as i32);
- info2!("{}", 1f32 as i64);
- info2!("{}", 1f32 as u8);
- info2!("{}", 1f32 as u16);
- info2!("{}", 1f32 as u32);
- info2!("{}", 1f32 as u64);
- info2!("{}", 1f32 as f32);
- info2!("{}", 1f32 as f64);
-
- info2!("{}", 1f64 as int);
- info2!("{}", 1f64 as uint);
- info2!("{}", 1f64 as i8);
- info2!("{}", 1f64 as i16);
- info2!("{}", 1f64 as i32);
- info2!("{}", 1f64 as i64);
- info2!("{}", 1f64 as u8);
- info2!("{}", 1f64 as u16);
- info2!("{}", 1f64 as u32);
- info2!("{}", 1f64 as u64);
- info2!("{}", 1f64 as f32);
- info2!("{}", 1f64 as f64);
+ info!("{}", f as int);
+ info!("{}", f as uint);
+ info!("{}", f as i8);
+ info!("{}", f as i16);
+ info!("{}", f as i32);
+ info!("{}", f as i64);
+ info!("{}", f as u8);
+ info!("{}", f as u16);
+ info!("{}", f as u32);
+ info!("{}", f as u64);
+
+ info!("{}", 1 as int);
+ info!("{}", 1 as uint);
+ info!("{}", 1 as *libc::FILE);
+ info!("{}", 1 as i8);
+ info!("{}", 1 as i16);
+ info!("{}", 1 as i32);
+ info!("{}", 1 as i64);
+ info!("{}", 1 as u8);
+ info!("{}", 1 as u16);
+ info!("{}", 1 as u32);
+ info!("{}", 1 as u64);
+ info!("{}", 1 as f32);
+ info!("{}", 1 as f64);
+
+ info!("{}", 1u as int);
+ info!("{}", 1u as uint);
+ info!("{}", 1u as *libc::FILE);
+ info!("{}", 1u as i8);
+ info!("{}", 1u as i16);
+ info!("{}", 1u as i32);
+ info!("{}", 1u as i64);
+ info!("{}", 1u as u8);
+ info!("{}", 1u as u16);
+ info!("{}", 1u as u32);
+ info!("{}", 1u as u64);
+ info!("{}", 1u as f32);
+ info!("{}", 1u as f64);
+
+ info!("{}", 1i8 as int);
+ info!("{}", 1i8 as uint);
+ info!("{}", 1i8 as *libc::FILE);
+ info!("{}", 1i8 as i8);
+ info!("{}", 1i8 as i16);
+ info!("{}", 1i8 as i32);
+ info!("{}", 1i8 as i64);
+ info!("{}", 1i8 as u8);
+ info!("{}", 1i8 as u16);
+ info!("{}", 1i8 as u32);
+ info!("{}", 1i8 as u64);
+ info!("{}", 1i8 as f32);
+ info!("{}", 1i8 as f64);
+
+ info!("{}", 1u8 as int);
+ info!("{}", 1u8 as uint);
+ info!("{}", 1u8 as *libc::FILE);
+ info!("{}", 1u8 as i8);
+ info!("{}", 1u8 as i16);
+ info!("{}", 1u8 as i32);
+ info!("{}", 1u8 as i64);
+ info!("{}", 1u8 as u8);
+ info!("{}", 1u8 as u16);
+ info!("{}", 1u8 as u32);
+ info!("{}", 1u8 as u64);
+ info!("{}", 1u8 as f32);
+ info!("{}", 1u8 as f64);
+
+ info!("{}", 1i16 as int);
+ info!("{}", 1i16 as uint);
+ info!("{}", 1i16 as *libc::FILE);
+ info!("{}", 1i16 as i8);
+ info!("{}", 1i16 as i16);
+ info!("{}", 1i16 as i32);
+ info!("{}", 1i16 as i64);
+ info!("{}", 1i16 as u8);
+ info!("{}", 1i16 as u16);
+ info!("{}", 1i16 as u32);
+ info!("{}", 1i16 as u64);
+ info!("{}", 1i16 as f32);
+ info!("{}", 1i16 as f64);
+
+ info!("{}", 1u16 as int);
+ info!("{}", 1u16 as uint);
+ info!("{}", 1u16 as *libc::FILE);
+ info!("{}", 1u16 as i8);
+ info!("{}", 1u16 as i16);
+ info!("{}", 1u16 as i32);
+ info!("{}", 1u16 as i64);
+ info!("{}", 1u16 as u8);
+ info!("{}", 1u16 as u16);
+ info!("{}", 1u16 as u32);
+ info!("{}", 1u16 as u64);
+ info!("{}", 1u16 as f32);
+ info!("{}", 1u16 as f64);
+
+ info!("{}", 1i32 as int);
+ info!("{}", 1i32 as uint);
+ info!("{}", 1i32 as *libc::FILE);
+ info!("{}", 1i32 as i8);
+ info!("{}", 1i32 as i16);
+ info!("{}", 1i32 as i32);
+ info!("{}", 1i32 as i64);
+ info!("{}", 1i32 as u8);
+ info!("{}", 1i32 as u16);
+ info!("{}", 1i32 as u32);
+ info!("{}", 1i32 as u64);
+ info!("{}", 1i32 as f32);
+ info!("{}", 1i32 as f64);
+
+ info!("{}", 1u32 as int);
+ info!("{}", 1u32 as uint);
+ info!("{}", 1u32 as *libc::FILE);
+ info!("{}", 1u32 as i8);
+ info!("{}", 1u32 as i16);
+ info!("{}", 1u32 as i32);
+ info!("{}", 1u32 as i64);
+ info!("{}", 1u32 as u8);
+ info!("{}", 1u32 as u16);
+ info!("{}", 1u32 as u32);
+ info!("{}", 1u32 as u64);
+ info!("{}", 1u32 as f32);
+ info!("{}", 1u32 as f64);
+
+ info!("{}", 1i64 as int);
+ info!("{}", 1i64 as uint);
+ info!("{}", 1i64 as *libc::FILE);
+ info!("{}", 1i64 as i8);
+ info!("{}", 1i64 as i16);
+ info!("{}", 1i64 as i32);
+ info!("{}", 1i64 as i64);
+ info!("{}", 1i64 as u8);
+ info!("{}", 1i64 as u16);
+ info!("{}", 1i64 as u32);
+ info!("{}", 1i64 as u64);
+ info!("{}", 1i64 as f32);
+ info!("{}", 1i64 as f64);
+
+ info!("{}", 1u64 as int);
+ info!("{}", 1u64 as uint);
+ info!("{}", 1u64 as *libc::FILE);
+ info!("{}", 1u64 as i8);
+ info!("{}", 1u64 as i16);
+ info!("{}", 1u64 as i32);
+ info!("{}", 1u64 as i64);
+ info!("{}", 1u64 as u8);
+ info!("{}", 1u64 as u16);
+ info!("{}", 1u64 as u32);
+ info!("{}", 1u64 as u64);
+ info!("{}", 1u64 as f32);
+ info!("{}", 1u64 as f64);
+
+ info!("{}", 1u64 as int);
+ info!("{}", 1u64 as uint);
+ info!("{}", 1u64 as *libc::FILE);
+ info!("{}", 1u64 as i8);
+ info!("{}", 1u64 as i16);
+ info!("{}", 1u64 as i32);
+ info!("{}", 1u64 as i64);
+ info!("{}", 1u64 as u8);
+ info!("{}", 1u64 as u16);
+ info!("{}", 1u64 as u32);
+ info!("{}", 1u64 as u64);
+ info!("{}", 1u64 as f32);
+ info!("{}", 1u64 as f64);
+
+ info!("{}", true as int);
+ info!("{}", true as uint);
+ info!("{}", true as *libc::FILE);
+ info!("{}", true as i8);
+ info!("{}", true as i16);
+ info!("{}", true as i32);
+ info!("{}", true as i64);
+ info!("{}", true as u8);
+ info!("{}", true as u16);
+ info!("{}", true as u32);
+ info!("{}", true as u64);
+ info!("{}", true as f32);
+ info!("{}", true as f64);
+
+ info!("{}", 1. as int);
+ info!("{}", 1. as uint);
+ info!("{}", 1. as i8);
+ info!("{}", 1. as i16);
+ info!("{}", 1. as i32);
+ info!("{}", 1. as i64);
+ info!("{}", 1. as u8);
+ info!("{}", 1. as u16);
+ info!("{}", 1. as u32);
+ info!("{}", 1. as u64);
+ info!("{}", 1. as f32);
+ info!("{}", 1. as f64);
+
+ info!("{}", 1f32 as int);
+ info!("{}", 1f32 as uint);
+ info!("{}", 1f32 as i8);
+ info!("{}", 1f32 as i16);
+ info!("{}", 1f32 as i32);
+ info!("{}", 1f32 as i64);
+ info!("{}", 1f32 as u8);
+ info!("{}", 1f32 as u16);
+ info!("{}", 1f32 as u32);
+ info!("{}", 1f32 as u64);
+ info!("{}", 1f32 as f32);
+ info!("{}", 1f32 as f64);
+
+ info!("{}", 1f64 as int);
+ info!("{}", 1f64 as uint);
+ info!("{}", 1f64 as i8);
+ info!("{}", 1f64 as i16);
+ info!("{}", 1f64 as i32);
+ info!("{}", 1f64 as i64);
+ info!("{}", 1f64 as u8);
+ info!("{}", 1f64 as u16);
+ info!("{}", 1f64 as u32);
+ info!("{}", 1f64 as u64);
+ info!("{}", 1f64 as f32);
+ info!("{}", 1f64 as f64);
}
fn main() {
// check
- if ! cfg!(foo) { fail2!() }
- if cfg!(not(foo)) { fail2!() }
+ if ! cfg!(foo) { fail!() }
+ if cfg!(not(foo)) { fail!() }
- if ! cfg!(bar(baz)) { fail2!() }
- if cfg!(not(bar(baz))) { fail2!() }
+ if ! cfg!(bar(baz)) { fail!() }
+ if cfg!(not(bar(baz))) { fail!() }
- if ! cfg!(qux="foo") { fail2!() }
- if cfg!(not(qux="foo")) { fail2!() }
+ if ! cfg!(qux="foo") { fail!() }
+ if cfg!(not(qux="foo")) { fail!() }
- if ! cfg!(foo, bar(baz), qux="foo") { fail2!() }
- if cfg!(not(foo, bar(baz), qux="foo")) { fail2!() }
+ if ! cfg!(foo, bar(baz), qux="foo") { fail!() }
+ if cfg!(not(foo, bar(baz), qux="foo")) { fail!() }
- if cfg!(not_a_cfg) { fail2!() }
- if cfg!(not_a_cfg, foo, bar(baz), qux="foo") { fail2!() }
+ if cfg!(not_a_cfg) { fail!() }
+ if cfg!(not_a_cfg, foo, bar(baz), qux="foo") { fail!() }
- if ! cfg!(not(not_a_cfg)) { fail2!() }
- if ! cfg!(not(not_a_cfg), foo, bar(baz), qux="foo") { fail2!() }
+ if ! cfg!(not(not_a_cfg)) { fail!() }
+ if ! cfg!(not(not_a_cfg), foo, bar(baz), qux="foo") { fail!() }
- if cfg!(trailing_comma, ) { fail2!() }
+ if cfg!(trailing_comma, ) { fail!() }
}
pub fn main() {
let x = t_rec {c8: 22u8, t: a_tag(44u64)};
let y = format!("{:?}", x);
- info2!("y = {}", y);
+ info!("y = {}", y);
assert_eq!(y, ~"t_rec{c8: 22u8, t: a_tag(44u64)}");
}
pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
fn evenk(n: int, k: extern fn(bool) -> bool) -> bool {
- info2!("evenk");
- info2!("{:?}", n);
+ info!("evenk");
+ info!("{:?}", n);
if n == 0 { return k(true); } else { return oddk(n - 1, k); }
}
fn oddk(n: int, k: extern fn(bool) -> bool) -> bool {
- info2!("oddk");
- info2!("{:?}", n);
+ info!("oddk");
+ info!("{:?}", n);
if n == 0 { return k(false); } else { return evenk(n - 1, k); }
}
fn test05_start(ch : &Chan<int>) {
ch.send(10);
- error2!("sent 10");
+ error!("sent 10");
ch.send(20);
- error2!("sent 20");
+ error!("sent 20");
ch.send(30);
- error2!("sent 30");
+ error!("sent 30");
}
fn test05() {
let (po, ch) = comm::stream();
task::spawn(|| test05_start(&ch) );
let mut value: int = po.recv();
- error2!("{}", value);
+ error!("{}", value);
value = po.recv();
- error2!("{}", value);
+ error!("{}", value);
value = po.recv();
- error2!("{}", value);
+ error!("{}", value);
assert_eq!(value, 30);
}
pub fn main() { test00(); }
-fn start() { info2!("Started / Finished task."); }
+fn start() { info!("Started / Finished task."); }
fn test00() {
task::try(|| start() );
- info2!("Completing.");
+ info!("Completing.");
}
let mut b;
a = p.recv();
assert!(a == ~"A");
- error2!("{:?}", a);
+ error!("{:?}", a);
b = p.recv();
assert!(b == ~"B");
- error2!("{:?}", b);
+ error!("{:?}", b);
}
pub fn main() {
pub fn main() { test00(); }
-fn start(_task_number: int) { info2!("Started / Finished task."); }
+fn start(_task_number: int) { info!("Started / Finished task."); }
fn test00() {
let i: int = 0;
// Try joining tasks that have already finished.
result.recv();
- info2!("Joined task.");
+ info!("Joined task.");
}
}
pub fn main() {
- info2!("Check that we don't deadlock.");
+ info!("Check that we don't deadlock.");
let (_p, ch) = comm::stream();
task::try(|| start(&ch, 0, 10) );
- info2!("Joined task");
+ info!("Joined task");
}
// Spawn 10 tasks each sending us back one int.
let mut i = 10;
while (i > 0) {
- info2!("{}", i);
+ info!("{}", i);
let ch = ch.clone();
task::spawn({let i = i; || child(i, &ch)});
i = i - 1;
i = 10;
while (i > 0) {
- info2!("{}", i);
+ info!("{}", i);
po.recv();
i = i - 1;
}
- info2!("main thread exiting");
+ info!("main thread exiting");
}
fn child(x: int, ch: &comm::SharedChan<int>) {
- info2!("{}", x);
+ info!("{}", x);
ch.send(x);
}
use std::comm;
use std::task;
-pub fn main() { info2!("===== WITHOUT THREADS ====="); test00(); }
+pub fn main() { info!("===== WITHOUT THREADS ====="); test00(); }
fn test00_start(ch: &SharedChan<int>, message: int, count: int) {
- info2!("Starting test00_start");
+ info!("Starting test00_start");
let mut i: int = 0;
while i < count {
- info2!("Sending Message");
+ info!("Sending Message");
ch.send(message + 0);
i = i + 1;
}
- info2!("Ending test00_start");
+ info!("Ending test00_start");
}
fn test00() {
let number_of_tasks: int = 16;
let number_of_messages: int = 4;
- info2!("Creating tasks");
+ info!("Creating tasks");
let (po, ch) = comm::stream();
let ch = comm::SharedChan::new(ch);
// Join spawned tasks...
for r in results.iter() { r.recv(); }
- info2!("Completed: Final number is: ");
- error2!("{:?}", sum);
+ info!("Completed: Final number is: ");
+ error!("{:?}", sum);
// assert (sum == (((number_of_tasks * (number_of_tasks - 1)) / 2) *
// number_of_messages));
assert_eq!(sum, 480);
c.send(4);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
c.send(5);
c.send(6);
c.send(7);
c.send(8);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
r = p.recv();
sum += r;
- info2!("{}", r);
+ info!("{}", r);
assert_eq!(sum, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8);
}
let mut i: int = 0;
while i < number_of_messages {
sum += p.recv();
- info2!("{:?}", r);
+ info!("{:?}", r);
i += 1;
}
let f: ~fn() = || {
let tmp = TempDir::new("test_rm_tempdir").unwrap();
wr.send(tmp.path().clone());
- fail2!("fail to unwind past `tmp`");
+ fail!("fail to unwind past `tmp`");
};
task::try(f);
let path = rd.recv();
let cell = Cell::new(tmp);
let f: ~fn() = || {
let _tmp = cell.take();
- fail2!("fail to unwind past `tmp`");
+ fail!("fail to unwind past `tmp`");
};
task::try(f);
assert!(!os::path_exists(&path));
fn recursive_mkdir_rel() {
let path = Path::new("frob");
let cwd = os::getcwd();
- debug2!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.display(),
+ debug!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.display(),
cwd.display(), os::path_exists(&path));
assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
assert!(os::path_is_dir(&path));
fn recursive_mkdir_rel_2() {
let path = Path::new("./frob/baz");
let cwd = os::getcwd();
- debug2!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.display(),
+ debug!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.display(),
cwd.display(), os::path_exists(&path));
assert!(os::mkdir_recursive(&path, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
assert!(os::path_is_dir(&path));
assert!(os::path_is_dir(&path.dir_path()));
let path2 = Path::new("quux/blat");
- debug2!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.display(),
+ debug!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.display(),
cwd.display());
assert!(os::mkdir_recursive(&path2, (S_IRUSR | S_IWUSR | S_IXUSR) as i32));
assert!(os::path_is_dir(&path2));
let tmpdir = tmpdir.path();
let root = tmpdir.join("foo");
- debug2!("making {}", root.display());
+ debug!("making {}", root.display());
assert!(os::make_dir(&root, rwx));
assert!(os::make_dir(&root.join("foo"), rwx));
assert!(os::make_dir(&root.join("foo").join("bar"), rwx));
fn test_ret() { let _x: @int = return; }
fn test_fail() {
- fn f() { let _x: @int = fail2!(); }
+ fn f() { let _x: @int = fail!(); }
task::try(|| f() );
}
fn test_fail_indirect() {
- fn f() -> ! { fail2!(); }
+ fn f() -> ! { fail!(); }
fn g() { let _x: @int = f(); }
task::try(|| g() );
}
// Building as a test runner means that a synthetic main will be run,
// not ours
-pub fn main() { fail2!(); }
+pub fn main() { fail!(); }
pub fn main() {
let mut i = 10;
while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; }
- info2!("main thread exiting");
+ info!("main thread exiting");
}
-fn child(x: int) { info2!("{}", x); }
+fn child(x: int) { info!("{}", x); }
let (po, ch) = comm::stream();
ch.send(42);
let r = po.recv();
- error2!("{:?}", r);
+ error!("{:?}", r);
}
match (a, b) {
(A(x), A(y)) => A($e),
(B(x), B(y)) => B($e),
- _ => fail2!()
+ _ => fail!()
}
}
)
assert!(!Equal::isEq(branch(@leaf(magenta), @leaf(cyan)),
branch(@leaf(magenta), @leaf(magenta))));
- error2!("Assertions all succeeded!");
+ error!("Assertions all succeeded!");
}
assert!(!branch(@leaf(magenta), @leaf(cyan))
.isEq(branch(@leaf(magenta), @leaf(magenta))));
- error2!("Assertions all succeeded!");
+ error!("Assertions all succeeded!");
}
pub fn main() {
let a = 1;
let a_neg: i8 = -a;
- error2!("{}", a_neg);
+ error!("{}", a_neg);
let b = 1;
let b_neg: i16 = -b;
- error2!("{}", b_neg);
+ error!("{}", b_neg);
let c = 1;
let c_neg: i32 = -c;
- error2!("{}", c_neg);
+ error!("{}", c_neg);
let d = 1;
let d_neg: i64 = -d;
- error2!("{}", d_neg);
+ error!("{}", d_neg);
let e = 1;
let e_neg: int = -e;
- error2!("{}", e_neg);
+ error!("{}", e_neg);
// intentional overflows
let f = 1;
let f_neg: u8 = -f;
- error2!("{}", f_neg);
+ error!("{}", f_neg);
let g = 1;
let g_neg: u16 = -g;
- error2!("{}", g_neg);
+ error!("{}", g_neg);
let h = 1;
let h_neg: u32 = -h;
- error2!("{}", h_neg);
+ error!("{}", h_neg);
let i = 1;
let i_neg: u64 = -i;
- error2!("{}", i_neg);
+ error!("{}", i_neg);
let j = 1;
let j_neg: uint = -j;
- error2!("{}", j_neg);
+ error!("{}", j_neg);
}
let rc1 = managed::refcount(*i);
let j = i.clone();
let rc2 = managed::refcount(*i);
- error2!("rc1: {} rc2: {}", rc1, rc2);
+ error!("rc1: {} rc2: {}", rc1, rc2);
assert_eq!(rc1 + 1u, rc2);
}
}
fn f(_i: ~int) -> ~int {
- fail2!();
+ fail!();
}
let x = u(~10);
assert!(match x {
u(a) => {
- error2!("{:?}", a);
+ error!("{:?}", a);
*a
}
_ => { 66 }
pub fn main() {
let i = ~100;
- error2!("{:?}", i);
+ error!("{:?}", i);
}
pub fn main() {
assert!(match u(~10) {
u(a) => {
- error2!("{:?}", a);
+ error!("{:?}", a);
*a
}
_ => { 66 }
fn simple() {
match ~true {
~true => { }
- _ => { fail2!(); }
+ _ => { fail!(); }
}
}
impl Drop for Foo {
fn drop(&mut self) {
- fail2!("This failure should happen.");
+ fail!("This failure should happen.");
}
}
fn id(x: bool) -> bool { x }
fn call_id() {
- let c = fail2!();
+ let c = fail!();
id(c); //~ WARNING unreachable statement
}
fn id(x: bool) -> bool { x }
fn call_id() {
- let c = fail2!();
+ let c = fail!();
id(c);
}
fn f() {
let _a = @0;
- fail2!();
+ fail!();
}
pub fn main() {
impl Drop for complainer {
fn drop(&mut self) {
- error2!("About to send!");
+ error!("About to send!");
self.c.send(true);
- error2!("Sent!");
+ error!("Sent!");
}
}
fn complainer(c: SharedChan<bool>) -> complainer {
- error2!("Hello!");
+ error!("Hello!");
complainer {
c: c
}
fn f(c: SharedChan<bool>) {
let _c = complainer(c);
- fail2!();
+ fail!();
}
pub fn main() {
let (p, c) = stream();
let c = SharedChan::new(c);
task::spawn_unlinked(|| f(c.clone()) );
- error2!("hiiiiiiiii");
+ error!("hiiiiiiiii");
assert!(p.recv());
}
fn f() {
let _c = complainer(@0);
- fail2!();
+ fail!();
}
pub fn main() {
fn f() {
let _a = ~0;
- fail2!();
+ fail!();
}
pub fn main() {
enum myoption<T> { none, some(T), }
-pub fn main() { info2!("{}", 5); }
+pub fn main() { info!("{}", 5); }
fn foo<T>(o: myoption<T>) -> int {
let mut x: int;
match o {
- none::<T> => { fail2!(); }
+ none::<T> => { fail!(); }
some::<T>(_t) => { x = 5; }
}
return x;
enum myoption<T> { none, some(T), }
-pub fn main() { info2!("{}", 5); }
+pub fn main() { info!("{}", 5); }
fn check_str_eq(a: ~str, b: ~str) {
let mut i: int = 0;
for ab in a.byte_iter() {
- info2!("{}", i);
- info2!("{}", ab);
+ info!("{}", i);
+ info!("{}", ab);
let bb: u8 = b[i];
- info2!("{}", bb);
+ info!("{}", bb);
assert_eq!(ab, bb);
i += 1;
}
let a: ~[int] = ~[1, 2, 3, 4, 5];
let b: ~[int] = ~[6, 7, 8, 9, 0];
let v: ~[int] = a + b;
- info2!("{}", v[9]);
+ info!("{}", v[9]);
assert_eq!(v[0], 1);
assert_eq!(v[7], 8);
assert_eq!(v[9], 0);
pub fn main() {
let mut later: ~[int];
if true { later = ~[1]; } else { later = ~[2]; }
- info2!("{}", later[0]);
+ info!("{}", later[0]);
}
pub fn main() {
let x = @[1, 2, 3];
match x {
- [2, .._] => fail2!(),
+ [2, .._] => fail!(),
[1, ..tail] => {
assert_eq!(tail, [2, 3]);
}
- [_] => fail2!(),
- [] => fail2!()
+ [_] => fail!(),
+ [] => fail!()
}
let y = (~[(1, true), (2, false)], 0.5);
match y {
- ([_, _, _], 0.5) => fail2!(),
+ ([_, _, _], 0.5) => fail!(),
([(1, a), (b, false), ..tail], _) => {
assert_eq!(a, true);
assert_eq!(b, 2);
assert!(tail.is_empty());
}
- ([.._tail], _) => fail2!()
+ ([.._tail], _) => fail!()
}
}
fn a() {
let x = ~[1];
match x {
- [_, _, _, _, _, .._] => fail2!(),
- [.._, _, _, _, _] => fail2!(),
- [_, .._, _, _] => fail2!(),
- [_, _] => fail2!(),
+ [_, _, _, _, _, .._] => fail!(),
+ [.._, _, _, _, _] => fail!(),
+ [_, .._, _, _] => fail!(),
+ [_, _] => fail!(),
[a] => {
assert_eq!(a, 1);
}
- [] => fail2!()
+ [] => fail!()
}
}
assert_eq!(b, 2);
assert_eq!(c, &[3]);
}
- _ => fail2!()
+ _ => fail!()
}
match x {
[..a, b, c] => {
assert_eq!(b, 2);
assert_eq!(c, 3);
}
- _ => fail2!()
+ _ => fail!()
}
match x {
[a, ..b, c] => {
assert_eq!(b, &[2]);
assert_eq!(c, 3);
}
- _ => fail2!()
+ _ => fail!()
}
match x {
[a, b, c] => {
assert_eq!(b, 2);
assert_eq!(c, 3);
}
- _ => fail2!()
+ _ => fail!()
}
}
fn c() {
let x = [1];
match x {
- [2, .. _] => fail2!(),
+ [2, .. _] => fail!(),
[.. _] => ()
}
}
let mut i = 20;
let mut expected_len = 1u;
while i > 0 {
- error2!("{}", a.len());
+ error!("{}", a.len());
assert_eq!(a.len(), expected_len);
a = a + a; // FIXME(#3387)---can't write a += a
i -= 1;
fn p() -> bool { true }
let _a = (assert!((true)) == (assert!(p())));
let _c = (assert!((p())) == ());
- let _b: bool = (info2!("{}", 0) == (return 0u));
+ let _b: bool = (info!("{}", 0) == (return 0u));
}
fn angrydome() {
loop { if break { } }
let mut i = 0;
- loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => fail2!("wat") } }
+ loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => fail!("wat") } }
break; }
}
-fn evil_lincoln() { let _evil = info2!("lincoln"); }
+fn evil_lincoln() { let _evil = info!("lincoln"); }
pub fn main() {
strange();
let mut i = 1;
while i > 0 {
assert!((i > 0));
- info2!("{}", i);
+ info!("{}", i);
i -= 1;
continue;
}
while z < 50 {
z += 1;
while false { x = y; y = z; }
- info2!("{}", y);
+ info!("{}", y);
}
assert!((y == 42 && z == 50));
}
pub fn main() {
let mut i: int = 90;
while i < 100 {
- info2!("{}", i);
+ info!("{}", i);
i = i + 1;
if i == 95 {
let _v: ~[int] =
~[1, 2, 3, 4, 5]; // we check that it is freed by break
- info2!("breaking");
+ info!("breaking");
break;
}
}
pub fn main() {
let mut x: int = 10;
let mut y: int = 0;
- while y < x { info2!("{}", y); info2!("hello"); y = y + 1; }
+ while y < x { info!("{}", y); info!("hello"); y = y + 1; }
while x > 0 {
- info2!("goodbye");
+ info!("goodbye");
x = x - 1;
- info2!("{}", x);
+ info!("{}", x);
}
}
Some(ref z) if z.with(|b| *b) => {
do z.with |b| { assert!(*b); }
},
- _ => fail2!()
+ _ => fail!()
}
}
}
let mut builder = task::task();
let result = builder.future_result();
builder.spawn(child);
- error2!("1");
+ error!("1");
task::deschedule();
- error2!("2");
+ error!("2");
task::deschedule();
- error2!("3");
+ error!("3");
result.recv();
}
fn child() {
- error2!("4"); task::deschedule(); error2!("5"); task::deschedule(); error2!("6");
+ error!("4"); task::deschedule(); error!("5"); task::deschedule(); error!("6");
}
let mut builder = task::task();
let result = builder.future_result();
builder.spawn(child);
- error2!("1");
+ error!("1");
task::deschedule();
result.recv();
}
-fn child() { error2!("2"); }
+fn child() { error!("2"); }
pub fn main() {
let mut i: int = 0;
- while i < 100 { i = i + 1; error2!("{}", i); task::deschedule(); }
+ while i < 100 { i = i + 1; error!("{}", i); task::deschedule(); }
}