let source = ~"#[cfg(shut_up_and_leave_me_alone)]fn a() { }";
do from_str(source) |srv| {
do exec(srv) |ctxt| {
- assert!(ctxt.ast.node.module.items.is_empty());
+ // one item: the __std_macros secret module
+ assert_eq!(ctxt.ast.node.module.items.len(), 1);
}
}
}
#[test]
fn should_should_extract_mod_attributes() {
let doc = mk_doc(~"#[doc = \"test\"] mod a { }");
- assert!(doc.cratemod().mods()[0].desc() == Some(~"test"));
+ // hidden __std_macros module at the start.
+ assert!(doc.cratemod().mods()[1].desc() == Some(~"test"));
}
#[test]
#[test]
fn should_promote_desc() {
let doc = mk_doc(~"#[doc = \"desc\"] mod m { }");
- assert_eq!(doc.cratemod().mods()[0].brief(), Some(~"desc"));
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().mods()[1].brief(), Some(~"desc"));
}
#[test]
use extract;
use markdown_index_pass::run;
use path_pass;
+ use prune_hidden_pass;
use super::pandoc_header_id;
fn mk_doc(output_style: config::OutputStyle, source: ~str)
};
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
+ let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
let doc = (desc_to_brief_pass::mk_pass().f)(srv.clone(), doc);
let doc = (path_pass::mk_pass().f)(srv.clone(), doc);
+
run(srv.clone(), doc, config)
}
}
config::DocPerMod,
~"mod a { } fn b() { }"
);
- assert!(doc.cratemod().index.get().entries[0] == doc::IndexEntry {
+ assert_eq!(doc.cratemod().index.get().entries[0], doc::IndexEntry {
kind: ~"Module",
name: ~"a",
brief: None,
link: ~"a.html"
});
- assert!(doc.cratemod().index.get().entries[1] == doc::IndexEntry {
+ assert_eq!(doc.cratemod().index.get().entries[1], doc::IndexEntry {
kind: ~"Function",
name: ~"b",
brief: None,
config::DocPerMod,
~"#[doc = \"test\"] mod a { }"
);
- assert!(doc.cratemod().index.get().entries[0].brief
- == Some(~"test"));
+ assert_eq!(doc.cratemod().index.get().entries[0].brief, Some(~"test"));
}
#[test]
config::DocPerCrate,
~"extern { fn b(); }"
);
- assert!(doc.cratemod().nmods()[0].index.get().entries[0]
- == doc::IndexEntry {
- kind: ~"Function",
- name: ~"b",
- brief: None,
- link: ~"#function-b"
- });
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().nmods()[0].index.get().entries[0],
+ doc::IndexEntry {
+ kind: ~"Function",
+ name: ~"b",
+ brief: None,
+ link: ~"#function-b"
+ });
}
}
use markdown_writer;
use path_pass;
use page_pass;
+ use prune_hidden_pass;
use sectionalize_pass;
use trim_pass;
use tystr_pass;
debug!("doc (path): %?", doc);
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
debug!("doc (attr): %?", doc);
+ let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
+ debug!("doc (prune_hidden): %?", doc);
let doc = (desc_to_brief_pass::mk_pass().f)(srv.clone(), doc);
debug!("doc (desc_to_brief): %?", doc);
let doc = (unindent_pass::mk_pass().f)(srv.clone(), doc);
.. config::default_config(&Path("input/test.rc"))
};
let doc = mk_doc(~"", ~"mod a { mod b { } }");
- let modb = copy doc.cratemod().mods()[0].mods()[0];
+ // hidden __std_macros module at the start.
+ let modb = copy doc.cratemod().mods()[1].mods()[0];
let page = doc::ItemPage(doc::ModTag(modb));
let filename = make_local_filename(&config, page);
assert_eq!(filename, Path("output/dir/a_b.html"));
mod test {
use astsrv;
use config;
+ use attr_pass;
use doc;
use extract;
+ use prune_hidden_pass;
use page_pass::run;
fn mk_doc_(
) -> doc::Doc {
do astsrv::from_str(copy source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
+ let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
+ let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
run(srv.clone(), doc, output_style)
}
}
#[test]
fn should_make_a_page_for_every_mod() {
let doc = mk_doc(~"mod a { }");
+ // hidden __std_macros module at the start.
assert_eq!(doc.pages.mods()[0].name(), ~"a");
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
- assert!(doc.cratemod().mods()[0].mods()[0].mods()[0].path()
- == ~[~"a", ~"b"]);
- assert!(doc.cratemod().mods()[0].mods()[1].mods()[0].path()
- == ~[~"a", ~"d"]);
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().mods()[1].mods()[0].mods()[0].path(),
+ ~[~"a", ~"b"]);
+ assert_eq!(doc.cratemod().mods()[1].mods()[1].mods()[0].path(),
+ ~[~"a", ~"d"]);
}
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
- assert_eq!(doc.cratemod().mods()[0].fns()[0].path(), ~[~"a"]);
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().mods()[1].fns()[0].path(), ~[~"a"]);
}
}
use attr_pass;
use doc;
use extract;
+ use prune_hidden_pass;
use sectionalize_pass::run;
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(copy source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
+ let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
run(srv.clone(), doc)
}
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (mk_pass().f)(srv.clone(), doc);
- assert_eq!(doc.cratemod().items[0].name(), ~"y");
- assert_eq!(doc.cratemod().items[1].name(), ~"z");
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().items[1].name(), ~"y");
+ assert_eq!(doc.cratemod().items[2].name(), ~"z");
}
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (mk_pass().f)(srv.clone(), doc);
+ // hidden __std_macros module at the start.
assert_eq!(doc.cratemod().items[0].name(), ~"iconst");
assert_eq!(doc.cratemod().items[1].name(), ~"itype");
assert_eq!(doc.cratemod().items[2].name(), ~"ienum");
assert_eq!(doc.cratemod().items[4].name(), ~"itrait");
assert_eq!(doc.cratemod().items[5].name(), ~"__extensions__");
assert_eq!(doc.cratemod().items[6].name(), ~"ifn");
- assert_eq!(doc.cratemod().items[7].name(), ~"imod");
+ // hidden __std_macros module fits here.
+ assert_eq!(doc.cratemod().items[8].name(), ~"imod");
}
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (mk_pass(~"", name_lteq).f)(srv.clone(), doc);
- assert_eq!(doc.cratemod().mods()[0].name(), ~"w");
- assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"x");
- assert_eq!(doc.cratemod().mods()[1].items[1].name(), ~"y");
- assert_eq!(doc.cratemod().mods()[1].name(), ~"z");
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().mods()[1].name(), ~"w");
+ assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"x");
+ assert_eq!(doc.cratemod().mods()[2].items[1].name(), ~"y");
+ assert_eq!(doc.cratemod().mods()[2].name(), ~"z");
}
}
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (mk_pass(~"", always_eq).f)(srv.clone(), doc);
- assert_eq!(doc.cratemod().mods()[0].items[0].name(), ~"b");
- assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"d");
+ // hidden __std_macros module at the start.
+ assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"b");
+ assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"d");
let doc = (mk_pass(~"", always_eq).f)(srv.clone(), doc);
- assert_eq!(doc.cratemod().mods()[0].items[0].name(), ~"b");
- assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"d");
+ assert_eq!(doc.cratemod().mods()[1].items[0].name(), ~"b");
+ assert_eq!(doc.cratemod().mods()[2].items[0].name(), ~"d");
}
}
use attr_pass;
use doc;
use extract;
+ use prune_hidden_pass;
use trim_pass::mk_pass;
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(copy source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = (attr_pass::mk_pass().f)(srv.clone(), doc);
+ let doc = (prune_hidden_pass::mk_pass().f)(srv.clone(), doc);
(mk_pass().f)(srv.clone(), doc)
}
}
pub fn std_macros() -> @str {
return
-@"pub mod __std_macros {
+@"mod __std_macros {
#[macro_escape];
+ #[doc(hidden)];
macro_rules! ignore (($($x:tt)*) => (()))
pub fn fact(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
for uint::range(0u, n) |i| {
let x = uint::to_str(i);
- debug!(x);
+ info!(x);
}
}
copy args
};
- debug!("%?", args);
+ info!("%?", args);
run(args);
}
copy args
};
- debug!("%?", args);
+ info!("%?", args);
run(args);
}
return;
}
token => {
- debug!("thread: %d got token: %d", id, token);
+ info!("thread: %d got token: %d", id, token);
ch.send(token - 1);
if token <= n_tasks {
return;
fn run(repeat: int, depth: int) {
for (repeat as uint).times {
- debug!("starting %.4f", precise_time_s());
+ info!("starting %.4f", precise_time_s());
do task::try {
recurse_or_fail(depth, None)
};
- debug!("stopping %.4f", precise_time_s());
+ info!("stopping %.4f", precise_time_s());
}
}
fn recurse_or_fail(depth: int, st: Option<State>) {
if depth == 0 {
- debug!("unwinding %.4f", precise_time_s());
+ info!("unwinding %.4f", precise_time_s());
fail!();
} else {
let depth = depth - 1;
fn test() {
let v: int;
v = 1; //~ NOTE prior assignment occurs here
- debug!("v=%d", v);
+ info!("v=%d", v);
v = 2; //~ ERROR re-assignment of immutable variable
- debug!("v=%d", v);
+ info!("v=%d", v);
}
fn main() {
fn main() {
let nyan : cat = cat(52u, 99);
- nyan.speak = || debug!("meow"); //~ ERROR attempted to take value of method
+ nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
}
fn main() {
#[attr] //~ ERROR expected item after attributes
- debug!("hi");
+ info!("hi");
}
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`
- debug!(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`
- debug!(answer);
+ info!(answer);
assert_eq!(answer, 42);
}
// error-pattern:expected `~str` but found `int`
static i: ~str = 10i;
-fn main() { debug!(i); }
+fn main() { info!(i); }
fn main() {
let x = compute1();
- debug!(x);
+ info!(x);
assert_eq!(x, -4f);
}
fn main() {
let red: color = rgb(255, 0, 0);
match red {
- rgb(r, g, b) => { debug!("rgb"); }
- hsl(h, s, l) => { debug!("hsl"); }
+ rgb(r, g, b) => { info!("rgb"); }
+ hsl(h, s, l) => { info!("hsl"); }
}
}
p[0] = 5; //~ ERROR cannot assign
- debug!("%d", *q);
+ info!("%d", *q);
}
fn borrow(_x: &[int], _f: &fn()) {}
let v = ~3;
let _w = &v;
do task::spawn {
- debug!("v=%d", *v);
+ info!("v=%d", *v);
//~^ ERROR cannot move `v` into closure
}
let v = ~3;
let _w = &v;
task::spawn(|| {
- debug!("v=%d", *v);
+ info!("v=%d", *v);
//~^ ERROR cannot move
});
}
}
}
let z = copy tail[0];
- debug!(fmt!("%?", z));
+ info!(fmt!("%?", z));
}
_ => {
::std::util::unreachable();
let x: int = 3;
let y: &mut int = &mut x; //~ ERROR cannot borrow
*y = 5;
- debug!(*y);
+ info!(*y);
}
fn main() {
return;
- debug!("Paul is dead"); //~ ERROR: unreachable
+ info!("Paul is dead"); //~ ERROR: unreachable
}
// error-pattern: unresolved name `this_does_nothing_what_the`.
-fn main() { debug!("doing"); this_does_nothing_what_the; debug!("boing"); }
+fn main() { info!("doing"); this_does_nothing_what_the; info!("boing"); }
}
mod bar {
- fn x() { debug!("x"); }
+ fn x() { info!("x"); }
pub fn y() { }
}
fn main() {
let a = if true { true };
- debug!(a);
+ info!(a);
}
use module_of_many_things::*;
mod module_of_many_things {
- pub fn f1() { debug!("f1"); }
- pub fn f2() { debug!("f2"); }
- fn f3() { debug!("f3"); }
- pub fn f4() { debug!("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() { debug!("f1"); }
+ pub fn f1() { info!("f1"); }
pub fn common() -> uint { return 0u; }
}
mod circ2 {
pub use circ1::f1;
- pub fn f2() { debug!("f2"); }
+ pub fn f2() { info!("f2"); }
pub fn common() -> uint { return 1u; }
}
use zed::bar;
use zed::baz;
mod zed {
- pub fn bar() { debug!("bar"); }
+ pub fn bar() { info!("bar"); }
}
fn main(args: ~[str]) { bar(); }
mod baz {}
mod zed {
- pub fn bar() { debug!("bar3"); }
+ pub fn bar() { info!("bar3"); }
}
fn main(args: ~[str]) { bar(); }
// error-pattern: unresolved
use main::bar;
-fn main(args: ~[str]) { debug!("foo"); }
+fn main(args: ~[str]) { info!("foo"); }
mod a { pub use b::foo; }
mod b { pub use a::foo; }
-fn main(args: ~[str]) { debug!("loop"); }
+fn main(args: ~[str]) { info!("loop"); }
// Regression test for issue #1448 and #1386
fn main() {
- debug!("%u", 10i); //~ ERROR mismatched types
+ info!("%u", 10i); //~ ERROR mismatched types
}
// error-pattern: unresolved name `foobar`.
-fn main(args: ~[str]) { debug!(foobar); }
+fn main(args: ~[str]) { info!(foobar); }
{
let _z = match g(1, 2) {
- g(x, x) => { debug!(x + x); }
+ g(x, x) => { info!(x + x); }
//~^ ERROR Identifier `x` is bound more than once in the same pattern
};
fn main() {
let i: int;
- debug!(false && { i = 5; true });
- debug!(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) -> ! { debug!(3); }
+fn bad_bang(i: uint) -> ! { info!(3); }
fn main() { bad_bang(5u); }
fn main() {
let x: int;
force(|| {
- debug!(x); //~ ERROR capture of possibly uninitialized variable: `x`
+ info!(x); //~ ERROR capture of possibly uninitialized variable: `x`
});
}
x = 0;
}
- debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
+ info!(x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { debug!(foo()); }
+fn main() { info!(foo()); }
x = 0;
}
- debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
+ info!(x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { debug!(foo()); }
+fn main() { info!(foo()); }
// except according to those terms.
fn force(f: &fn() -> int) -> int { f() }
-fn main() { debug!(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) { debug!(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) { debug!(x); }
+fn foo(x: int) { info!(x); }
fn main() {
let x: int;
if 1 > 2 {
- debug!("whoops");
+ info!("whoops");
} else {
x = 10;
}
let y: ~int = ~42;
let mut x: ~int;
loop {
- debug!(y);
+ info!(y);
loop {
loop {
loop {
let y: ~int = ~42;
let mut x: ~int;
loop {
- debug!(y); //~ ERROR use of moved value: `y`
+ info!(y); //~ ERROR use of moved value: `y`
while true { while true { while true { x = y; copy x; } } }
//~^ ERROR use of moved value: `y`
}
fn main() {
let i: int;
- debug!(false || { i = 5; true });
- debug!(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) { debug!(x); }
+fn foo(x: int) { info!(x); }
fn main() {
let x: int;
fn main() {
let x = ~5;
let y = x;
- debug!(*x); //~ ERROR use of moved value: `x`
+ info!(*x); //~ ERROR use of moved value: `x`
copy y;
}
// except according to those terms.
fn send<T:Send>(ch: _chan<T>, data: T) {
- debug!(ch);
- debug!(data);
+ info!(ch);
+ info!(data);
fail!();
}
// message after the send deinitializes it
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
send(ch, message);
- debug!(message); //~ ERROR use of moved value: `message`
+ info!(message); //~ ERROR use of moved value: `message`
}
fn main() { fail!(); }
v = 3;
break;
}
- debug!("%d", v); //~ ERROR use of possibly uninitialized variable: `v`
+ info!("%d", v); //~ ERROR use of possibly uninitialized variable: `v`
}
fn main() {
fn main() {
match true { false => { my_fail(); } true => { } }
- debug!(x); //~ ERROR unresolved name `x`.
+ info!(x); //~ ERROR unresolved name `x`.
let x: int;
}
}
fn main() {
- debug!(foo{ x: 1 } as int);
+ info!(foo{ x: 1 } as int);
}
// error-pattern:literal out of range
-fn main() { debug!(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);
- debug!(oof);
+ info!(oof);
}
}
let foo = Foo { bar: 1, baz: 10 };
unsafe {
let oof: Oof = cast::transmute(foo);
- debug!(oof);
+ info!(oof);
}
}
fn foo(t: bar) {
match t {
t1(_, Some::<int>(x)) => {
- debug!(x);
+ info!(x);
}
_ => { fail!(); }
}
// Can't do this copy
let x = ~~~A {y: r(i)};
let _z = copy x; //~ ERROR copying a value of non-copyable type
- debug!(x);
+ info!(x);
}
error!(*i);
}
fn main() {
let mut d = dog();
d.chase_cat();
- debug!("cats_chased: %u", d.cats_chased);
+ info!("cats_chased: %u", d.cats_chased);
}
fn main() {
let i = 3;
do wants_static_fn { //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
- debug!("i=%d", i);
+ info!("i=%d", i);
}
}
fn main() {
let x = return_it();
- debug!("foo=%d", *x);
+ info!("foo=%d", *x);
}
fn main() {
let x = return_it();
- debug!("foo=%d", *x);
+ info!("foo=%d", *x);
}
fn main() {
let f: ~fn(x: uint) -> uint = |x| 4u;
- debug!(test(f)); //~ ERROR expected @ closure, found ~ closure
+ info!(test(f)); //~ ERROR expected @ closure, found ~ closure
}
fn main() {
let i = ~r { b: true };
let _j = copy i; //~ ERROR copying a value of non-copyable type
- debug!(i);
+ info!(i);
}
f(copy r1, copy r2);
//~^ ERROR copying a value of non-copyable type
//~^^ ERROR copying a value of non-copyable type
- debug!((r2, *i1));
- debug!((r1, *i2));
+ info!((r2, *i1));
+ info!((r1, *i2));
}
use std::libc;
fn main() {
- debug!(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];
- debug!(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;
- debug!(j);
+ info!(j);
}
// except according to those terms.
fn blk1(b: &fn()) -> @fn() { return || { }; }
-fn test1() { (do blk1 { debug!("hi"); })(); }
+fn test1() { (do blk1 { info!("hi"); })(); }
for 10u.times {
do task::spawn {
let result = count(5u);
- debug!("result = %?", result);
+ info!("result = %?", result);
fail!();
};
}
// except according to those terms.
// error-pattern:woe
-fn f(a: int) { debug!(a); }
+fn f(a: int) { info!(a); }
fn main() { f(fail!("woe")); }
fn foo(x: uint) {
if even(x) {
- debug!(x);
+ info!(x);
} else {
fail!("Number is odd");
}
pub fn main() {
let (a, b) = f(22_u64, 44u16)();
- debug!("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();
- debug!("a=%u b=%u", *a as uint, b as uint);
+ info!("a=%u b=%u", *a as uint, b as uint);
assert_eq!(*a, x);
assert_eq!(b, y);
}
pub fn main() {
let a: int = 10;
- debug!(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);
- debug!(i32_b | i32_b << 1);
+ info!(i32_b | i32_b << 1);
assert_eq!(i32_b | i32_b << 1, 0x30303030);
}
fn f<T:Copy,U:Copy>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
pub fn main() {
- debug!("%?", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
- debug!("%?", f(5, 6).a);
+ info!("%?", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
+ info!("%?", f(5, 6).a);
}
a ^= b;
b ^= a;
a = a ^ b;
- debug!(a);
- debug!(b);
+ info!(a);
+ info!(b);
assert_eq!(b, 1);
assert_eq!(a, 2);
assert_eq!(!0xf0 & 0xff, 0xf);
x = @F {f: ~4};
- debug!("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};
- debug!("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};
- debug!("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};
- debug!("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;
- debug!("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;
}
- debug!("*r = %d, exp = %d", *r, exp);
+ info!("*r = %d, exp = %d", *r, exp);
assert_eq!(*r, exp);
x = @5;
y = @6;
- debug!("*r = %d, exp = %d", *r, exp);
+ info!("*r = %d, exp = %d", *r, exp);
assert_eq!(*r, exp);
}
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
x = @F {f: ~4};
- debug!("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)));
pub fn main() {
let foo: int = 17;
let bfoo: Box<int> = Box {c: @foo};
- debug!("see what's in our box");
+ info!("see what's in our box");
assert_eq!(unbox::<int>(bfoo), foo);
}
pub fn main() {
let x = 3;
- debug!("&x=%x", borrow::to_uint(&x));
+ info!("&x=%x", borrow::to_uint(&x));
}
pub fn main() {
let p = @22u;
let r = foo(p);
- debug!("r=%u", r);
+ info!("r=%u", r);
assert_eq!(r, 22u);
}
pub fn main() {
//let bt0 = sys::frame_address();
- //debug!("%?", bt0);
+ //info!("%?", bt0);
do 3u.to(10u) |i| {
print(fmt!("%u\n", i));
//let bt1 = sys::frame_address();
- //debug!("%?", bt1);
+ //info!("%?", bt1);
//assert!(bt0 == bt1);
}
}
pub fn main() {
//let bt0 = sys::rusti::frame_address(1u32);
- //debug!("%?", bt0);
+ //info!("%?", bt0);
do cci_iter_lib::iter(~[1, 2, 3]) |i| {
print(fmt!("%d", *i));
//assert!(bt0 == sys::rusti::frame_address(2u32));
// sys::frame_address() to determine if we are inlining is
// actually working.
//let bt0 = sys::frame_address();
- //debug!("%?", bt0);
+ //info!("%?", bt0);
do iter(~[1u, 2u, 3u]) |i| {
print(fmt!("%u\n", i));
//let bt1 = sys::frame_address();
- //debug!("%?", bt1);
+ //info!("%?", bt1);
//assert!(bt0 != bt1);
}
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
- debug!("%s", actual);
+ info!("%s", actual);
assert_eq!(actual, expected);
}
impl dog {
priv fn bark(&self) -> int {
- debug!("Woof %u %d", *self.barks, *self.volume);
+ info!("Woof %u %d", *self.barks, *self.volume);
*self.barks += 1u;
if *self.barks % 3u == 0u {
*self.volume += 1;
if *self.barks % 10u == 0u {
*self.volume -= 2;
}
- debug!("Grrr %u %d", *self.barks, *self.volume);
+ info!("Grrr %u %d", *self.barks, *self.volume);
*self.volume
}
}
impl cat {
fn meow(&self) -> uint {
- debug!("Meow");
+ info!("Meow");
*self.meows += 1u;
if *self.meows % 5u == 0u {
*self.how_hungry += 1;
let bite_counts : hashmap<body_part, uint>;
fn meow() -> uint {
- debug!("Meow: %u", *self.meows);
+ info!("Meow: %u", *self.meows);
*self.meows += 1u;
if *self.meows % 5u == 0u {
*self.how_hungry += 1;
let all = ~[toe, nose, ear];
let mut min = finger;
do iter(all) |next| {
- debug!("min = %?", min);
+ info!("min = %?", min);
if self.bite_counts.get(next) < self.bite_counts.get(min) {
min = next;
}};
self.bite_counts.insert(min, self.bite_counts.get(min) + 1u);
- debug!("Bit %?", min);
+ info!("Bit %?", min);
min
}
}
fn annoy_neighbors<T:noisy>(critter: T) {
for uint::range(0u, 10u) |i| {
let what = critter.speak();
- debug!("%u %d", i, what);
+ info!("%u %d", i, what);
}
}
let mut left : ~[body_part] = ~[finger, toe, nose, ear];
while left.len() > 0u {
let part = critter.bite();
- debug!("%? %?", left, part);
+ info!("%? %?", left, part);
if vec_includes(left, part) {
left = vec::filter(left, |p| p != part );
}
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
- debug!("%s", actual);
+ info!("%s", actual);
assert_eq!(actual, expected);
}
pub fn main() {
let (a, b) = f(22_u64, 44u16)();
- debug!("a=%? b=%?", a, b);
+ info!("a=%? b=%?", a, b);
assert_eq!(a, 22u64);
assert_eq!(b, 44u16);
}
pub fn main() {
let x: int = 2 + 2;
- debug!("%?", x);
- debug!("hello, world");
- debug!("%?", 10);
+ info!("%?", x);
+ info!("hello, world");
+ info!("%?", 10);
}
static i: int = 10;
-pub fn main() { debug!("%i", i); }
+pub fn main() { info!("%i", i); }
#[start]
fn start(argc: int, argv: **u8, crate_map: *u8) -> int {
do std::rt::start(argc, argv, crate_map) {
- debug!("creating my own runtime is joy");
+ info!("creating my own runtime is joy");
}
}
// -*- rust -*-
-pub fn main() { if 1 == 1 { return; } debug!("Paul is dead"); }
+pub fn main() { if 1 == 1 { return; } info!("Paul is dead"); }
-pub fn main() { let x = @mut 5; *x = 1000; debug!("%?", *x); }
+pub fn main() { let x = @mut 5; *x = 1000; info!("%?", *x); }
let v = &"hello";
let mut y : &str = &"there";
- debug!(x);
- debug!(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";
- debug!(a);
+ info!(a);
assert!(a < b);
assert!(a <= b);
assert!(b >= a);
assert!(b > a);
- debug!(b);
+ info!(b);
assert!(a < c);
assert!(a <= c);
assert!(c >= a);
assert!(c > a);
- debug!(c);
+ info!(c);
assert!(c < cc);
assert!(c <= cc);
assert!(cc >= c);
assert!(cc > c);
- debug!(cc);
+ info!(cc);
}
let c : &[int] = &[2,2,2,2,3];
let cc : &[int] = &[2,2,2,2,2,2];
- debug!(a);
+ info!(a);
assert!(a < b);
assert!(a <= b);
assert!(b >= a);
assert!(b > a);
- debug!(b);
+ info!(b);
assert!(b < c);
assert!(b <= c);
assert!(c >= a);
assert!(c > a);
- debug!(c);
+ info!(c);
assert!(a < cc);
assert!(a <= cc);
assert!(cc >= a);
assert!(cc > a);
- debug!(cc);
+ info!(cc);
}
pub fn y() { super::super::foo::x(); }
}
- pub fn x() { debug!("x"); }
+ pub fn x() { info!("x"); }
}
pub fn main() { self::foo::bar::y(); }
}
pub mod bar {
- pub fn x() { debug!("x"); }
+ pub fn x() { info!("x"); }
}
pub fn main() { foo::x(); }
fn test_box() {
fn compare_box(b1: @bool, b2: @bool) -> bool {
- debug!(*b1);
- debug!(*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 {
- debug!(*b1);
- debug!(*b2);
+ info!(*b1);
+ info!(*b2);
return *b1 == *b2;
}
test_generic::<bool>(~true, compare_box);
fn count(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = count(1000u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 1000u);
}
fn count(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
// has a large stack)
do task::spawn {
let result = count(1000u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 1000u);
};
}
fn count(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
// has a large stack)
do task::spawn {
let result = count(12u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 2048u);
};
}
fn fact(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 3628800u);
}
fn fact(n: uint) -> uint {
unsafe {
- debug!("n = %?", n);
+ info!("n = %?", n);
externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
}
}
pub fn main() {
let result = fact(10u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 3628800u);
}
for 10u.times {
do task::spawn {
let result = count(5u);
- debug!("result = %?", result);
+ info!("result = %?", result);
assert_eq!(result, 16u);
};
}
// -*- rust -*-
fn f(x: int) -> int {
- // debug!("in f:");
+ // info!("in f:");
- debug!(x);
+ info!(x);
if x == 1 {
- // debug!("bottoming out");
+ // info!("bottoming out");
return 1;
} else {
- // debug!("recurring");
+ // info!("recurring");
let y: int = x * f(x - 1);
- // debug!("returned");
+ // info!("returned");
- debug!(y);
+ info!(y);
return y;
}
}
pub fn main() {
assert_eq!(f(5), 120);
- // debug!("all done");
+ // info!("all done");
}
fn foo(n: float) -> float { return n + 0.12345; }
let n: float = 0.1;
let m: float = foo(n);
- debug!(m);
+ info!(m);
}
pub fn main() {
let pi = 3.1415927;
- debug!(-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 {
- debug!("yes");
+ info!("yes");
}
}
// except according to those terms.
fn f() {
- debug!("This is a bare function");
+ info!("This is a bare function");
}
pub fn main() {
let mut j: int = 0;
do pairs() |p| {
let (_0, _1) = p;
- debug!(_0);
- debug!(_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| { debug!("main"); debug!(i); sum = sum + i; }
- debug!("sum");
- debug!(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 { debug!("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);
- debug!(*actual);
+ info!(*actual);
assert_eq!(*expected, *actual);
}
pub fn main() {
let expected = ~100;
let actual = id::<~int>(expected.clone());
- debug!(*actual);
+ info!(*actual);
assert_eq!(*expected, *actual);
}
pub fn main() {
let b = f::<int>(10);
- debug!(b.a);
- debug!(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); debug!(*x); }
+pub fn main() { let x = f(@3); info!(*x); }
fn f<T:Copy>(x: ~T) -> ~T { return x; }
-pub fn main() { let x = f(~3); debug!(*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);
- debug!(y);
+ info!(y);
assert_eq!(x, y);
b = id::<char>(a);
- debug!(b);
+ info!(b);
assert_eq!(a, b);
q = id::<Triple>(p);
x = p.z;
y = q.z;
- debug!(y);
+ info!(y);
assert_eq!(x, y);
}
fn altfoo<T>(f: foo<T>) {
let mut hit = false;
- match f { arm::<T>(x) => { debug!("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) => { debug!(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) => {
- debug!(t.x);
- debug!(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) { debug!(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:Copy>(t: (T, T, T)) -> T { let (_, _, x) = t; return x; }
pub fn main() {
- debug!(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);
}
pub fn main() {
let i: int = if false { fail!() } else { 5 };
- debug!(i);
+ info!(i);
}
fn foo(x: uint) {
if even(x) {
- debug!(x);
+ info!(x);
} else {
fail!();
}
use dug::too::greedily::and::too::deep::*;
mod module_of_many_things {
- pub fn f1() { debug!("f1"); }
- pub fn f2() { debug!("f2"); }
- fn f3() { debug!("f3"); }
- pub fn f4() { debug!("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() { debug!("Boo!"); }
- pub fn also_redstone() { debug!("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) { debug!(y); }
+ pub fn x(y: int) { info!(y); }
}
mod bar {
use zed::bar;
mod zed {
- pub fn bar() { debug!("bar"); }
+ pub fn bar() { info!("bar"); }
}
pub fn main() { bar(); }
mod baz {
pub mod zed {
- pub fn bar() { debug!("bar2"); }
+ pub fn bar() { info!("bar2"); }
}
}
use zed::bar;
mod zed {
- pub fn bar() { debug!("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() { debug!("foo"); }
+ pub fn bar() { info!("foo"); }
}
}
use bar::baz;
mod foo {
pub mod zed {
- pub fn baz() { debug!("baz"); }
+ pub fn baz() { info!("baz"); }
}
}
mod bar {
use bar::baz;
mod foo {
pub mod zed {
- pub fn baz() { debug!("baz"); }
+ pub fn baz() { info!("baz"); }
}
}
mod bar {
use z = foo::x;
mod foo {
- pub fn x(y: int) { debug!(y); }
+ pub fn x(y: int) { info!(y); }
}
pub fn main() { x(10); z(10); }
// -*- rust -*-
mod inner {
pub mod inner2 {
- pub fn hello() { debug!("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);
- debug!(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);
- debug!(s[3u8]);
+ info!(s[3u8]);
}
let a = A { x: 0 };
let A { x: ref x } = a;
- debug!("%?", x)
+ info!("%?", x)
}
match a {
A { x : ref x } => {
- debug!("%?", x)
+ info!("%?", x)
}
}
}
fn test_stack_assign() {
let s: ~str = ~"a";
- debug!(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"; debug!(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");
- debug!(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 );
- debug!(sum);
+ info!(sum);
}
let x = 1 == 2 || 3 == 3;
assert!((x));
let mut y: int = 10;
- debug!(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) { debug!(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 x.iter().advance |i| { debug!(*i); y += *i; }
- debug!(y);
+ for x.iter().advance |i| { info!(*i); y += *i; }
+ info!(y);
assert_eq!(y, 6);
let s = ~"hello there";
let mut i: int = 0;
// ...
i += 1;
- debug!(i);
- debug!(c);
+ info!(i);
+ info!(c);
}
assert_eq!(i, 11);
}
v = 3;
break;
}
- debug!("%d", v);
+ info!("%d", v);
}
pub fn main() {
}
pub fn main() {
- debug!(1);
+ info!(1);
info!(2.0);
warn!(Three);
error!(~[4]);
pub fn main() {
let i: int =
match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { 5 } };
- debug!("%?", i);
+ info!("%?", i);
}
return;
}
-pub fn main() { debug!("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) {
- debug!(::std::sys::refcount(s));
+ info!(::std::sys::refcount(s));
let count = ::std::sys::refcount(s);
let x: t = make_t(s); // ref up
assert_eq!(::std::sys::refcount(s), count + 1u);
- debug!(::std::sys::refcount(s));
+ info!(::std::sys::refcount(s));
match x {
make_t(y) => {
- debug!("%?", y); // ref up then down
+ info!("%?", y); // ref up then down
}
- _ => { debug!("?"); fail!(); }
+ _ => { info!("?"); fail!(); }
}
- debug!(::std::sys::refcount(s));
+ info!(::std::sys::refcount(s));
assert_eq!(::std::sys::refcount(s), count + 1u);
let _ = ::std::sys::refcount(s); // don't get bitten by last-use.
}
foo(s); // ref up then down
- debug!("%u", ::std::sys::refcount(s));
+ info!("%u", ::std::sys::refcount(s));
let count2 = ::std::sys::refcount(s);
assert_eq!(count, count2);
}
fn altlit(f: int) -> int {
match f {
- 10 => { debug!("case 10"); return 20; }
- 11 => { debug!("case 11"); return 22; }
+ 10 => { info!("case 10"); return 20; }
+ 11 => { info!("case 11"); return 22; }
_ => fail!("the impossible happened")
}
}
pub fn main() {
match ~100 {
~x => {
- debug!("%?", x);
+ info!("%?", x);
assert_eq!(x, 100);
}
}
grow(&mut v);
grow(&mut v);
let len = v.len();
- debug!(len);
+ info!(len);
assert_eq!(len, 3 as uint);
}
Some::<int>(x) => {
let mut bar;
match None::<int> { None::<int> => { bar = 5; } _ => { baz(); } }
- debug!(bar);
+ info!(bar);
}
- None::<int> => { debug!("hello"); }
+ None::<int> => { info!("hello"); }
}
}
pub fn main() {
let mut x: int = 1;
x *= 2;
- debug!(x);
+ info!(x);
assert_eq!(x, 2);
x += 3;
- debug!(x);
+ info!(x);
assert_eq!(x, 5);
x *= x;
- debug!(x);
+ info!(x);
assert_eq!(x, 25);
x /= 5;
- debug!(x);
+ info!(x);
assert_eq!(x, 5);
}
while b <= 32u {
0u << b;
b <<= 1u;
- debug!(b);
+ info!(b);
}
}
pub fn main() {
let x = true;
if x { let mut i = 10; while i > 0 { i -= 1; } }
- match x { true => { debug!("right"); } false => { debug!("wrong"); } }
+ match x { true => { info!("right"); } false => { info!("wrong"); } }
}
// -*- rust -*-
-fn dont_call_me() { fail!(); debug!(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) { debug!(x); }
-fn magic2(x: @int) { debug!(x); }
+fn magic(x: A) { info!(x); }
+fn magic2(x: @int) { info!(x); }
struct A { a: @int }
bar => {
bar::do_bar(x) -> _next {
- debug!("%?", x)
+ info!("%?", x)
},
do_baz(b) -> _next {
- if b { debug!("true") } else { debug!("false") }
+ if b { info!("true") } else { info!("false") }
}
}
)
fn run(i: int) {
- debug!(i);
+ info!(i);
if i == 0 {
return;
use extra::comm;
fn starve_main(alive: Port<int>) {
- debug!("signalling main");
+ info!("signalling main");
alive.recv();
- debug!("starving main");
+ info!("starving main");
let mut i: int = 0;
loop { i += 1; }
}
pub fn main() {
let (port, chan) = stream();
- debug!("main started");
+ info!("main started");
do spawn {
starve_main(port);
};
let mut i: int = 0;
- debug!("main waiting for alive signal");
+ info!("main waiting for alive signal");
chan.send(i);
- debug!("main got alive signal");
- while i < 50 { debug!("main iterated"); i += 1; }
- debug!("main completed");
+ info!("main got alive signal");
+ while i < 50 { info!("main iterated"); i += 1; }
+ info!("main completed");
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// Testing that calling fmt! (via debug!) doesn't complain about impure borrows
+// Testing that calling fmt! (via info!) doesn't complain about impure borrows
struct Big { b: @~str, c: uint, d: int, e: char,
f: float, g: bool }
f: 0.0,
g: true
};
- debug!("test %?", a.b);
- debug!("test %u", a.c);
- debug!("test %i", a.d);
- debug!("test %c", a.e);
- debug!("test %f", a.f);
- debug!("test %b", a.g);
+ info!("test %?", a.b);
+ info!("test %u", a.c);
+ info!("test %i", a.d);
+ info!("test %c", a.e);
+ info!("test %f", a.f);
+ info!("test %b", a.g);
}
pub fn main() {
let x = @6;
let y = x.get();
- debug!("y=%d", y);
+ info!("y=%d", y);
assert_eq!(y, 6);
let x = ~6;
let y = x.get();
- debug!("y=%d", y);
+ info!("y=%d", y);
assert_eq!(y, 6);
let x = ~6;
let y = x.get();
- debug!("y=%d", y);
+ info!("y=%d", y);
assert_eq!(y, 6);
let x = &6;
let y = x.get();
- debug!("y=%d", y);
+ info!("y=%d", y);
assert_eq!(y, 6);
}
pub fn main() {
let x = ~[1, 2, 3];
let y = call_sum(x);
- debug!("y==%d", y);
+ info!("y==%d", y);
assert_eq!(y, 6);
let mut x = ~[1, 2, 3];
let y = x.sum_();
- debug!("y==%d", y);
+ info!("y==%d", y);
assert_eq!(y, 6);
let x = ~[1, 2, 3];
let y = x.sum_();
- debug!("y==%d", y);
+ info!("y==%d", y);
assert_eq!(y, 6);
}
// Send it through the shape code
let y = fmt!("%?", x);
- debug!("align inner = %?", rusti::min_align_of::<Inner>());
- debug!("size outer = %?", sys::size_of::<Outer>());
- debug!("y = %s", y);
+ info!("align inner = %?", rusti::min_align_of::<Inner>());
+ info!("size outer = %?", sys::size_of::<Outer>());
+ info!("y = %s", 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 = fmt!("%?", x);
- debug!("align inner = %?", rusti::min_align_of::<Inner>());
- debug!("size outer = %?", sys::size_of::<Outer>());
- debug!("y = %s", y);
+ info!("align inner = %?", rusti::min_align_of::<Inner>());
+ info!("size outer = %?", sys::size_of::<Outer>());
+ info!("y = %s", 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"};
- debug!(x.foo.clone());
- debug!(x.bar.clone());
+ info!(x.foo.clone());
+ info!(x.bar.clone());
}
pub fn main() {
let p = @22u;
let r = foo(p);
- debug!("r=%u", r);
+ info!("r=%u", r);
assert_eq!(r, 22u);
}
pub fn main() {
let clam = Clam { chowder: &3 };
- debug!(*clam.get_chowder());
+ info!(*clam.get_chowder());
clam.get_chowder();
}
match y {
int_wrapper_ctor(zz) => { z = zz; }
}
- debug!(*z);
+ info!(*z);
}
let mut x: int = 3;
let y: &mut int = &mut x;
*y = 5;
- debug!(*y);
+ info!(*y);
}
}
pub fn main() {
- let cl_box = box_it(|| debug!("Hello, world!"));
+ let cl_box = box_it(|| info!("Hello, world!"));
call_static_closure(cl_box);
}
let a = r(i);
let b = (a, 10);
let (c, _d) = b;
- debug!(c);
+ info!(c);
}
assert_eq!(*i, 1);
}
impl Drop for r {
fn drop(&self) {
unsafe {
- debug!("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::<*r, uint>(self),
cast::transmute::<**int, uint>(&(self.v)),
cast::transmute::<*int, uint>(self.v));
next: None,
r: {
let rs = r(i1p);
- debug!("r = %x", cast::transmute::<*r, uint>(&rs));
+ info!("r = %x", cast::transmute::<*r, uint>(&rs));
rs }
});
- debug!("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);
- debug!("r2 = %x", cast::transmute::<*r, uint>(&rs));
+ info!("r2 = %x", cast::transmute::<*r, uint>(&rs));
rs
}
});
- debug!("x2 = %x, x2.r = %x",
+ info!("x2 = %x, x2.r = %x",
cast::transmute::<@mut t, uint>(x2),
cast::transmute::<*r, uint>(&(x2.r)));
fn test05_start(f: &~fn(v: float, v: ~str) -> Pair<float, ~str>) {
let p = (*f)(22.22f, ~"Hi");
- debug!(copy p);
+ info!(copy p);
assert!(p.a == 22.22f);
assert!(p.b == ~"Hi");
let q = (*f)(44.44f, ~"Ho");
- debug!(copy q);
+ info!(copy q);
assert!(q.a == 44.44f);
assert!(q.b == ~"Ho");
}
match none::<int> {
some::<int>(_) => {
for c.iter().advance |i| {
- debug!(a);
+ info!(a);
let a = 17;
b.push(a);
}
-pub fn main() { let mut n; n = 1; debug!(n); }
+pub fn main() { let mut n; n = 1; info!(n); }
pub fn main() {
let x = none::<int>;
- match x { none::<int> => { debug!("hello world"); } }
+ match x { none::<int> => { info!("hello world"); } }
}
fn uhoh<T>(v: ~[clam<T>]) {
match v[1] {
- a::<T>(ref t, ref u) => { debug!("incorrect"); debug!(u); fail!(); }
- b::<T> => { debug!("correct"); }
+ a::<T>(ref t, ref u) => { info!("incorrect"); info!(u); fail!(); }
+ b::<T> => { info!("correct"); }
}
}
use std::task;
fn x(s: ~str, n: int) {
- debug!(s);
- debug!(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; debug!("parent sleeping"); task::yield(); }
+ while i > 0 { i = i - 1; info!("parent sleeping"); task::yield(); }
}
fn test1() {
let mut s: ~str = ~"hello";
s.push_str("world");
- debug!(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";
- debug!(a.clone());
- debug!(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;
- debug!(s.clone());
+ info!(s.clone());
assert_eq!(s[9], 'd' as u8);
}
pub fn main() {
let s = ~"hello";
let c: u8 = s[4];
- debug!(c);
+ info!(c);
assert_eq!(c, 0x6f as u8);
}
pub fn main() {
let f = 1 as *libc::FILE;
- debug!(f as int);
- debug!(f as uint);
- debug!(f as i8);
- debug!(f as i16);
- debug!(f as i32);
- debug!(f as i64);
- debug!(f as u8);
- debug!(f as u16);
- debug!(f as u32);
- debug!(f as u64);
+ 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);
- debug!(1 as int);
- debug!(1 as uint);
- debug!(1 as float);
- debug!(1 as bool);
- debug!(1 as *libc::FILE);
- debug!(1 as i8);
- debug!(1 as i16);
- debug!(1 as i32);
- debug!(1 as i64);
- debug!(1 as u8);
- debug!(1 as u16);
- debug!(1 as u32);
- debug!(1 as u64);
- debug!(1 as f32);
- debug!(1 as f64);
+ info!(1 as int);
+ info!(1 as uint);
+ info!(1 as float);
+ info!(1 as bool);
+ 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);
- debug!(1u as int);
- debug!(1u as uint);
- debug!(1u as float);
- debug!(1u as bool);
- debug!(1u as *libc::FILE);
- debug!(1u as i8);
- debug!(1u as i16);
- debug!(1u as i32);
- debug!(1u as i64);
- debug!(1u as u8);
- debug!(1u as u16);
- debug!(1u as u32);
- debug!(1u as u64);
- debug!(1u as f32);
- debug!(1u as f64);
+ info!(1u as int);
+ info!(1u as uint);
+ info!(1u as float);
+ info!(1u as bool);
+ 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);
- debug!(1i8 as int);
- debug!(1i8 as uint);
- debug!(1i8 as float);
- debug!(1i8 as bool);
- debug!(1i8 as *libc::FILE);
- debug!(1i8 as i8);
- debug!(1i8 as i16);
- debug!(1i8 as i32);
- debug!(1i8 as i64);
- debug!(1i8 as u8);
- debug!(1i8 as u16);
- debug!(1i8 as u32);
- debug!(1i8 as u64);
- debug!(1i8 as f32);
- debug!(1i8 as f64);
+ info!(1i8 as int);
+ info!(1i8 as uint);
+ info!(1i8 as float);
+ info!(1i8 as bool);
+ 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);
- debug!(1u8 as int);
- debug!(1u8 as uint);
- debug!(1u8 as float);
- debug!(1u8 as bool);
- debug!(1u8 as *libc::FILE);
- debug!(1u8 as i8);
- debug!(1u8 as i16);
- debug!(1u8 as i32);
- debug!(1u8 as i64);
- debug!(1u8 as u8);
- debug!(1u8 as u16);
- debug!(1u8 as u32);
- debug!(1u8 as u64);
- debug!(1u8 as f32);
- debug!(1u8 as f64);
+ info!(1u8 as int);
+ info!(1u8 as uint);
+ info!(1u8 as float);
+ info!(1u8 as bool);
+ 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);
- debug!(1i16 as int);
- debug!(1i16 as uint);
- debug!(1i16 as float);
- debug!(1i16 as bool);
- debug!(1i16 as *libc::FILE);
- debug!(1i16 as i8);
- debug!(1i16 as i16);
- debug!(1i16 as i32);
- debug!(1i16 as i64);
- debug!(1i16 as u8);
- debug!(1i16 as u16);
- debug!(1i16 as u32);
- debug!(1i16 as u64);
- debug!(1i16 as f32);
- debug!(1i16 as f64);
+ info!(1i16 as int);
+ info!(1i16 as uint);
+ info!(1i16 as float);
+ info!(1i16 as bool);
+ 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);
- debug!(1u16 as int);
- debug!(1u16 as uint);
- debug!(1u16 as float);
- debug!(1u16 as bool);
- debug!(1u16 as *libc::FILE);
- debug!(1u16 as i8);
- debug!(1u16 as i16);
- debug!(1u16 as i32);
- debug!(1u16 as i64);
- debug!(1u16 as u8);
- debug!(1u16 as u16);
- debug!(1u16 as u32);
- debug!(1u16 as u64);
- debug!(1u16 as f32);
- debug!(1u16 as f64);
+ info!(1u16 as int);
+ info!(1u16 as uint);
+ info!(1u16 as float);
+ info!(1u16 as bool);
+ 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);
- debug!(1i32 as int);
- debug!(1i32 as uint);
- debug!(1i32 as float);
- debug!(1i32 as bool);
- debug!(1i32 as *libc::FILE);
- debug!(1i32 as i8);
- debug!(1i32 as i16);
- debug!(1i32 as i32);
- debug!(1i32 as i64);
- debug!(1i32 as u8);
- debug!(1i32 as u16);
- debug!(1i32 as u32);
- debug!(1i32 as u64);
- debug!(1i32 as f32);
- debug!(1i32 as f64);
+ info!(1i32 as int);
+ info!(1i32 as uint);
+ info!(1i32 as float);
+ info!(1i32 as bool);
+ 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);
- debug!(1u32 as int);
- debug!(1u32 as uint);
- debug!(1u32 as float);
- debug!(1u32 as bool);
- debug!(1u32 as *libc::FILE);
- debug!(1u32 as i8);
- debug!(1u32 as i16);
- debug!(1u32 as i32);
- debug!(1u32 as i64);
- debug!(1u32 as u8);
- debug!(1u32 as u16);
- debug!(1u32 as u32);
- debug!(1u32 as u64);
- debug!(1u32 as f32);
- debug!(1u32 as f64);
+ info!(1u32 as int);
+ info!(1u32 as uint);
+ info!(1u32 as float);
+ info!(1u32 as bool);
+ 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);
- debug!(1i64 as int);
- debug!(1i64 as uint);
- debug!(1i64 as float);
- debug!(1i64 as bool);
- debug!(1i64 as *libc::FILE);
- debug!(1i64 as i8);
- debug!(1i64 as i16);
- debug!(1i64 as i32);
- debug!(1i64 as i64);
- debug!(1i64 as u8);
- debug!(1i64 as u16);
- debug!(1i64 as u32);
- debug!(1i64 as u64);
- debug!(1i64 as f32);
- debug!(1i64 as f64);
+ info!(1i64 as int);
+ info!(1i64 as uint);
+ info!(1i64 as float);
+ info!(1i64 as bool);
+ 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);
- debug!(1u64 as int);
- debug!(1u64 as uint);
- debug!(1u64 as float);
- debug!(1u64 as bool);
- debug!(1u64 as *libc::FILE);
- debug!(1u64 as i8);
- debug!(1u64 as i16);
- debug!(1u64 as i32);
- debug!(1u64 as i64);
- debug!(1u64 as u8);
- debug!(1u64 as u16);
- debug!(1u64 as u32);
- debug!(1u64 as u64);
- debug!(1u64 as f32);
- debug!(1u64 as f64);
+ info!(1u64 as int);
+ info!(1u64 as uint);
+ info!(1u64 as float);
+ info!(1u64 as bool);
+ 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);
- debug!(1u64 as int);
- debug!(1u64 as uint);
- debug!(1u64 as float);
- debug!(1u64 as bool);
- debug!(1u64 as *libc::FILE);
- debug!(1u64 as i8);
- debug!(1u64 as i16);
- debug!(1u64 as i32);
- debug!(1u64 as i64);
- debug!(1u64 as u8);
- debug!(1u64 as u16);
- debug!(1u64 as u32);
- debug!(1u64 as u64);
- debug!(1u64 as f32);
- debug!(1u64 as f64);
+ info!(1u64 as int);
+ info!(1u64 as uint);
+ info!(1u64 as float);
+ info!(1u64 as bool);
+ 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);
- debug!(true as int);
- debug!(true as uint);
- debug!(true as float);
- debug!(true as bool);
- debug!(true as *libc::FILE);
- debug!(true as i8);
- debug!(true as i16);
- debug!(true as i32);
- debug!(true as i64);
- debug!(true as u8);
- debug!(true as u16);
- debug!(true as u32);
- debug!(true as u64);
- debug!(true as f32);
- debug!(true as f64);
+ info!(true as int);
+ info!(true as uint);
+ info!(true as float);
+ info!(true as bool);
+ 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);
- debug!(1. as int);
- debug!(1. as uint);
- debug!(1. as float);
- debug!(1. as bool);
- debug!(1. as i8);
- debug!(1. as i16);
- debug!(1. as i32);
- debug!(1. as i64);
- debug!(1. as u8);
- debug!(1. as u16);
- debug!(1. as u32);
- debug!(1. as u64);
- debug!(1. as f32);
- debug!(1. as f64);
+ info!(1. as int);
+ info!(1. as uint);
+ info!(1. as float);
+ info!(1. as bool);
+ 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);
- debug!(1f32 as int);
- debug!(1f32 as uint);
- debug!(1f32 as float);
- debug!(1f32 as bool);
- debug!(1f32 as i8);
- debug!(1f32 as i16);
- debug!(1f32 as i32);
- debug!(1f32 as i64);
- debug!(1f32 as u8);
- debug!(1f32 as u16);
- debug!(1f32 as u32);
- debug!(1f32 as u64);
- debug!(1f32 as f32);
- debug!(1f32 as f64);
+ info!(1f32 as int);
+ info!(1f32 as uint);
+ info!(1f32 as float);
+ info!(1f32 as bool);
+ 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);
- debug!(1f64 as int);
- debug!(1f64 as uint);
- debug!(1f64 as float);
- debug!(1f64 as bool);
- debug!(1f64 as i8);
- debug!(1f64 as i16);
- debug!(1f64 as i32);
- debug!(1f64 as i64);
- debug!(1f64 as u8);
- debug!(1f64 as u16);
- debug!(1f64 as u32);
- debug!(1f64 as u64);
- debug!(1f64 as f32);
- debug!(1f64 as f64);
+ info!(1f64 as int);
+ info!(1f64 as uint);
+ info!(1f64 as float);
+ info!(1f64 as bool);
+ 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);
}
extern mod extra;
fn test(actual: ~str, expected: ~str) {
- debug!(actual.clone());
- debug!(expected.clone());
+ info!(actual.clone());
+ info!(expected.clone());
assert_eq!(actual, expected);
}
pub fn main() {
let x = t_rec {c8: 22u8, t: a_tag(44u64)};
let y = fmt!("%?", x);
- debug!("y = %s", y);
+ info!("y = %s", y);
assert_eq!(y, ~"{c8: 22, t: a_tag(44)}");
}
pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
fn evenk(n: int, k: extern fn(bool) -> bool) -> bool {
- debug!("evenk");
- debug!(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 {
- debug!("oddk");
- debug!(n);
+ info!("oddk");
+ info!(n);
if n == 0 { return k(false); } else { return evenk(n - 1, k); }
}
pub fn main() { test00(); }
-fn start() { debug!("Started / Finished task."); }
+fn start() { info!("Started / Finished task."); }
fn test00() {
task::try(|| start() );
- debug!("Completing.");
+ info!("Completing.");
}
pub fn main() { test00(); }
-fn start(task_number: int) { debug!("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.unwrap().recv();
- debug!("Joined task.");
+ info!("Joined task.");
}
}
pub fn main() {
- debug!("Check that we don't deadlock.");
+ info!("Check that we don't deadlock.");
let (p, ch) = comm::stream();
task::try(|| start(&ch, 0, 10) );
- debug!("Joined task");
+ info!("Joined task");
}
// Spawn 10 tasks each sending us back one int.
let mut i = 10;
while (i > 0) {
- debug!(i);
+ info!(i);
let (p, ch) = comm::stream();
po.add(p);
task::spawn({let i = i; || child(i, &ch)});
i = 10;
while (i > 0) {
- debug!(i);
+ info!(i);
po.recv();
i = i - 1;
}
- debug!("main thread exiting");
+ info!("main thread exiting");
}
fn child(x: int, ch: &comm::Chan<int>) {
- debug!(x);
+ info!(x);
ch.send(x);
}
use std::comm;
use std::task;
-pub fn main() { debug!("===== WITHOUT THREADS ====="); test00(); }
+pub fn main() { info!("===== WITHOUT THREADS ====="); test00(); }
fn test00_start(ch: &Chan<int>, message: int, count: int) {
- debug!("Starting test00_start");
+ info!("Starting test00_start");
let mut i: int = 0;
while i < count {
- debug!("Sending Message");
+ info!("Sending Message");
ch.send(message + 0);
i = i + 1;
}
- debug!("Ending test00_start");
+ info!("Ending test00_start");
}
fn test00() {
let number_of_tasks: int = 16;
let number_of_messages: int = 4;
- debug!("Creating tasks");
+ info!("Creating tasks");
let po = comm::PortSet::new();
// Join spawned tasks...
for results.iter().advance |r| { r.recv(); }
- debug!("Completed: Final number is: ");
+ info!("Completed: Final number is: ");
error!(sum);
// assert (sum == (((number_of_tasks * (number_of_tasks - 1)) / 2) *
// number_of_messages));
c.send(4);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
c.send(5);
c.send(6);
c.send(7);
c.send(8);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(r);
+ info!(r);
r = p.recv();
sum += r;
- debug!(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();
- debug!(r);
+ info!(r);
i += 1;
}
pub fn main() {
let mut i = 10;
while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; }
- debug!("main thread exiting");
+ info!("main thread exiting");
}
-fn child(x: int) { debug!(x); }
+fn child(x: int) { info!(x); }
enum myoption<T> { none, some(T), }
-pub fn main() { debug!(5); }
+pub fn main() { info!(5); }
enum myoption<T> { none, some(T), }
-pub fn main() { debug!(5); }
+pub fn main() { info!(5); }
fn check_str_eq(a: ~str, b: ~str) {
let mut i: int = 0;
for a.bytes_iter().advance |ab| {
- debug!(i);
- debug!(ab);
+ info!(i);
+ info!(ab);
let bb: u8 = b[i];
- debug!(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;
- debug!(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]; }
- debug!(later[0]);
+ info!(later[0]);
}
fn p() -> bool { true }
let _a = (assert!((true)) == (assert!(p())));
let _c = (assert!((p())) == ());
- let _b: bool = (debug!("%d", 0) == (return 0u));
+ let _b: bool = (info!("%d", 0) == (return 0u));
}
fn angrydome() {
break; }
}
-fn evil_lincoln() { let evil = debug!("lincoln"); }
+fn evil_lincoln() { let evil = info!("lincoln"); }
pub fn main() {
strange();
let mut i = 1;
while i > 0 {
assert!((i > 0));
- debug!(i);
+ info!(i);
i -= 1;
loop;
}
while z < 50 {
z += 1;
while false { x = y; y = z; }
- debug!(y);
+ info!(y);
}
assert!((y == 42 && z == 50));
}
pub fn main() {
let mut i: int = 90;
while i < 100 {
- debug!(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
- debug!("breaking");
+ info!("breaking");
break;
}
}
pub fn main() {
let mut x: int = 10;
let mut y: int = 0;
- while y < x { debug!(y); debug!("hello"); y = y + 1; }
+ while y < x { info!(y); info!("hello"); y = y + 1; }
while x > 0 {
- debug!("goodbye");
+ info!("goodbye");
x = x - 1;
- debug!(x);
+ info!(x);
}
}