2011-09-23 04:33:11 -05:00
|
|
|
// xfail-pretty
|
|
|
|
|
2011-09-21 05:40:27 -05:00
|
|
|
fn id(x: bool) -> bool { x }
|
|
|
|
|
|
|
|
fn call_id() {
|
|
|
|
let c <- fail;
|
|
|
|
id(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn call_id_2() { id(true) && id(ret); }
|
|
|
|
|
2012-03-26 05:39:20 -05:00
|
|
|
fn call_id_4() { while id(ret) { } }
|
2011-09-21 05:40:27 -05:00
|
|
|
|
2011-09-25 23:01:50 -05:00
|
|
|
fn bind_id_1() { bind id(fail); }
|
|
|
|
|
|
|
|
fn bind_id_2() { bind id(ret); }
|
|
|
|
|
2011-09-25 22:57:44 -05:00
|
|
|
fn fail_fail() { fail fail; }
|
|
|
|
|
2011-12-22 19:53:53 -06:00
|
|
|
fn log_fail() { log(error, fail); }
|
2011-09-21 05:40:27 -05:00
|
|
|
|
2011-12-22 19:53:53 -06:00
|
|
|
fn log_ret() { log(error, ret); }
|
2011-09-23 17:01:19 -05:00
|
|
|
|
2012-03-09 18:11:56 -06:00
|
|
|
fn log_break() { loop { log(error, break); } }
|
2011-09-23 17:01:19 -05:00
|
|
|
|
2011-12-22 19:53:53 -06:00
|
|
|
fn log_cont() { do { log(error, cont); } while false }
|
2011-09-23 17:01:19 -05:00
|
|
|
|
2012-04-07 19:11:33 -05:00
|
|
|
fn ret_ret() -> int { ret 3 + (ret 2); }
|
2011-09-21 05:40:27 -05:00
|
|
|
|
|
|
|
fn ret_guard() {
|
2012-02-15 02:40:42 -06:00
|
|
|
alt check 2 {
|
2012-01-09 19:15:17 -06:00
|
|
|
x if (ret) { x; }
|
2011-09-21 05:40:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 23:24:47 -05:00
|
|
|
fn rec_ret() { let _r: {c: int} = {c: ret}; }
|
2011-09-27 13:05:16 -05:00
|
|
|
|
2012-03-24 23:24:47 -05:00
|
|
|
fn vec_ret() { let _v: [int] = [1, 2, ret, 4]; }
|
2011-09-27 13:05:16 -05:00
|
|
|
|
2011-09-21 05:40:27 -05:00
|
|
|
fn fail_then_concat() {
|
2012-03-22 10:39:41 -05:00
|
|
|
let mut x = [], y = [3];
|
2011-09-21 05:40:27 -05:00
|
|
|
fail;
|
|
|
|
x += y;
|
|
|
|
"good" + "bye";
|
|
|
|
}
|
|
|
|
|
2011-09-27 13:05:16 -05:00
|
|
|
fn main() {
|
|
|
|
// Call the functions that don't fail.
|
|
|
|
rec_ret();
|
|
|
|
vec_ret();
|
|
|
|
ret_ret();
|
|
|
|
log_ret();
|
|
|
|
call_id_2();
|
|
|
|
call_id_4();
|
|
|
|
bind_id_2();
|
|
|
|
ret_guard();
|
|
|
|
}
|