rpass: Remove usage of fmt!

This commit is contained in:
Alex Crichton 2013-09-29 19:23:57 -07:00
parent 86e613c632
commit 630082ca89
308 changed files with 838 additions and 828 deletions

View File

@ -91,7 +91,7 @@ pub fn parse_config(args: ~[~str]) -> config {
let matches =
&match getopts::groups::getopts(args_, groups) {
Ok(m) => m,
Err(f) => fail2!(f.to_err_msg())
Err(f) => fail2!("{}", f.to_err_msg())
};
if matches.opt_present("h") || matches.opt_present("help") {

View File

@ -21,11 +21,11 @@ pub mod kitties {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -33,7 +33,7 @@ pub mod kitties {
impl cat {
pub fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;

View File

@ -21,7 +21,7 @@ pub mod kitty {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
@ -35,12 +35,12 @@ pub mod kitty {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}

View File

@ -33,7 +33,7 @@ pub fn alist_get<A:Clone + 'static,
return entry.value.clone();
}
}
fail!();
fail2!();
}
#[inline]

View File

@ -28,7 +28,7 @@ pub mod rustrt {
#[fixed_stack_segment] #[inline(never)]
pub fn fact(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}

View File

@ -17,7 +17,7 @@ impl <T:Clone> Index<uint,T> for maybe<T> {
fn index(&self, _idx: &uint) -> T {
match self {
&just(ref t) => (*t).clone(),
&nothing => { fail!(); }
&nothing => { fail2!(); }
}
}
}

View File

@ -9,5 +9,5 @@
// except according to those terms.
pub unsafe fn f(xs: ~[int]) {
xs.map(|_x| { unsafe fn q() { fail!(); } });
xs.map(|_x| { unsafe fn q() { fail2!(); } });
}

View File

@ -38,6 +38,6 @@ impl read for bool {
pub fn read<T:read>(s: ~str) -> T {
match read::readMaybe(s) {
Some(x) => x,
_ => fail!("read failed!")
_ => fail2!("read failed!")
}
}

View File

@ -36,7 +36,7 @@ fn f<A:Clone + 'static>(a: A, b: u16) -> @Invokable<A> {
pub fn main() {
let (a, b) = f(22_u64, 44u16).f();
info!("a=%? b=%?", a, b);
info2!("a={:?} b={:?}", a, b);
assert_eq!(a, 22u64);
assert_eq!(b, 44u16);
}

View File

@ -55,7 +55,7 @@ pub fn main() {
let z = f(~x, y);
make_cycle(z);
let (a, b) = z.f();
info!("a=%u b=%u", *a as uint, b as uint);
info2!("a={} b={}", *a as uint, b as uint);
assert_eq!(*a, x);
assert_eq!(b, y);
}

View File

@ -12,6 +12,6 @@
pub fn main() {
let a: int = 10;
info!(a);
info2!("{}", a);
assert_eq!(a * (a - 1), 90);
}

View File

@ -28,6 +28,6 @@ pub fn main() {
assert_eq!(i32_b << 1, i32_b << 1);
assert_eq!(i32_b >> 1, i32_b >> 1);
assert_eq!(i32_b & i32_b << 1, 0);
info!(i32_b | i32_b << 1);
info2!("{}", i32_b | i32_b << 1);
assert_eq!(i32_b | i32_b << 1, 0x30303030);
}

View File

@ -11,7 +11,7 @@
// xfail-fast
pub fn main() {
fail!()
fail2!()
}
#[main]

View File

@ -19,6 +19,6 @@ struct Triple { x: int, y: int, z: int }
fn f<T,U>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
pub fn main() {
info!("%?", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
info!("%?", f(5, 6).a);
info2!("{:?}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
info2!("{:?}", f(5, 6).a);
}

View File

@ -14,13 +14,13 @@ trait Foo {
impl<T:Foo> Foo for @T {
fn foo(&self) -> ~str {
fmt!("@%s", (**self).foo())
format!("@{}", (**self).foo())
}
}
impl Foo for uint {
fn foo(&self) -> ~str {
fmt!("%u", *self)
format!("{}", *self)
}
}

View File

@ -11,6 +11,6 @@
// Check that issue #954 stays fixed
pub fn main() {
match -1 { -1 => {}, _ => fail!("wat") }
match -1 { -1 => {}, _ => fail2!("wat") }
assert_eq!(1-1, 0);
}

View File

@ -18,6 +18,6 @@ pub fn main() {
let x = Some(p);
match x {
Some(z) => { dispose(z); },
None => fail!()
None => fail2!()
}
}

View File

@ -81,7 +81,7 @@ fn test_class() {
let mut r = p(1, 2);
unsafe {
error!("q = %x, r = %x",
error2!("q = {:x}, r = {:x}",
(::std::cast::transmute::<*p, uint>(&q)),
(::std::cast::transmute::<*p, uint>(&r)));
}

View File

@ -27,8 +27,8 @@ fn general() {
a ^= b;
b ^= a;
a = a ^ b;
info!(a);
info!(b);
info2!("{}", a);
info2!("{}", b);
assert_eq!(b, 1);
assert_eq!(a, 2);
assert_eq!(!0xf0 & 0xff, 0xf);

View File

@ -14,7 +14,7 @@ pub fn main() {
// Statement form does not require parentheses:
for i in v.iter() {
info!("%?", *i);
info2!("{:?}", *i);
}
// Usable at all:
@ -35,14 +35,14 @@ pub fn main() {
assert!(false);
}
match do v.iter().all |e| { e.is_negative() } {
true => { fail!("incorrect answer."); }
true => { fail2!("incorrect answer."); }
false => { }
}
match 3 {
_ if do v.iter().any |e| { e.is_negative() } => {
}
_ => {
fail!("wrong answer.");
fail2!("wrong answer.");
}
}

View File

@ -10,5 +10,5 @@
pub fn main() {
fn as_buf<T>(s: ~str, f: &fn(~str) -> T) -> T { f(s) }
as_buf(~"foo", |foo: ~str| -> () error!(foo) );
as_buf(~"foo", |foo: ~str| -> () error2!("{}", foo) );
}

View File

@ -20,6 +20,6 @@ pub fn main() {
odds += 1;
}
});
error!(odds);
error2!("{:?}", odds);
assert_eq!(odds, 4);
}

View File

@ -20,6 +20,6 @@ pub fn main() {
sum += *i * *j;
});
});
error!(sum);
error2!("{:?}", sum);
assert_eq!(sum, 225);
}

View File

@ -19,11 +19,11 @@ impl Foo {
);
match s {
~Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)),
_ => fail!()
_ => fail2!()
}
}
fn check_id(&mut self, s: int) { fail!() }
fn check_id(&mut self, s: int) { fail2!() }
}
pub fn main() { }

View File

@ -31,9 +31,9 @@ pub fn main() {
add_int(ints, 44);
do iter_ints(ints) |i| {
error!("int = %d", *i);
error2!("int = {}", *i);
true
};
error!("ints=%?", ints);
error2!("ints={:?}", ints);
}

View File

@ -23,7 +23,7 @@ pub fn main() {
x = @F {f: ~4};
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -28,7 +28,7 @@ pub fn main() {
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
x = @F {f: ~4};
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -23,7 +23,7 @@ pub fn main() {
*x = @F {f: ~4};
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -28,7 +28,7 @@ pub fn main() {
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
*x = @F{f: ~4};
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -26,7 +26,7 @@ pub fn main() {
assert_eq!(ptr::to_unsafe_ptr(&(*x)), ptr::to_unsafe_ptr(&(*b_x)));
x = @22;
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -25,13 +25,13 @@ fn testfn(cond: bool) {
exp = 4;
}
info!("*r = %d, exp = %d", *r, exp);
info2!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);
x = @5;
y = @6;
info!("*r = %d, exp = %d", *r, exp);
info2!("*r = {}, exp = {}", *r, exp);
assert_eq!(*r, exp);
assert_eq!(x, @5);
assert_eq!(y, @6);

View File

@ -28,7 +28,7 @@ pub fn main() {
assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
x = @F {f: ~4};
info!("ptr::to_unsafe_ptr(*b_x) = %x",
info2!("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)));

View File

@ -14,7 +14,7 @@ struct noncopyable {
impl Drop for noncopyable {
fn drop(&mut self) {
error!("dropped");
error2!("dropped");
}
}

View File

@ -19,7 +19,7 @@ fn is_odd(_n: int) -> bool { return true; }
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)) { error!("bloop"); }
if is_odd(n) && length_is_even(some_box(1)) { error2!("bloop"); }
}
pub fn main() { foo(67, 5); }

View File

@ -19,7 +19,7 @@ fn is_odd(_n: int) -> bool { return true; }
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)) { error!("bloop"); }
if is_odd(n) || length_is_even(some_box(1)) { error2!("bloop"); }
}
pub fn main() { foo(67, 5); }

View File

@ -17,6 +17,6 @@ fn unbox<T:Clone>(b: Box<T>) -> T { return (*b.c).clone(); }
pub fn main() {
let foo: int = 17;
let bfoo: Box<int> = Box {c: @foo};
info!("see what's in our box");
info2!("see what's in our box");
assert_eq!(unbox::<int>(bfoo), foo);
}

View File

@ -15,7 +15,7 @@ struct Tree<T> {
parent: Option<T>
}
fn empty<T>() -> Tree<T> { fail!() }
fn empty<T>() -> Tree<T> { fail2!() }
struct Box {
tree: Tree<@Box>

View File

@ -19,14 +19,14 @@ fn hello<S:Speak>(s:&S) -> ~str{
impl Speak for int {
fn say(&self, s:&str) -> ~str {
fmt!("%s: %d", s, *self)
format!("{}: {}", s, *self)
}
}
impl<T: Speak> Speak for Option<T> {
fn say(&self, s:&str) -> ~str {
match *self {
None => fmt!("%s - none", s),
None => format!("{} - none", s),
Some(ref x) => { ~"something!" + x.say(s) }
}
}

View File

@ -12,5 +12,5 @@ use std::borrow;
pub fn main() {
let x = 3;
info!("&x=%x", borrow::to_uint(&x));
info2!("&x={:x}", borrow::to_uint(&x));
}

View File

@ -17,6 +17,6 @@ use cci_borrow_lib::foo;
pub fn main() {
let p = @22u;
let r = foo(p);
info!("r=%u", r);
info2!("r={}", r);
assert_eq!(r, 22u);
}

View File

@ -16,7 +16,7 @@ struct cat {
impl Drop for cat {
#[cat_dropper]
fn drop(&mut self) { error!("%s landed on hir feet" , self . name); }
fn drop(&mut self) { error2!("{} landed on hir feet" , self . name); }
}

View File

@ -18,7 +18,7 @@ impl Drop for cat {
Actually, cats don't always land on their feet when you drop them.
*/
fn drop(&mut self) {
error!("%s landed on hir feet", self.name);
error2!("{} landed on hir feet", self.name);
}
}

View File

@ -16,7 +16,7 @@ use cci_class_cast::kitty::*;
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
info!("%s", actual);
info2!("{}", actual);
assert_eq!(actual, expected);
}

View File

@ -20,7 +20,7 @@ struct dog {
impl dog {
fn bark(&self) -> int {
info!("Woof %u %d", *self.barks, *self.volume);
info2!("Woof {} {}", *self.barks, *self.volume);
*self.barks += 1u;
if *self.barks % 3u == 0u {
*self.volume += 1;
@ -28,7 +28,7 @@ impl dog {
if *self.barks % 10u == 0u {
*self.volume -= 2;
}
info!("Grrr %u %d", *self.barks, *self.volume);
info2!("Grrr {} {}", *self.barks, *self.volume);
*self.volume
}
}
@ -62,7 +62,7 @@ impl cat {
impl cat {
fn meow(&self) -> uint {
info!("Meow");
info2!("Meow");
*self.meows += 1u;
if *self.meows % 5u == 0u {
*self.how_hungry += 1;

View File

@ -25,12 +25,12 @@ impl noisy for cat {
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -38,7 +38,7 @@ impl cat {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;

View File

@ -38,11 +38,11 @@ impl<T> cat<T> {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -75,7 +75,7 @@ impl<T> MutableMap<int, T> for cat<T> {
true
}
fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail!() }
fn find_mut<'a>(&'a mut self, _k: &int) -> Option<&'a mut T> { fail2!() }
fn remove(&mut self, k: &int) -> bool {
if self.find(k).is_some() {
@ -85,16 +85,16 @@ impl<T> MutableMap<int, T> for cat<T> {
}
}
fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
fn pop(&mut self, _k: &int) -> Option<T> { fail2!() }
fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail2!() }
}
impl<T> cat<T> {
pub fn get<'a>(&'a self, k: &int) -> &'a T {
match self.find(k) {
Some(v) => { v }
None => { fail!("epic fail"); }
None => { fail2!("epic fail"); }
}
}
@ -106,7 +106,7 @@ impl<T> cat<T> {
impl<T> cat<T> {
fn meow(&mut self) {
self.meows += 1;
error!("Meow %d", self.meows);
error2!("Meow {}", self.meows);
if self.meows % 5 == 0 {
self.how_hungry += 1;
}

View File

@ -23,12 +23,12 @@ struct cat {
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -40,7 +40,7 @@ impl noisy for cat {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;

View File

@ -24,7 +24,7 @@ struct cat {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
@ -35,11 +35,11 @@ impl cat {
impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}

View File

@ -21,12 +21,12 @@ impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -34,7 +34,7 @@ impl cat {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
@ -58,7 +58,7 @@ impl ToStr for cat {
fn print_out(thing: @ToStr, expected: ~str) {
let actual = thing.to_str();
info!("%s", actual);
info2!("{}", actual);
assert_eq!(actual, expected);
}

View File

@ -20,11 +20,11 @@ impl cat {
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
error2!("Not hungry!");
return false;
}
}
@ -32,7 +32,7 @@ impl cat {
impl cat {
fn meow(&mut self) {
error!("Meow");
error2!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;

View File

@ -11,7 +11,7 @@
use std::task;
fn adder(x: @int, y: @int) -> int { return *x + *y; }
fn failer() -> @int { fail!(); }
fn failer() -> @int { fail2!(); }
pub fn main() {
assert!(task::try(|| {
adder(@2, failer()); ()

View File

@ -40,7 +40,7 @@ fn f<A:Clone + 'static>(a: A, b: u16) -> @Invokable<A> {
pub fn main() {
let (a, b) = f(22_u64, 44u16).f();
info!("a=%? b=%?", a, b);
info2!("a={:?} b={:?}", a, b);
assert_eq!(a, 22u64);
assert_eq!(b, 44u16);
}

View File

@ -15,13 +15,13 @@ pub fn main() {
let (p, ch) = stream();
let _t = task::spawn(|| child(&ch) );
let y = p.recv();
error!("received");
error!(y);
error2!("received");
error2!("{:?}", y);
assert_eq!(y, 10);
}
fn child(c: &Chan<int>) {
error!("sending");
error2!("sending");
c.send(10);
error!("value sent");
error2!("value sent");
}

View File

@ -37,7 +37,7 @@ fn foo(x: int) -> int {
pub fn main() {
let x: int = 2 + 2;
info!("%?", x);
info!("hello, world");
info!("%?", 10);
info2!("{}", x);
info2!("hello, world");
info2!("{}", 10);
}

View File

@ -14,5 +14,5 @@
fn main() {
// only fails if debug! evaluates its argument.
debug!({ if true { fail!() } });
debug2!("{:?}", { if true { fail2!() } });
}

View File

@ -14,7 +14,7 @@
fn main() {
// exits early if debug! evaluates its arguments, otherwise it
// will hit the fail.
debug!({ if true { return; } });
debug2!("{:?}", { if true { return; } });
fail!();
fail2!();
}

View File

@ -19,18 +19,18 @@ static X: Foo = Baz;
pub fn main() {
match X {
Baz => {}
_ => fail!()
_ => fail2!()
}
match Y {
Bar(s) => assert!(s == 2654435769),
_ => fail!()
_ => fail2!()
}
match Z {
Quux(d,h) => {
assert_eq!(d, 0x123456789abcdef0);
assert_eq!(h, 0x1234);
}
_ => fail!()
_ => fail2!()
}
}

View File

@ -15,7 +15,7 @@ impl E {
pub fn method(&self) {
match *self {
V => {}
VV(*) => fail!()
VV(*) => fail2!()
}
}
}

View File

@ -14,7 +14,7 @@ static C: E = V;
fn f(a: &E) {
match *a {
V => {}
VV(*) => fail!()
VV(*) => fail2!()
}
}

View File

@ -14,6 +14,6 @@ static C: &'static E = &V0;
pub fn main() {
match *C {
V0 => (),
_ => fail!()
_ => fail2!()
}
}

View File

@ -17,7 +17,7 @@ static C: E = S1 { u: 23 };
pub fn main() {
match C {
S0 { _ } => fail!(),
S0 { _ } => fail2!(),
S1 { u } => assert!(u == 23)
}
}

View File

@ -16,10 +16,10 @@ static C1: E = C[1];
pub fn main() {
match C0 {
V0 => (),
_ => fail!()
_ => fail2!()
}
match C1 {
V1(n) => assert!(n == 0xDEADBEE),
_ => fail!()
_ => fail2!()
}
}

View File

@ -14,10 +14,10 @@ static C: &'static [E] = &[V0, V1(0xDEADBEE), V0];
pub fn main() {
match C[1] {
V1(n) => assert!(n == 0xDEADBEE),
_ => fail!()
_ => fail2!()
}
match C[2] {
V0 => (),
_ => fail!()
_ => fail2!()
}
}

View File

@ -14,10 +14,10 @@ static C: [E, ..3] = [V0, V1(0xDEADBEE), V0];
pub fn main() {
match C[1] {
V1(n) => assert!(n == 0xDEADBEE),
_ => fail!()
_ => fail2!()
}
match C[2] {
V0 => (),
_ => fail!()
_ => fail2!()
}
}

View File

@ -19,11 +19,11 @@ static X: Foo = Bar;
pub fn main() {
match X {
Bar => {}
Baz | Boo => fail!()
Baz | Boo => fail2!()
}
match Y {
Baz => {}
Bar | Boo => fail!()
Bar | Boo => fail2!()
}
}

View File

@ -12,4 +12,4 @@
static i: int = 10;
pub fn main() { info!("%i", i); }
pub fn main() { info2!("{}", i); }

View File

@ -15,6 +15,6 @@
#[start]
fn start(argc: int, argv: **u8) -> int {
do std::rt::start(argc, argv) {
info!("creating my own runtime is joy");
info2!("creating my own runtime is joy");
}
}

View File

@ -12,4 +12,4 @@
// -*- rust -*-
pub fn main() { if 1 == 1 { return; } info!("Paul is dead"); }
pub fn main() { if 1 == 1 { return; } info2!("Paul is dead"); }

View File

@ -10,4 +10,4 @@
pub fn main() { let x = @mut 5; *x = 1000; info!("%?", *x); }
pub fn main() { let x = @mut 5; *x = 1000; info2!("{:?}", *x); }

View File

@ -14,19 +14,19 @@
pub struct FailCmp;
impl Eq for FailCmp {
fn eq(&self, _: &FailCmp) -> bool { fail!("eq") }
fn eq(&self, _: &FailCmp) -> bool { fail2!("eq") }
}
impl Ord for FailCmp {
fn lt(&self, _: &FailCmp) -> bool { fail!("lt") }
fn lt(&self, _: &FailCmp) -> bool { fail2!("lt") }
}
impl TotalEq for FailCmp {
fn equals(&self, _: &FailCmp) -> bool { fail!("equals") }
fn equals(&self, _: &FailCmp) -> bool { fail2!("equals") }
}
impl TotalOrd for FailCmp {
fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") }
fn cmp(&self, _: &FailCmp) -> Ordering { fail2!("cmp") }
}
#[deriving(Eq,Ord,TotalEq,TotalOrd)]

View File

@ -3,9 +3,9 @@
#[allow(unreachable_code)];
fn f() {
fail!();
fail2!();
let _x: int = fail!();
let _x: int = fail2!();
}
pub fn main() {

View File

@ -27,7 +27,7 @@ fn is_aligned<T>(ptr: &T) -> bool {
pub fn main() {
let x = Some(0u64);
match x {
None => fail!(),
None => fail2!(),
Some(ref y) => assert!(is_aligned(y))
}
}

View File

@ -20,6 +20,6 @@ pub fn main() {
};
assert_eq!(expected, V as u64);
assert_eq!(expected, C as u64);
assert_eq!(fmt!("%?", V), ~"V");
assert_eq!(fmt!("%?", C), ~"V");
assert_eq!(format!("{:?}", V), ~"V");
assert_eq!(format!("{:?}", C), ~"V");
}

View File

@ -19,6 +19,6 @@ pub fn main() {
match Cons(10, @Nil) {
Cons(10, _) => {}
Nil => {}
_ => fail!()
_ => fail2!()
}
}

View File

@ -14,8 +14,8 @@ pub fn main() {
let v = &"hello";
let y : &str = &"there";
info!(x);
info!(y);
info2!("{}", x);
info2!("{}", y);
assert_eq!(x[0], 'h' as u8);
assert_eq!(x[4], 'o' as u8);
@ -30,7 +30,7 @@ pub fn main() {
let c = &"cccc";
let cc = &"ccccc";
info!(a);
info2!("{}", a);
assert!(a < b);
assert!(a <= b);
@ -38,7 +38,7 @@ pub fn main() {
assert!(b >= a);
assert!(b > a);
info!(b);
info2!("{}", b);
assert!(a < c);
assert!(a <= c);
@ -46,7 +46,7 @@ pub fn main() {
assert!(c >= a);
assert!(c > a);
info!(c);
info2!("{}", c);
assert!(c < cc);
assert!(c <= cc);
@ -54,5 +54,5 @@ pub fn main() {
assert!(cc >= c);
assert!(cc > c);
info!(cc);
info2!("{}", cc);
}

View File

@ -22,7 +22,7 @@ pub fn main() {
let c : &[int] = &[2,2,2,2,3];
let cc : &[int] = &[2,2,2,2,2,2];
info!(a);
info2!("{:?}", a);
assert!(a < b);
assert!(a <= b);
@ -30,7 +30,7 @@ pub fn main() {
assert!(b >= a);
assert!(b > a);
info!(b);
info2!("{:?}", b);
assert!(b < c);
assert!(b <= c);
@ -44,7 +44,7 @@ pub fn main() {
assert!(c >= a);
assert!(c > a);
info!(c);
info2!("{:?}", c);
assert!(a < cc);
assert!(a <= cc);
@ -52,5 +52,5 @@ pub fn main() {
assert!(cc >= a);
assert!(cc > a);
info!(cc);
info2!("{:?}", cc);
}

View File

@ -13,7 +13,7 @@ mod foo {
pub fn y() { super::super::foo::x(); }
}
pub fn x() { info!("x"); }
pub fn x() { info2!("x"); }
}
pub fn main() { self::foo::bar::y(); }

View File

@ -15,7 +15,7 @@ pub mod foo {
}
pub mod bar {
pub fn x() { info!("x"); }
pub fn x() { info2!("x"); }
}
pub fn main() { foo::x(); }

View File

@ -21,8 +21,8 @@ fn test_generic<T>(expected: @T, eq: compare<T>) {
fn test_box() {
fn compare_box(b1: @bool, b2: @bool) -> bool {
info!(*b1);
info!(*b2);
info2!("{}", *b1);
info2!("{}", *b2);
return *b1 == *b2;
}
test_generic::<bool>(@true, compare_box);

View File

@ -20,8 +20,8 @@ fn test_generic<T:Clone>(expected: ~T, eq: compare<T>) {
fn test_box() {
fn compare_box(b1: ~bool, b2: ~bool) -> bool {
info!(*b1);
info!(*b2);
info2!("{}", *b1);
info2!("{}", *b2);
return *b1 == *b2;
}
test_generic::<bool>(~true, compare_box);

View File

@ -14,6 +14,6 @@ pub fn main() {
let _x = if true {
10
} else {
if true { fail!() } else { fail!() }
if true { fail2!() } else { fail2!() }
};
}

View File

@ -8,15 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn test_if_fail() { let x = if false { fail!() } else { 10 }; assert!((x == 10)); }
fn test_if_fail() { let x = if false { fail2!() } else { 10 }; assert!((x == 10)); }
fn test_else_fail() {
let x = if true { 10 } else { fail!() };
let x = if true { 10 } else { fail2!() };
assert_eq!(x, 10);
}
fn test_elseif_fail() {
let x = if false { 0 } else if false { fail!() } else { 10 };
let x = if false { 0 } else if false { fail2!() } else { 10 };
assert_eq!(x, 10);
}

View File

@ -15,13 +15,13 @@
// Tests for match as expressions resulting in boxed types
fn test_box() {
let res = match true { true => { @100 } _ => fail!("wat") };
let res = match true { true => { @100 } _ => fail2!("wat") };
assert_eq!(*res, 100);
}
fn test_str() {
let res = match true { true => { ~"happy" },
_ => fail!("not happy at all") };
_ => fail2!("not happy at all") };
assert_eq!(res, ~"happy");
}

View File

@ -17,6 +17,6 @@ pub fn main() {
let _x =
match true {
true => { 10 }
false => { match true { true => { fail!() } false => { fail!() } } }
false => { match true { true => { fail2!() } false => { fail2!() } } }
};
}

View File

@ -9,12 +9,12 @@
// except according to those terms.
fn test_simple() {
let r = match true { true => { true } false => { fail!() } };
let r = match true { true => { true } false => { fail2!() } };
assert_eq!(r, true);
}
fn test_box() {
let r = match true { true => { ~[10] } false => { fail!() } };
let r = match true { true => { ~[10] } false => { fail2!() } };
assert_eq!(r[0], 10);
}

View File

@ -15,7 +15,7 @@
type compare<T> = &'static fn(@T, @T) -> bool;
fn test_generic<T>(expected: @T, eq: compare<T>) {
let actual: @T = match true { true => { expected }, _ => fail!() };
let actual: @T = match true { true => { expected }, _ => fail2!() };
assert!((eq(expected, actual)));
}

View File

@ -14,7 +14,7 @@
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() }, _ => fail!("wat") };
let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") };
assert!((eq(expected, actual)));
}

View File

@ -16,7 +16,7 @@ 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() },
_ => fail!("wat")
_ => fail2!("wat")
};
assert!((eq(expected, actual)));
}

View File

@ -16,7 +16,7 @@ type compare<'self, T> = &'self fn(T, T) -> bool;
fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
let actual: T = match true {
true => expected.clone(),
_ => fail!("wat")
_ => fail2!("wat")
};
assert!((eq(expected, actual)));
}

View File

@ -14,7 +14,7 @@
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() }, _ => fail!("wat") };
let actual: T = match true { true => { expected.clone() }, _ => fail2!("wat") };
assert!((eq(expected, actual)));
}

View File

@ -17,7 +17,7 @@
struct R { i: int }
fn test_rec() {
let rs = match true { true => R {i: 100}, _ => fail!() };
let rs = match true { true => R {i: 100}, _ => fail2!() };
assert_eq!(rs.i, 100);
}

View File

@ -15,7 +15,7 @@
// Tests for match as expressions resulting in boxed types
fn test_box() {
let res = match true { true => { ~100 }, _ => fail!() };
let res = match true { true => { ~100 }, _ => fail2!() };
assert_eq!(*res, 100);
}

View File

@ -31,13 +31,13 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
#[fixed_stack_segment]
fn count(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = count(1000u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 1000u);
}

View File

@ -32,7 +32,7 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
#[fixed_stack_segment] #[inline(never)]
fn count(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
@ -42,7 +42,7 @@ pub fn main() {
// has a large stack)
do task::spawn {
let result = count(1000u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 1000u);
};
}

View File

@ -31,13 +31,13 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
#[fixed_stack_segment] #[inline(never)]
fn fact(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 3628800u);
}

View File

@ -36,7 +36,7 @@ extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
#[fixed_stack_segment] #[inline(never)]
fn count(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
rustrt::rust_dbg_call(cb, n)
}
}
@ -46,7 +46,7 @@ pub fn main() {
// has a large stack)
do task::spawn {
let result = count(12u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 2048u);
};
}

View File

@ -16,13 +16,13 @@ extern mod externcallback(vers = "0.1");
#[fixed_stack_segment] #[inline(never)]
fn fact(n: uint) -> uint {
unsafe {
info!("n = %?", n);
info2!("n = {}", n);
externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
}
}
pub fn main() {
let result = fact(10u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 3628800u);
}

View File

@ -41,7 +41,7 @@ pub fn main() {
do 10u.times {
do task::spawn {
let result = count(5u);
info!("result = %?", result);
info2!("result = {}", result);
assert_eq!(result, 16u);
};
}

View File

@ -15,7 +15,7 @@
fn f(x: int) -> int {
// info!("in f:");
info!(x);
info2!("{}", x);
if x == 1 {
// info!("bottoming out");
@ -26,7 +26,7 @@ fn f(x: int) -> int {
let y: int = x * f(x - 1);
// info!("returned");
info!(y);
info2!("{}", y);
return y;
}
}

View File

@ -17,7 +17,7 @@ enum color {
}
pub fn main() {
error!(match red {
error2!("{}", match red {
red => { 1 }
green => { 2 }
blue => { 3 }

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