type complex = (f64, f64);
fn sin(f: f64) -> f64 {
...
-# fail2!();
+# fail!();
}
fn cos(f: f64) -> f64 {
...
-# fail2!();
+# fail!();
}
fn tan(f: f64) -> f64 {
...
-# fail2!();
+# fail!();
}
}
~~~~
~~~~
fn my_err(s: &str) -> ! {
- info2!("{}", s);
- fail2!();
+ info!("{}", s);
+ fail!();
}
~~~~
typecheck:
~~~~
-# fn my_err(s: &str) -> ! { fail2!() }
+# fn my_err(s: &str) -> ! { fail!() }
fn f(i: int) -> int {
if i == 42 {
let x: List<int> = Cons(10, @Cons(11, @Nil));
match x {
- Cons(_, @Nil) => fail2!("singleton list"),
+ Cons(_, @Nil) => fail!("singleton list"),
Cons(*) => return,
- Nil => fail2!("empty list")
+ Nil => fail!("empty list")
}
~~~~
return;
}
_ => {
- fail2!();
+ fail!();
}
}
~~~~
let message = match maybe_digit {
Some(x) if x < 10 => process_digit(x),
Some(x) => process_other(x),
- None => fail2!()
+ None => fail!()
};
~~~~
~~~~
fn main() {
- error2!("This is an error log")
- warn2!("This is a warn log")
- info2!("this is an info log")
- debug2!("This is a debug log")
+ error!("This is an error log")
+ warn!("This is a warn log")
+ info!("this is an info log")
+ debug!("This is a debug log")
}
~~~~
// complicated stuff goes here
return result + val;
},
- _ => fail2!("Didn't get good_2")
+ _ => fail!("Didn't get good_2")
}
}
_ => return 0 // default value
biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
binds g1, val )
biased_match!((g1.body) ~ (good_2(result) )
- else { fail2!("Didn't get good_2") };
+ else { fail!("Didn't get good_2") };
binds result )
// complicated stuff goes here
return result + val;
# fn f(x: t1) -> uint {
biased_match!(
(x) ~ (good_1(g1, val)) else { return 0 };
- (g1.body) ~ (good_2(result) ) else { fail2!("Didn't get good_2") };
+ (g1.body) ~ (good_2(result) ) else { fail!("Didn't get good_2") };
binds val, result )
// complicated stuff goes here
return result + val;
~~~~
let mytup: (int, int, f64) = (10, 20, 30.0);
match mytup {
- (a, b, c) => info2!("{}", a + b + (c as int))
+ (a, b, c) => info!("{}", a + b + (c as int))
}
~~~~
struct MyTup(int, int, f64);
let mytup: MyTup = MyTup(10, 20, 30.0);
match mytup {
- MyTup(a, b, c) => info2!("{}", a + b + (c as int))
+ MyTup(a, b, c) => info!("{}", a + b + (c as int))
}
~~~~
use std::task::spawn;
do spawn() || {
- debug2!("I'm a task, whatever");
+ debug!("I'm a task, whatever");
}
~~~~
use std::task::spawn;
do spawn {
- debug2!("Kablam!");
+ debug!("Kablam!");
}
~~~~